Sleuth Kit Java Bindings (JNI)  4.11.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  if (description.length() > MAX_FULL_DESCRIPTION_LENGTH) {
37  description = description.substring(0, MAX_FULL_DESCRIPTION_LENGTH);
38  }
39  BlackboardAttribute timeAttribute = artifact.getAttribute(getDateTimeAttributeType());
40 
41  if (timeAttribute == null) {
42  return null;
43  }
44 
45  long time = timeAttribute.getValueLong();
46  return new TimelineEventDescriptionWithTime(time, timeAttribute.getDisplayString(), null, description);
47  }
48 
49  TimelineEventArtifactTypeSingleDescription(int typeID, String displayName,
50  TimelineEventType superType, BlackboardArtifact.Type artifactType, BlackboardAttribute.Type timeAttribute, BlackboardAttribute.Type descriptionAttribute) {
51  super(typeID, displayName, superType, artifactType, timeAttribute,
52  new NullExtractor(), new NullExtractor(), new AttributeExtractor(descriptionAttribute));
53  }
54 
55  TimelineEventDescription parseDescription(String fullDescription, String medDescription, String shortDescription) {
56  return new TimelineEventDescription(fullDescription);
57  }
58 
64  final static class NullExtractor implements TSKCoreCheckedFunction<BlackboardArtifact, String> {
65 
66  @Override
67  public String apply(BlackboardArtifact ignored) throws TskCoreException {
68  return null;
69  }
70  }
71 }

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