Sleuth Kit Java Bindings (JNI) 4.14.0
Java bindings for using The Sleuth Kit
Loading...
Searching...
No Matches
ArtifactHelperBase.java
Go to the documentation of this file.
1/*
2 * Sleuth Kit Data Model
3 *
4 * Copyright 2019-2021 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 */
19package org.sleuthkit.datamodel.blackboardutils;
20
21import java.util.Collection;
22import java.util.Optional;
23import org.apache.commons.lang3.StringUtils;
24import org.sleuthkit.datamodel.BlackboardAttribute;
25import org.sleuthkit.datamodel.Content;
26import org.sleuthkit.datamodel.SleuthkitCase;
27
31class ArtifactHelperBase {
32
33 private final SleuthkitCase caseDb;
34 private final Content srcContent;
35 private final String moduleName;
36 private final Long ingestJobId;
37
47 ArtifactHelperBase(SleuthkitCase caseDb, String moduleName, Content srcContent, Long ingestJobId) {
48 this.moduleName = moduleName;
49 this.srcContent = srcContent;
50 this.caseDb = caseDb;
51 this.ingestJobId = ingestJobId;
52 }
53
59 Content getContent() {
60 return srcContent;
61 }
62
68 SleuthkitCase getSleuthkitCase() {
69 return caseDb;
70 }
71
77 String getModuleName() {
78 return moduleName;
79 }
80
87 Optional<Long> getIngestJobId() {
88 return Optional.ofNullable(ingestJobId);
89 }
90
100 void addAttributeIfNotNull(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, String attrValue, Collection<BlackboardAttribute> attributes) {
101 if (!StringUtils.isEmpty(attrValue)) {
102 attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue));
103 }
104 }
105
114 void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, long attrValue, Collection<BlackboardAttribute> attributes) {
115 if (attrValue > 0) {
116 attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue));
117 }
118 }
119
129 void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, int attrValue, Collection<BlackboardAttribute> attributes) {
130 if (attrValue > 0) {
131 attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue));
132 }
133 }
134
135}

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