18 package org.sleuthkit.autopsy.datamodel;
20 import java.beans.PropertyChangeEvent;
21 import java.beans.PropertyChangeListener;
22 import java.util.Arrays;
23 import java.util.Collections;
24 import java.util.EnumSet;
25 import java.util.List;
26 import java.util.Objects;
28 import java.util.logging.Level;
29 import java.util.stream.Collectors;
30 import org.apache.commons.collections.CollectionUtils;
31 import org.openide.nodes.ChildFactory;
32 import org.openide.nodes.Node;
33 import org.openide.util.WeakListeners;
62 .map(evt -> evt.name())
63 .collect(Collectors.toSet());
74 private final PropertyChangeListener
pcl =
new PropertyChangeListener() {
76 public void propertyChange(PropertyChangeEvent evt) {
77 String eventType = evt.getPropertyName();
78 if (EVENTS_OF_INTEREST_NAMES.contains(eventType)
85 private final PropertyChangeListener
weakPcl = WeakListeners.propertyChange(pcl, null);
115 List<Object> nodes = Collections.emptyList();
123 PersonManager personManager = tskCase.getPersonManager();
124 List<Person> persons = personManager.getPersons();
126 if (!CollectionUtils.isEmpty(persons)) {
127 nodes = persons.stream()
128 .map(PersonGrouping::new)
130 .collect(Collectors.toList());
132 if (CollectionUtils.isNotEmpty(personManager.getHostsWithoutPersons())) {
137 nodes = tskCase.getHostManager().getAllHosts().stream()
138 .map(HostGrouping::new)
140 .collect(Collectors.toList());
147 nodes = Arrays.asList(
158 logger.log(Level.SEVERE,
"Failed to create tree because there is no current case", ex);
159 }
catch (TskCoreException ex) {
160 logger.log(Level.SEVERE,
"Failed to create tree because of an error querying the case database", ex);
180 if (key instanceof SleuthkitVisitableItem) {
185 logger.log(Level.SEVERE,
"Unknown key type: ", key.getClass().getName());
final PropertyChangeListener weakPcl
final PropertyChangeListener pcl
boolean createKeys(List< Object > list)
static final Set< Case.Events > EVENTS_OF_INTEREST
SleuthkitCase getSleuthkitCase()
static Boolean getGroupItemsInTreeByDataSource()
static final Set< String > EVENTS_OF_INTEREST_NAMES
Node createNodeForKey(Object key)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static final Logger logger
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
HOSTS_REMOVED_FROM_PERSON