19 package org.sleuthkit.autopsy.casemodule.events;
 
   21 import java.util.ArrayList;
 
   22 import java.util.Collections;
 
   23 import java.util.List;
 
   24 import java.util.function.Function;
 
   25 import java.util.logging.Level;
 
   26 import java.util.stream.Collectors;
 
   91     protected TskDataModelChangedEvent(String eventName, List<T> oldValueObjects, Function<T, Long> oldValueGetIdMethod, List<U> newValueObjects, Function<U, Long> newValueGetIdMethod) {
 
   92         super(eventName, null, null);
 
   93         oldValueIds = 
new ArrayList<>();
 
   94         this.oldValueObjects = 
new ArrayList<>();
 
   95         if (oldValueObjects != null) {
 
   97             oldValueIds.addAll(oldValueObjects.stream()
 
   98                     .map(o -> oldValueGetIdMethod.apply(o))
 
   99                     .collect(Collectors.toList()));
 
  100             this.oldValueObjects.addAll(oldValueObjects);
 
  104         newValueIds = 
new ArrayList<>();
 
  105         this.newValueObjects = 
new ArrayList<>();
 
  106         if (newValueObjects != null) {
 
  108             newValueIds.addAll(newValueObjects.stream()
 
  109                     .map(o -> newValueGetIdMethod.apply(o))
 
  110                     .collect(Collectors.toList()));
 
  111             this.newValueObjects.addAll(newValueObjects);
 
  126             if (oldValueObjects == null) {
 
  132                     logger.log(Level.SEVERE, String.format(
"Error getting oldValue() TSK Data Model objects for %s event (%s)", getPropertyName(), 
getSourceType()), ex);
 
  133                     return Collections.emptyList();
 
  136             return Collections.unmodifiableList(oldValueObjects);
 
  138             return Collections.emptyList();
 
  151             if (newValueObjects == null) {
 
  157                     logger.log(Level.SEVERE, String.format(
"Error getting newValue() TSK Data Model objects for %s event (%s)", getPropertyName(), 
getSourceType()), ex);
 
  158                     return Collections.emptyList();
 
  161             return Collections.unmodifiableList(newValueObjects);
 
  163             return Collections.emptyList();
 
  183         return Collections.emptyList();
 
  202         return Collections.emptyList();
 
List< T > getOldValueObjects(SleuthkitCase caseDb, List< Long > ids)
List< U > getNewValueObjects(SleuthkitCase caseDb, List< Long > ids)
transient List< T > oldValueObjects
final boolean hasOldValue
TskDataModelChangedEvent(String eventName, List< T > oldValueObjects, Function< T, Long > oldValueGetIdMethod, List< U > newValueObjects, Function< U, Long > newValueGetIdMethod)
static final Logger logger
static final long serialVersionUID
transient List< U > newValueObjects
SleuthkitCase getSleuthkitCase()
final boolean hasNewValue
SourceType getSourceType()
final List< Long > oldValueIds
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
final List< Long > newValueIds