Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommonAttributeSearchResultRootNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2018 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.autopsy.commonpropertiessearch;
20 
21 import java.util.List;
22 import java.util.Map;
24 import org.openide.nodes.ChildFactory;
25 import org.openide.nodes.Children;
26 import org.openide.nodes.Node;
27 import org.openide.util.NbBundle;
31 
38 
40  super(Children.create(new InstanceCountNodeFactory(metadataList, type), true));
41  }
42 
44  super(Children.create(new InstanceCaseNodeFactory(metadataList), true));
45  }
46 
47  @NbBundle.Messages({
48  "CommonFilesNode.getName.text=Common Files"})
49  @Override
50  public String getName() {
51  return Bundle.CommonFilesNode_getName_text();
52  }
53 
54  @Override
55  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
56  return visitor.visit(this);
57  }
58 
59  @Override
60  public boolean isLeafTypeNode() {
61  return false;
62  }
63 
64  @Override
65  public String getItemType() {
66  return getClass().getName();
67  }
68 
72  static class InstanceCountNodeFactory extends ChildFactory<Integer> {
73 
74  private static final Logger LOGGER = Logger.getLogger(InstanceCountNodeFactory.class.getName());
75 
76  private final CommonAttributeCountSearchResults searchResults;
77  private final CorrelationAttributeInstance.Type type;
78 
86  InstanceCountNodeFactory(CommonAttributeCountSearchResults searchResults, CorrelationAttributeInstance.Type type) {
87  this.searchResults = searchResults;
88  this.type = type;
89  }
90 
91  @Override
92  protected boolean createKeys(List<Integer> list) {
93  list.addAll(this.searchResults.getMetadata().keySet());
94  return true;
95  }
96 
97  @Override
98  protected Node createNodeForKey(Integer instanceCount) {
99  CommonAttributeValueList attributeValues = this.searchResults.getAttributeValuesForInstanceCount(instanceCount);
100  return new InstanceCountNode(instanceCount, attributeValues, type);
101  }
102  }
103 
107  static class InstanceCaseNodeFactory extends ChildFactory<String> {
108 
109  private static final Logger LOGGER = Logger.getLogger(InstanceCaseNodeFactory.class.getName());
110 
111  private final CommonAttributeCaseSearchResults searchResults;
112 
120  InstanceCaseNodeFactory(CommonAttributeCaseSearchResults searchResults) {
121  this.searchResults = searchResults;
122  }
123 
124  @Override
125  protected boolean createKeys(List<String> list) {
126  list.addAll(this.searchResults.getMetadata().keySet());
127  return true;
128  }
129 
130  @Override
131  protected Node createNodeForKey(String caseName) {
132  Map<String, CommonAttributeValueList> dataSourceNameToInstances = this.searchResults.getAttributeValuesForCaseName(caseName);
133  return new InstanceCaseNode(caseName, dataSourceNameToInstances);
134  }
135  }
136 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.