mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Merge remote-tracking branch 'upstream/timeline-event-mgr' into 1091-update-filters
# Conflicts: # Core/src/org/sleuthkit/autopsy/timeline/events/EventAddedEvent.java
This commit is contained in:
commit
aedd2bd526
@ -18,22 +18,76 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.timeline.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.timeline.TimelineEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* An AutopsyEvent broadcast when a TimelineEvent is added to the case.
|
||||
*/
|
||||
public class EventAddedEvent extends AutopsyEvent {
|
||||
public class EventAddedEvent extends AutopsyEvent implements Serializable {
|
||||
|
||||
private final long addedEventID;
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = Logger.getLogger(EventAddedEvent.class.getName());
|
||||
|
||||
public long getAddedEventID() {
|
||||
return addedEventID;
|
||||
}
|
||||
private transient TimelineEvent addedEvent;
|
||||
|
||||
public EventAddedEvent(org.sleuthkit.datamodel.TimelineManager.EventAddedEvent event) {
|
||||
super(Case.Events.EVENT_ADDED.name(), null, event.getEvent());
|
||||
addedEventID = event.getEvent().getEventID();
|
||||
super(Case.Events.EVENT_ADDED.name(), null, event.getAddedEvent().getEventID());
|
||||
addedEvent = event.getAddedEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the TimelineEvent that was added.
|
||||
*
|
||||
* @return The TimelineEvent or null if there is an error retrieving the
|
||||
* TimelineEvent.
|
||||
*/
|
||||
@Override
|
||||
public TimelineEvent getNewValue() {
|
||||
/**
|
||||
* The addedEvent field is set in the constructor, but it is transient
|
||||
* so it will become null when the event is serialized for publication
|
||||
* over a network. Doing a lazy load of the TimelineEvent object
|
||||
* bypasses the issues related to the serialization and de-serialization
|
||||
* of TimelineEvent objects and may also save database round trips from
|
||||
* other nodes since subscribers to this event are often not interested
|
||||
* in the event data.
|
||||
*/
|
||||
if (null != addedEvent) {
|
||||
return addedEvent;
|
||||
}
|
||||
try {
|
||||
Long addedEventID = (Long) super.getNewValue();
|
||||
addedEvent = Case.getCurrentCaseThrows().getSleuthkitCase().getTimelineManager().getEventById(addedEventID);
|
||||
return addedEvent;
|
||||
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the TimelineEvent that was added.
|
||||
*
|
||||
* @return The TimelineEvent or null if there is an error retrieving the
|
||||
* TimelineEvent.
|
||||
*/
|
||||
public TimelineEvent getAddedEvent() {
|
||||
return getNewValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Id of the event that was added.
|
||||
*
|
||||
* @return The Id of the event that was added.
|
||||
*/
|
||||
public long getAddedEventID() {
|
||||
return (long) super.getNewValue();
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,10 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.timeline.utils;
|
||||
|
||||
import com.google.common.net.MediaType;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.datamodel.TimelineManager;
|
||||
import org.sleuthkit.datamodel.timeline.TimelineFilter.FileTypeFilter;
|
||||
@ -34,16 +32,16 @@ import org.sleuthkit.datamodel.timeline.TimelineFilter.FileTypesFilter;
|
||||
*/
|
||||
public final class FilterUtils {
|
||||
|
||||
private static final Set<MediaType> MEDIA_MIME_TYPES = Stream.of(
|
||||
private static final Set<String> MEDIA_MIME_TYPES = ImmutableSet.of(
|
||||
"image/*",//NON-NLS
|
||||
"video/*",//NON-NLS
|
||||
"audio/*",//NON-NLS
|
||||
"application/vnd.ms-asf", //NON-NLS
|
||||
"application/vnd.rn-realmedia", //NON-NLS
|
||||
"application/x-shockwave-flash" //NON-NLS
|
||||
).map(MediaType::parse).collect(Collectors.toSet());
|
||||
);
|
||||
|
||||
private static final Set<MediaType> EXECUTABLE_MIME_TYPES = Stream.of(
|
||||
private static final Set<String> EXECUTABLE_MIME_TYPES = ImmutableSet.of(
|
||||
"application/x-bat",//NON-NLS
|
||||
"application/x-dosexec",//NON-NLS
|
||||
"application/vnd.microsoft.portable-executable",//NON-NLS
|
||||
@ -55,9 +53,9 @@ public final class FilterUtils {
|
||||
"application/x-winexe",//NON-NLS
|
||||
"application/msdos-windows",//NON-NLS
|
||||
"application/x-msdos-program"//NON-NLS
|
||||
).map(MediaType::parse).collect(Collectors.toSet());
|
||||
);
|
||||
|
||||
private static final Set<MediaType> DOCUMENT_MIME_TYPES = Stream.of(
|
||||
private static final Set<String> DOCUMENT_MIME_TYPES =ImmutableSet.of(
|
||||
"text/*", //NON-NLS
|
||||
"application/rtf", //NON-NLS
|
||||
"application/pdf", //NON-NLS
|
||||
@ -75,9 +73,9 @@ public final class FilterUtils {
|
||||
"application/vnd.oasis.opendocument.presentation", //NON-NLS
|
||||
"application/vnd.oasis.opendocument.spreadsheet", //NON-NLS
|
||||
"application/vnd.oasis.opendocument.text" //NON-NLS
|
||||
).map(MediaType::parse).collect(Collectors.toSet());
|
||||
);
|
||||
|
||||
private static final Set<MediaType> NON_OTHER_MIME_TYPES = new HashSet<>();
|
||||
private static final Set<String> NON_OTHER_MIME_TYPES = new HashSet<>();
|
||||
|
||||
static {
|
||||
NON_OTHER_MIME_TYPES.addAll(MEDIA_MIME_TYPES);
|
||||
@ -116,7 +114,7 @@ public final class FilterUtils {
|
||||
*/
|
||||
private static class InverseFileTypeFilter extends FileTypeFilter {
|
||||
|
||||
InverseFileTypeFilter(String displayName, Collection<MediaType> mediaTypes) {
|
||||
InverseFileTypeFilter(String displayName, Collection<String> mediaTypes) {
|
||||
super(displayName, mediaTypes);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user