19 package org.sleuthkit.autopsy.casemodule.multiusercasesbrowser;
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;
39 final class MultiUserCaseNode
extends AbstractNode {
41 private final CaseNodeData caseNodeData;
42 private final MultiUserCaseBrowserCustomizer customizer;
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;
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();
68 for (Column property : customizer.getColumns()) {
69 String propName =
property.getDisplayName();
72 sheetSet.put(
new NodeProperty<>(propName, propName, propName, caseNodeData.getCreateDate()));
75 sheetSet.put(
new NodeProperty<>(propName, propName, propName, caseNodeData.getDirectory().toString()));
77 case LAST_ACCESS_DATE:
78 sheetSet.put(
new NodeProperty<>(propName, propName, propName, caseNodeData.getLastAccessDate()));
80 case MANIFEST_FILE_ZNODES_DELETE_STATUS:
81 sheetSet.put(
new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.MANIFEST_FILE_NODES)));
83 case DATA_SOURCES_DELETE_STATUS:
84 sheetSet.put(
new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.DATA_SOURCES)));
86 case TEXT_INDEX_DELETE_STATUS:
87 sheetSet.put(
new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.TEXT_INDEX)));
89 case CASE_DB_DELETE_STATUS:
90 sheetSet.put(
new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.CASE_DB)));
92 case CASE_DIR_DELETE_STATUS:
93 sheetSet.put(
new NodeProperty<>(propName, propName, propName, isDeleted(DeletedFlags.CASE_DIR)));
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()]);
111 public Action getPreferredAction() {
112 return customizer.getPreferredAction(caseNodeData);
124 "MultiUserCaseNode.columnValue.true=True",
125 "MultiUserCaseNode.column.createTime=False",
127 private String isDeleted(CaseNodeData.DeletedFlags flag) {
128 return caseNodeData.isDeletedFlagSet(flag) ?
"True" :
"False";