Autopsy  4.8.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommonAttributeValue.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2018 Basis Technology Corp.
6  * Contact: carrier <at> sleuthkit <dot> org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.sleuthkit.autopsy.commonfilesearch;
21 
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.Collections;
25 import java.util.HashSet;
26 import java.util.List;
27 import java.util.Set;
28 import java.util.stream.Collectors;
29 
34 final public class CommonAttributeValue {
35 
36  private final String md5;
37  private final List<AbstractCommonAttributeInstance> fileInstances;
38 
39  CommonAttributeValue(String md5, List<AbstractCommonAttributeInstance> fileInstances) {
40  this.md5 = md5;
41  this.fileInstances = fileInstances;
42 
43  }
44 
45  CommonAttributeValue(String md5) {
46  this.md5 = md5;
47  this.fileInstances = new ArrayList<>();
48  }
49 
50  public String getValue() {
51  return this.md5;
52  }
53 
59  public String getCases() {
60  return this.fileInstances.stream().map(AbstractCommonAttributeInstance::getCaseName).collect(Collectors.joining(", "));
61  }
62 
63  public String getDataSources() {
64  Set<String> sources = new HashSet<>();
65  for (AbstractCommonAttributeInstance data : this.fileInstances) {
66  sources.add(data.getDataSource());
67  }
68 
69  return String.join(", ", sources);
70  }
71 
72  void addInstance(AbstractCommonAttributeInstance metadata) {
73  this.fileInstances.add(metadata);
74  }
75 
76  public Collection<AbstractCommonAttributeInstance> getInstances() {
77  return Collections.unmodifiableCollection(this.fileInstances);
78  }
79 
86  public int getInstanceCount() {
87  return this.fileInstances.size();
88  }
89 }
final List< AbstractCommonAttributeInstance > fileInstances
Collection< AbstractCommonAttributeInstance > getInstances()

Copyright © 2012-2018 Basis Technology. Generated on: Thu Oct 4 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.