mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
7553 data model event changes
This commit is contained in:
parent
73b2030d83
commit
34c72cdc34
51
Core/src/org/sleuthkit/autopsy/casemodule/events/HostsDeletedEvent.java
Executable file
51
Core/src/org/sleuthkit/autopsy/casemodule/events/HostsDeletedEvent.java
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.Host;
|
||||||
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event fired when hosts are deleted.
|
||||||
|
*/
|
||||||
|
public class HostsDeletedEvent extends TskDataModelChangedEvent<Host> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main constructor.
|
||||||
|
*
|
||||||
|
* @param dataModelObjectIds The unique numeric IDs (TSK object IDs, case
|
||||||
|
* database row IDs, etc.) of the Hosts that have
|
||||||
|
* been deleted.
|
||||||
|
*/
|
||||||
|
public HostsDeletedEvent(List<Long> dataModelObjectIds) {
|
||||||
|
super(Case.Events.HOSTS_DELETED.name(), dataModelObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Host> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
41
Core/src/org/sleuthkit/autopsy/casemodule/events/HostsUpdatedEvent.java
Executable file
41
Core/src/org/sleuthkit/autopsy/casemodule/events/HostsUpdatedEvent.java
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.Host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event fired when hosts are changed.
|
||||||
|
*/
|
||||||
|
public class HostsUpdatedEvent extends HostsEvent {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main constructor.
|
||||||
|
*
|
||||||
|
* @param dataModelObjects The new values for the hosts that have been
|
||||||
|
* changed.
|
||||||
|
*/
|
||||||
|
public HostsUpdatedEvent(List<Host> dataModelObjects) {
|
||||||
|
super(Case.Events.HOSTS_CHANGED.name(), dataModelObjects);
|
||||||
|
}
|
||||||
|
}
|
40
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsAddedEvent.java
Executable file
40
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsAddedEvent.java
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.OsAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event published when OS accounts are added to a case.
|
||||||
|
*/
|
||||||
|
public final class OsAccountsAddedEvent extends OsAccountsEvent {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an event published when OS accounts are added to a case.
|
||||||
|
* @param accounts
|
||||||
|
*/
|
||||||
|
public OsAccountsAddedEvent(List<OsAccount> accounts) {
|
||||||
|
super(Case.Events.OS_ACCOUNT_ADDED.toString(), accounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
49
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsDeletedEvent.java
Executable file
49
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsDeletedEvent.java
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.OsAccount;
|
||||||
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event published when OS accounts are deleted from a case.
|
||||||
|
*/
|
||||||
|
public final class OsAccountsDeletedEvent extends TskDataModelChangedEvent<OsAccount> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an event published when OS accounts are deleted from a case.
|
||||||
|
*
|
||||||
|
* @param osAccountObjectIds The object IDs of the deleted accounts.
|
||||||
|
*/
|
||||||
|
public OsAccountsDeletedEvent(List<Long> osAccountObjectIds) {
|
||||||
|
super(Case.Events.OS_ACCOUNT_REMOVED.toString(), osAccountObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
64
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsEvent.java
Executable file
64
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsEvent.java
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import org.sleuthkit.datamodel.OsAccount;
|
||||||
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent class for specific OsAccount event classes.
|
||||||
|
*/
|
||||||
|
class OsAccountsEvent extends TskDataModelChangedEvent<OsAccount> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new OsAccountEvent.
|
||||||
|
*
|
||||||
|
* @param eventName The name of the event.
|
||||||
|
* @param account The OsAccount the event applies to.
|
||||||
|
*/
|
||||||
|
OsAccountsEvent(String eventName, List<OsAccount> accounts) {
|
||||||
|
super(eventName, accounts, OsAccount::getId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the OsAccount that changed.
|
||||||
|
*
|
||||||
|
* @return The OsAccount that was changed.
|
||||||
|
*/
|
||||||
|
public OsAccount getOsAccount() {
|
||||||
|
List<OsAccount> accounts = getNewValue();
|
||||||
|
return accounts.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
||||||
|
Long id = ids.get(0);
|
||||||
|
OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id);
|
||||||
|
List<OsAccount> accounts = new ArrayList<>();
|
||||||
|
accounts.add(account);
|
||||||
|
return accounts;
|
||||||
|
}
|
||||||
|
}
|
41
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsUpdatedEvent.java
Executable file
41
Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountsUpdatedEvent.java
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.OsAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event published when OS accounts in the case have been updated.
|
||||||
|
*/
|
||||||
|
public final class OsAccountsUpdatedEvent extends OsAccountsEvent {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an event published when OS accounts in the case have been
|
||||||
|
* updated.
|
||||||
|
*
|
||||||
|
* @param accounts The accounts.
|
||||||
|
*/
|
||||||
|
public OsAccountsUpdatedEvent(List<OsAccount> accounts) {
|
||||||
|
super(Case.Events.OS_ACCOUNT_CHANGED.toString(), accounts);
|
||||||
|
}
|
||||||
|
}
|
41
Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsUpdatedEvent.java
Executable file
41
Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsUpdatedEvent.java
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.datamodel.Person;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when persons in a case are updated.
|
||||||
|
*/
|
||||||
|
public class PersonsUpdatedEvent extends PersonsEvent {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an event fired when persons in a case are updated.
|
||||||
|
*
|
||||||
|
* @param persons The updated persons.
|
||||||
|
*/
|
||||||
|
public PersonsUpdatedEvent(List<Person> persons) {
|
||||||
|
super(Case.Events.PERSONS_CHANGED.name(), persons);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
165
Core/src/org/sleuthkit/autopsy/casemodule/events/TskDataModelChangedEvent.java
Executable file
165
Core/src/org/sleuthkit/autopsy/casemodule/events/TskDataModelChangedEvent.java
Executable file
@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.casemodule.events;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
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.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract base class for application events published when Sleuth Kit Data
|
||||||
|
* Model objects for a case are added, updated, or deleted.
|
||||||
|
*
|
||||||
|
* @param <T> A Sleuth Kit Data Model object type.
|
||||||
|
*/
|
||||||
|
public abstract class TskDataModelChangedEvent<T> extends AutopsyEvent {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final Logger logger = Logger.getLogger(TskDataModelChangedEvent.class.getName());
|
||||||
|
private final boolean isDeletionEvent;
|
||||||
|
private final List<Long> dataModelObjectIds;
|
||||||
|
private transient List<T> dataModelObjects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an instance of an abstract base class for application events
|
||||||
|
* published when Sleuth Kit Data Model objects for a case are added or
|
||||||
|
* updated. The getNewValue() method of this event will return the objects
|
||||||
|
* and the getOldValue() method will return an empty list.
|
||||||
|
*
|
||||||
|
* @param eventName The event name.
|
||||||
|
* @param dataModelObjects The Sleuth Kit Data Model objects that have been
|
||||||
|
* added or updated.
|
||||||
|
* @param getIdMethod A method that can be applied to the data model
|
||||||
|
* objects to get their unique numeric IDs (TSK
|
||||||
|
* object IDs, case database row IDs, etc.).
|
||||||
|
*/
|
||||||
|
protected TskDataModelChangedEvent(String eventName, List<T> dataModelObjects, Function<T, Long> getIdMethod) {
|
||||||
|
super(eventName, null, null);
|
||||||
|
isDeletionEvent = false;
|
||||||
|
this.dataModelObjectIds = new ArrayList<>();
|
||||||
|
this.dataModelObjectIds.addAll(dataModelObjects.stream().map(o -> getIdMethod.apply(o)).collect(Collectors.toList()));
|
||||||
|
this.dataModelObjects = new ArrayList<>();
|
||||||
|
this.dataModelObjects.addAll(dataModelObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an instance of an abstract base class for application events
|
||||||
|
* published when Sleuth Kit Data Model objects for a case are added or
|
||||||
|
* updated. The getOldValue() method of this event will return the object
|
||||||
|
* IDs and the getNewValue() method will return an empty list.
|
||||||
|
*
|
||||||
|
* @param eventName The event name.
|
||||||
|
* @param dataModelObjectIds The unique numeric IDs (TSK object IDs, case
|
||||||
|
* database row IDs, etc.) of the Sleuth Kit Data
|
||||||
|
* Model objects that have been deleted.
|
||||||
|
*/
|
||||||
|
protected TskDataModelChangedEvent(String eventName, List<Long> dataModelObjectIds) {
|
||||||
|
super(eventName, null, null);
|
||||||
|
isDeletionEvent = true;
|
||||||
|
this.dataModelObjectIds = new ArrayList<>();
|
||||||
|
this.dataModelObjectIds.addAll(dataModelObjectIds);
|
||||||
|
dataModelObjects = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the the unique numeric IDs (TSK object IDs, case database row IDs,
|
||||||
|
* etc.) of the Sleuth Kit Data Model objects that were deleted.
|
||||||
|
*
|
||||||
|
* @return The unique IDs.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Long> getOldValue() {
|
||||||
|
if (isDeletionEvent) {
|
||||||
|
return getDataModelObjectIds();
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Sleuth Kit Data Model objects that were added or updated. If
|
||||||
|
* this event came from another host collaborating on a multi-user case, the
|
||||||
|
* Sleuth Kit Data Model objects will be reconstructed on the current host.
|
||||||
|
*
|
||||||
|
* @return The objects.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<T> getNewValue() {
|
||||||
|
if (!isDeletionEvent) {
|
||||||
|
if (dataModelObjects == null) {
|
||||||
|
try {
|
||||||
|
Case currentCase = Case.getCurrentCaseThrows();
|
||||||
|
SleuthkitCase caseDb = currentCase.getSleuthkitCase();
|
||||||
|
dataModelObjects = getDataModelObjects(caseDb, dataModelObjectIds);
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, String.format("Error geting TSK Data Model objects for %s event (%s)", getPropertyName(), getSourceType()), ex);
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Collections.unmodifiableList(dataModelObjects);
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the unique numeric IDs (TSK object IDs, case database row IDs, etc.)
|
||||||
|
* of the Sleuth Kit Data Model objects associated with this application
|
||||||
|
* event.
|
||||||
|
*
|
||||||
|
* This method is provided as an optimization that allows handling of an
|
||||||
|
* event that came from another host collaborating on a multi-user case
|
||||||
|
* without reconstructing the data model objects that are the subject s of
|
||||||
|
* the event.
|
||||||
|
*
|
||||||
|
* @return The unique IDs.
|
||||||
|
*/
|
||||||
|
public final List<Long> getDataModelObjectIds() {
|
||||||
|
return Collections.unmodifiableList(dataModelObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Sleuth Kit Data Model objects associated with this application
|
||||||
|
* event. If this event came from another host collaborating on a multi-user
|
||||||
|
* case, the Sleuth Kit Data Model objects, this method will be called to
|
||||||
|
* reconstruct the objects on the current host.
|
||||||
|
*
|
||||||
|
* @param caseDb The case database.
|
||||||
|
* @param ids The unique, numeric IDs (TSK object IDs, case database row
|
||||||
|
* IDs, etc.) of the Sleuth Kit Data Model objects.
|
||||||
|
*
|
||||||
|
* @return The objects.
|
||||||
|
*
|
||||||
|
* @throws org.sleuthkit.datamodel.TskCoreException If there is an error
|
||||||
|
* getting the Sleuth Kit
|
||||||
|
* Data Model objects.
|
||||||
|
*/
|
||||||
|
abstract protected List<T> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException;
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user