Sleuth Kit Java Bindings (JNI)  4.8.0
Java bindings for using The Sleuth Kit
TimelineEventArtifactTypeSingleDescription.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2018-2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.datamodel;
20 
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 
29 class TimelineEventArtifactTypeSingleDescription extends TimelineEventArtifactTypeImpl {
30 
31  private static final Logger logger = Logger.getLogger(TimelineEventArtifactTypeSingleDescription.class.getName());
32 
33  @Override
34  public TimelineEventDescriptionWithTime makeEventDescription(BlackboardArtifact artifact) throws TskCoreException {
35  String description = extractFullDescription(artifact);
36  BlackboardAttribute timeAttribute = artifact.getAttribute(getDateTimeAttributeType());
37 
38  if (timeAttribute == null) {
39  logger.log(Level.WARNING, "Artifact {0} has no date/time attribute, skipping it.", artifact.toString()); // NON-NLS
40  return null;
41  }
42 
43  long time = timeAttribute.getValueLong();
44  return new TimelineEventDescriptionWithTime(time, null, null, description);
45  }
46 
47  TimelineEventArtifactTypeSingleDescription(int typeID, String displayName,
48  TimelineEventType superType, BlackboardArtifact.Type artifactType, BlackboardAttribute.Type timeAttribute, BlackboardAttribute.Type descriptionAttribute) {
49  super(typeID, displayName, superType, artifactType, timeAttribute,
50  new NullExtractor(), new NullExtractor(), new AttributeExtractor(descriptionAttribute));
51  }
52 
53  TimelineEventDescription parseDescription(String fullDescription, String medDescription, String shortDescription) {
54  return new TimelineEventDescription(fullDescription);
55  }
56 
62  final static class NullExtractor implements TSKCoreCheckedFunction<BlackboardArtifact, String> {
63 
64  @Override
65  public String apply(BlackboardArtifact ignored) throws TskCoreException {
66  return null;
67  }
68  }
69 }

Copyright © 2011-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.