Autopsy  4.9.1
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.commonfilesearch;
20 
21 import java.util.List;
22 import java.util.Map;
23 import java.util.logging.Logger;
24 import org.openide.nodes.ChildFactory;
25 import org.openide.nodes.Children;
26 import org.openide.nodes.Node;
27 import org.openide.util.NbBundle;
30 
37 
39  super(Children.create(new InstanceCountNodeFactory(metadataList), true));
40  }
41 
43  super(Children.create(new InstanceCaseNodeFactory(metadataList), true));
44  }
45 
46  @NbBundle.Messages({
47  "CommonFilesNode.getName.text=Common Files"})
48  @Override
49  public String getName() {
50  return Bundle.CommonFilesNode_getName_text();
51  }
52 
53  @Override
54  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
55  return visitor.visit(this);
56  }
57 
58  @Override
59  public boolean isLeafTypeNode() {
60  return false;
61  }
62 
63  @Override
64  public String getItemType() {
65  return getClass().getName();
66  }
67 
71  static class InstanceCountNodeFactory extends ChildFactory<Integer> {
72 
73  private static final Logger LOGGER = Logger.getLogger(InstanceCountNodeFactory.class.getName());
74 
75  private final CommonAttributeCountSearchResults searchResults;
76 
84  InstanceCountNodeFactory(CommonAttributeCountSearchResults searchResults) {
85  this.searchResults = searchResults;
86  }
87 
88  @Override
89  protected boolean createKeys(List<Integer> list) {
90  list.addAll(this.searchResults.getMetadata().keySet());
91  return true;
92  }
93 
94  @Override
95  protected Node createNodeForKey(Integer instanceCount) {
96  CommonAttributeValueList attributeValues = this.searchResults.getAttributeValuesForInstanceCount(instanceCount);
97  return new InstanceCountNode(instanceCount, attributeValues);
98  }
99  }
100 
104  static class InstanceCaseNodeFactory extends ChildFactory<String> {
105 
106  private static final Logger LOGGER = Logger.getLogger(InstanceCaseNodeFactory.class.getName());
107 
108  private final CommonAttributeCaseSearchResults searchResults;
109 
117  InstanceCaseNodeFactory(CommonAttributeCaseSearchResults searchResults) {
118  this.searchResults = searchResults;
119  }
120 
121  @Override
122  protected boolean createKeys(List<String> list) {
123  list.addAll(this.searchResults.getMetadata().keySet());
124  return true;
125  }
126 
127  @Override
128  protected Node createNodeForKey(String caseName) {
129  Map<String, CommonAttributeValueList> dataSourceNameToInstances = this.searchResults.getAttributeValuesForCaseName(caseName);
130  return new InstanceCaseNode(caseName, dataSourceNameToInstances);
131  }
132  }
133 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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