Autopsy  4.8.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.commonfilesearch;
20 
21 import java.util.List;
22 import java.util.logging.Level;
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;
31 
39 
41  super(Children.create(new InstanceCountNodeFactory(metadataList), true));
42  }
43 
44  @NbBundle.Messages({
45  "CommonFilesNode.getName.text=Common Files"})
46  @Override
47  public String getName() {
48  return Bundle.CommonFilesNode_getName_text();
49  }
50 
51  @Override
52  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
53  return visitor.visit(this);
54  }
55 
56  @Override
57  public boolean isLeafTypeNode() {
58  return false;
59  }
60 
61  @Override
62  public String getItemType() {
63  return getClass().getName();
64  }
65 
69  static class InstanceCountNodeFactory extends ChildFactory<Integer>{
70 
71  private static final Logger LOGGER = Logger.getLogger(InstanceCountNodeFactory.class.getName());
72 
73  private final CommonAttributeSearchResults searchResults;
74 
80  InstanceCountNodeFactory(CommonAttributeSearchResults searchResults){
81  this.searchResults = searchResults;
82  }
83 
84  @Override
85  protected boolean createKeys(List<Integer> list) {
86  try {
87  list.addAll(this.searchResults.getMetadata().keySet());
88  } catch (EamDbException ex) {
89  LOGGER.log(Level.SEVERE, "Unable to create keys.", ex);
90  }
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 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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.