Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiUserCaseNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017-2019 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.casemodule.multiusercasesbrowser;
20 
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.List;
24 import javax.swing.Action;
25 import org.openide.nodes.AbstractNode;
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;
34 
39 final class MultiUserCaseNode extends AbstractNode {
40 
41  private final CaseNodeData caseNodeData;
42  private final MultiUserCaseBrowserCustomizer customizer;
43 
52  MultiUserCaseNode(CaseNodeData caseNodeData, MultiUserCaseBrowserCustomizer customizer) {
53  super(Children.LEAF, Lookups.fixed(caseNodeData));
54  super.setName(caseNodeData.getDisplayName());
55  super.setDisplayName(caseNodeData.getDisplayName());
56  this.caseNodeData = caseNodeData;
57  this.customizer = customizer;
58  }
59 
60  @Override
61  protected Sheet createSheet() {
62  Sheet sheet = super.createSheet();
63  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
64  if (sheetSet == null) {
65  sheetSet = Sheet.createPropertiesSet();
66  sheet.put(sheetSet);
67  }
68  for (Column property : customizer.getColumns()) {
69  String propName = property.getDisplayName();
70  switch (property) {
71  case CREATE_DATE:
72  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getCreateDate()));
73  break;
74  case DIRECTORY:
75  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getDirectory().toString()));
76  break;
77  case LAST_ACCESS_DATE:
78  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getLastAccessDate()));
79  break;
80  case MANIFEST_FILE_ZNODES_DELETE_STATUS:
81  sheetSet.put(new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.MANIFEST_FILE_NODES)));
82  break;
83  case DATA_SOURCES_DELETE_STATUS:
84  sheetSet.put(new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.DATA_SOURCES)));
85  break;
86  case TEXT_INDEX_DELETE_STATUS:
87  sheetSet.put(new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.TEXT_INDEX)));
88  break;
89  case CASE_DB_DELETE_STATUS:
90  sheetSet.put(new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.CASE_DB)));
91  break;
92  case CASE_DIR_DELETE_STATUS:
93  sheetSet.put(new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.CASE_DIR)));
94  break;
95  default:
96  break;
97  }
98  }
99  return sheet;
100  }
101 
102  @Override
103  public Action[] getActions(boolean context) {
104  List<Action> actions = new ArrayList<>();
105  actions.addAll(customizer.getActions(caseNodeData));
106  actions.addAll(Arrays.asList(super.getActions(context)));
107  return actions.toArray(new Action[actions.size()]);
108  }
109 
110  @Override
111  public Action getPreferredAction() {
112  return customizer.getPreferredAction(caseNodeData);
113  }
114 
123  @NbBundle.Messages({
124  "MultiUserCaseNode.columnValue.true=True",
125  "MultiUserCaseNode.column.createTime=False",
126  })
127  private String isDeleted(CaseNodeData.DeletedFlags flag) {
128  return caseNodeData.isDeletedFlagSet(flag) ? "True" : "False";
129  }
130 
131 }

Copyright © 2012-2022 Basis Technology. Generated on: Wed Oct 5 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.