Autopsy  4.17.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.known=Known",
88  "CorrelationAttributeInstanceNode.columnName.path=Path",
89  "CorrelationAttributeInstanceNode.columnName.comment=Comment",
90  "CorrelationAttributeInstanceNode.columnName.device=Device"
91  })
92  @Override
93  protected Sheet createSheet(){
94  Sheet sheet = new Sheet();
95  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
96 
97  if(sheetSet == null){
98  sheetSet = Sheet.createPropertiesSet();
99  sheet.put(sheetSet);
100  }
101 
102  final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance();
103 
104  final String path = centralRepoFile.getFilePath();
105  final File file = new File(path);
106  final String name = file.getName();
107  final String caseName = centralRepoFile.getCorrelationCase().getDisplayName();
108  final CorrelationDataSource dataSource = centralRepoFile.getCorrelationDataSource();
109  final String dataSourceName = dataSource.getName();
110  final String known = centralRepoFile.getKnownStatus().getName();
111  final String comment = centralRepoFile.getComment();
112  final String device = dataSource.getDeviceID();
113 
114  final String NO_DESCR = "";
115 
116  sheetSet.put(new NodeProperty<>(
117  Bundle.CorrelationAttributeInstanceNode_columnName_name(),
118  Bundle.CorrelationAttributeInstanceNode_columnName_name(), NO_DESCR, name));
119  sheetSet.put(new NodeProperty<>(
120  Bundle.CorrelationAttributeInstanceNode_columnName_case(),
121  Bundle.CorrelationAttributeInstanceNode_columnName_case(), NO_DESCR, caseName));
122  sheetSet.put(new NodeProperty<>(
123  Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(),
124  Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), NO_DESCR, dataSourceName));
125  sheetSet.put(new NodeProperty<>(
126  Bundle.CorrelationAttributeInstanceNode_columnName_known(),
127  Bundle.CorrelationAttributeInstanceNode_columnName_known(), NO_DESCR, known));
128  sheetSet.put(new NodeProperty<>(
129  Bundle.CorrelationAttributeInstanceNode_columnName_path(),
130  Bundle.CorrelationAttributeInstanceNode_columnName_path(), NO_DESCR, path));
131  sheetSet.put(new NodeProperty<>(
132  Bundle.CorrelationAttributeInstanceNode_columnName_comment(),
133  Bundle.CorrelationAttributeInstanceNode_columnName_comment(), NO_DESCR, comment));
134  sheetSet.put(new NodeProperty<>(
135  Bundle.CorrelationAttributeInstanceNode_columnName_device(),
136  Bundle.CorrelationAttributeInstanceNode_columnName_device(), NO_DESCR, device));
137 
138  return sheet;
139  }
140 }

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