Autopsy 4.22.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 */
19package org.sleuthkit.autopsy.commonpropertiessearch;
20
21import java.util.List;
22import java.util.Map;
23import org.sleuthkit.autopsy.coreutils.Logger;
24import org.openide.nodes.ChildFactory;
25import org.openide.nodes.Children;
26import org.openide.nodes.Node;
27import org.openide.util.NbBundle;
28import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
29import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
30import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor;
31
37final public class CommonAttributeSearchResultRootNode extends DisplayableItemNode {
38
39 CommonAttributeSearchResultRootNode(CommonAttributeCountSearchResults metadataList, CorrelationAttributeInstance.Type type) {
40 super(Children.create(new InstanceCountNodeFactory(metadataList, type), true));
41 }
42
43 CommonAttributeSearchResultRootNode(CommonAttributeCaseSearchResults metadataList) {
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-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.