Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CorrelationAttributeInstanceNode.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.allcasessearch;
20 
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.List;
25 import javax.swing.Action;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Sheet;
28 import org.openide.util.NbBundle;
29 import org.openide.util.lookup.Lookups;
35 
41 
43 
45  super(Children.LEAF, Lookups.fixed(content));
46  this.instance = content;
47  this.setDisplayName(new File(this.instance.getFilePath()).getName());
48  }
49 
56  return this.instance;
57  }
58 
59  @Override
60  public Action[] getActions(boolean context){
61  List<Action> actionsList = new ArrayList<>();
62 
63  actionsList.addAll(Arrays.asList(super.getActions(true)));
64 
65  return actionsList.toArray(new Action[actionsList.size()]);
66  }
67 
68  @Override
69  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
70  return visitor.visit(this);
71  }
72 
73  @Override
74  public boolean isLeafTypeNode() {
75  return true;
76  }
77 
78  @Override
79  public String getItemType() {
80  return CorrelationAttributeInstanceNode.class.getName();
81  }
82 
83  @NbBundle.Messages({
84  "CorrelationAttributeInstanceNode.columnName.name=Name",
85  "CorrelationAttributeInstanceNode.columnName.case=Case",
86  "CorrelationAttributeInstanceNode.columnName.dataSource=Data Source",
87  "CorrelationAttributeInstanceNode.columnName.value=Value",
88  "CorrelationAttributeInstanceNode.columnName.known=Known",
89  "CorrelationAttributeInstanceNode.columnName.path=Path",
90  "CorrelationAttributeInstanceNode.columnName.comment=Comment",
91  "CorrelationAttributeInstanceNode.columnName.device=Device"
92  })
93  @Override
94  protected Sheet createSheet(){
95  Sheet sheet = new Sheet();
96  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
97 
98  if(sheetSet == null){
99  sheetSet = Sheet.createPropertiesSet();
100  sheet.put(sheetSet);
101  }
102 
103  final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance();
104 
105  final String path = centralRepoFile.getFilePath();
106  final File file = new File(path);
107  final String name = file.getName();
108  final String caseName = centralRepoFile.getCorrelationCase().getDisplayName();
109  final CorrelationDataSource dataSource = centralRepoFile.getCorrelationDataSource();
110  final String dataSourceName = dataSource.getName();
111  final String known = centralRepoFile.getKnownStatus().getName();
112  final String comment = centralRepoFile.getComment();
113  final String value = centralRepoFile.getCorrelationValue();
114  final String device = dataSource.getDeviceID();
115 
116  final String NO_DESCR = "";
117 
118  sheetSet.put(new NodeProperty<>(
119  Bundle.CorrelationAttributeInstanceNode_columnName_name(),
120  Bundle.CorrelationAttributeInstanceNode_columnName_name(), NO_DESCR, name));
121  sheetSet.put(new NodeProperty<>(
122  Bundle.CorrelationAttributeInstanceNode_columnName_case(),
123  Bundle.CorrelationAttributeInstanceNode_columnName_case(), NO_DESCR, caseName));
124  sheetSet.put(new NodeProperty<>(
125  Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(),
126  Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), NO_DESCR, dataSourceName));
127  sheetSet.put(new NodeProperty<>(
128  Bundle.CorrelationAttributeInstanceNode_columnName_value(),
129  Bundle.CorrelationAttributeInstanceNode_columnName_value(), NO_DESCR, value));
130  sheetSet.put(new NodeProperty<>(
131  Bundle.CorrelationAttributeInstanceNode_columnName_known(),
132  Bundle.CorrelationAttributeInstanceNode_columnName_known(), NO_DESCR, known));
133  sheetSet.put(new NodeProperty<>(
134  Bundle.CorrelationAttributeInstanceNode_columnName_path(),
135  Bundle.CorrelationAttributeInstanceNode_columnName_path(), NO_DESCR, path));
136  sheetSet.put(new NodeProperty<>(
137  Bundle.CorrelationAttributeInstanceNode_columnName_comment(),
138  Bundle.CorrelationAttributeInstanceNode_columnName_comment(), NO_DESCR, comment));
139  sheetSet.put(new NodeProperty<>(
140  Bundle.CorrelationAttributeInstanceNode_columnName_device(),
141  Bundle.CorrelationAttributeInstanceNode_columnName_device(), NO_DESCR, device));
142 
143  return sheet;
144  }
145 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.