Sleuth Kit Java Bindings (JNI)  4.6
Java bindings for using The Sleuth Kit
ArtifactHelperBase.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 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.blackboardutils;
20 
21 import java.util.Collection;
22 import org.apache.commons.lang3.StringUtils;
26 
31 class ArtifactHelperBase {
32 
33  private final SleuthkitCase caseDb;
34  private final Content srcContent; // artifact source
35  private final String moduleName; // module creating the artifacts
36 
44  ArtifactHelperBase(SleuthkitCase caseDb, String moduleName, Content srcContent) {
45  this.moduleName = moduleName;
46  this.srcContent = srcContent;
47  this.caseDb = caseDb;
48  }
49 
55  Content getContent() {
56  return this.srcContent;
57  }
58 
64  SleuthkitCase getSleuthkitCase() {
65  return this.caseDb;
66  }
67 
73  String getModuleName() {
74  return this.moduleName;
75  }
76 
86  void addAttributeIfNotNull(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, String attrValue, Collection<BlackboardAttribute> attributes) {
87  if (!StringUtils.isEmpty(attrValue)) {
88  attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue));
89  }
90  }
91 
100  void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, long attrValue, Collection<BlackboardAttribute> attributes) {
101  if (attrValue > 0) {
102  attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue));
103  }
104  }
105 }

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