From f78e59e22d08f4fb998179c4be404af74f7e7c0a Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Mon, 29 Mar 2021 11:33:00 -0400 Subject: [PATCH 1/3] getId for Host,Person,Realm changed --- .../casemodule/AddImageWizardSelectHostVisual.java | 6 +++--- .../autopsy/casemodule/events/HostsEvent.java | 2 +- .../autopsy/casemodule/events/OsAccountEvent.java | 2 +- .../autopsy/casemodule/events/PersonsEvent.java | 2 +- .../contentviewers/osaccount/OsAccountDataPanel.java | 2 +- .../sleuthkit/autopsy/datamodel/HostDataSources.java | 6 +++--- .../sleuthkit/autopsy/datamodel/HostGrouping.java | 6 +++--- .../org/sleuthkit/autopsy/datamodel/HostNode.java | 4 ++-- .../sleuthkit/autopsy/datamodel/PersonGrouping.java | 6 +++--- .../autopsy/datamodel/PersonGroupingNode.java | 4 ++-- .../autopsy/datamodel/hosts/ManageHostsDialog.java | 12 ++++++------ .../autopsy/recentactivity/RAOsAccountCache.java | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectHostVisual.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectHostVisual.java index 9197b2fb42..4ab37d01b5 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectHostVisual.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectHostVisual.java @@ -79,7 +79,7 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel { @Override public int hashCode() { int hash = 7; - hash = 41 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getId()); + hash = 41 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getHostId()); return hash; } @@ -96,8 +96,8 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel { } final HostListItem other = (HostListItem) obj; if (!Objects.equals( - this.host == null ? 0 : this.host.getId(), - other.host == null ? 0 : other.host.getId())) { + this.host == null ? 0 : this.host.getHostId(), + other.host == null ? 0 : other.host.getHostId())) { return false; } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/HostsEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/HostsEvent.java index 1ba225f4a2..f37a159125 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/HostsEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/HostsEvent.java @@ -42,7 +42,7 @@ public class HostsEvent extends TskDataModelChangeEvent { private static List getIds(List hosts) { return getSafeList(hosts).stream() .filter(h -> h != null) - .map(h -> h.getId()).collect(Collectors.toList()); + .map(h -> h.getHostId()).collect(Collectors.toList()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java index 22b0622ba8..d34da7822d 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java @@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent { @Override protected List getDataModelObjects(SleuthkitCase caseDb, List ids) throws TskCoreException { Long id = ids.get(0); - OsAccount account = caseDb.getOsAccountManager().getOsAccount(id); + OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id); List accounts = new ArrayList<>(); accounts.add(account); return accounts; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsEvent.java index ef74585b7f..e3f584d58a 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/PersonsEvent.java @@ -42,7 +42,7 @@ public class PersonsEvent extends TskDataModelChangeEvent { private static List getIds(List persons) { return getSafeList(persons).stream() .filter(h -> h != null) - .map(h -> h.getId()).collect(Collectors.toList()); + .map(h -> h.getPersonId()).collect(Collectors.toList()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java index a1077e3e82..28d4ec3a24 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java @@ -362,7 +362,7 @@ public class OsAccountDataPanel extends JPanel { // Add attribute lists to the hostMap for (Host host : hosts) { - List atList = idMap.get(host.getId()); + List atList = idMap.get(host.getHostId()); if (atList != null) { hostMap.put(host, atList); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/HostDataSources.java b/Core/src/org/sleuthkit/autopsy/datamodel/HostDataSources.java index 37dadc840e..9451e401da 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/HostDataSources.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/HostDataSources.java @@ -51,7 +51,7 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable h != null && h.getId() == hostId) + .filter(h -> h != null && h.getHostId() == hostId) .findFirst() .ifPresent((newHost) -> { setName(newHost.getName()); @@ -242,7 +242,7 @@ public class HostNode extends DisplayableItemNode { super(children, host == null ? Lookups.fixed(displayName) : Lookups.fixed(host, displayName)); - hostId = host == null ? null : host.getId(); + hostId = host == null ? null : host.getHostId(); Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_CHANGED), WeakListeners.propertyChange(hostChangePcl, this)); super.setName(displayName); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/PersonGrouping.java b/Core/src/org/sleuthkit/autopsy/datamodel/PersonGrouping.java index d606d288f1..1e65a06271 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/PersonGrouping.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/PersonGrouping.java @@ -52,7 +52,7 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable p != null && p.getId() == personId) + .filter(p -> p != null && p.getPersonId() == personId) .findFirst() .ifPresent((newPerson) -> { setName(newPerson.getName()); @@ -191,7 +191,7 @@ public class PersonGroupingNode extends DisplayableItemNode { super.setDisplayName(displayName); this.setIconBaseWithExtension(ICON_PATH); this.person = person; - this.personId = person == null ? null : person.getId(); + this.personId = person == null ? null : person.getPersonId(); Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_CHANGED), WeakListeners.propertyChange(personChangePcl, this)); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/hosts/ManageHostsDialog.java b/Core/src/org/sleuthkit/autopsy/datamodel/hosts/ManageHostsDialog.java index 6d27cd53a1..7d4d521b51 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/hosts/ManageHostsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/hosts/ManageHostsDialog.java @@ -89,7 +89,7 @@ public class ManageHostsDialog extends javax.swing.JDialog { @Override public int hashCode() { int hash = 5; - hash = 89 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getId()); + hash = 89 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getHostId()); return hash; } @@ -109,7 +109,7 @@ public class ManageHostsDialog extends javax.swing.JDialog { return this.host == null && other.getHost() == null; } - return this.host.getId() == other.getHost().getId(); + return this.host.getHostId() == other.getHost().getHostId(); } } @@ -167,7 +167,7 @@ public class ManageHostsDialog extends javax.swing.JDialog { Long selectedId = null; try { Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName); - selectedId = newHost == null ? null : newHost.getId(); + selectedId = newHost == null ? null : newHost.getHostId(); } catch (NoCurrentCaseException | TskCoreException e) { logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), e); } @@ -215,7 +215,7 @@ public class ManageHostsDialog extends javax.swing.JDialog { continue; } - if (host.getId() == selectedId) { + if (host.getHostId() == selectedId) { hostList.setSelectedIndex(i); return; } @@ -238,11 +238,11 @@ public class ManageHostsDialog extends javax.swing.JDialog { try { Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHost(selectedHost); } catch (NoCurrentCaseException | TskCoreException e) { - logger.log(Level.WARNING, String.format("Unable to update host '%s' with id: %d at this time.", selectedHost.getName(), selectedHost.getId()), e); + logger.log(Level.WARNING, String.format("Unable to update host '%s' with id: %d at this time.", selectedHost.getName(), selectedHost.getHostId()), e); } HostListItem selectedItem = hostList.getSelectedValue(); - Long selectedId = selectedItem == null || selectedItem.getHost() == null ? null : selectedItem.getHost().getId(); + Long selectedId = selectedItem == null || selectedItem.getHost() == null ? null : selectedItem.getHost().getHostId(); refresh(); diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RAOsAccountCache.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RAOsAccountCache.java index f5208807af..8550f6d412 100755 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RAOsAccountCache.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RAOsAccountCache.java @@ -120,7 +120,7 @@ final class RAOsAccountCache { for (OsAccountAttribute attribute : attributeList) { if (attribute.getHostId().isPresent() - && attribute.getHostId().get().equals(host.getId()) + && attribute.getHostId().get().equals(host.getHostId()) && attribute.getAttributeType().equals(homeDir)) { accountCache.put(attribute.getValueString(), account); } From 2a6908486942bec8dfa00fbbf2d2fe3f6ebfda64 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Mon, 29 Mar 2021 13:04:25 -0400 Subject: [PATCH 2/3] getOsAccountbyObjectid changes --- .../org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java index d34da7822d..e08b4a406e 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java @@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent { @Override protected List getDataModelObjects(SleuthkitCase caseDb, List ids) throws TskCoreException { Long id = ids.get(0); - OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id); + OsAccount account = caseDb.getOsAccountManager().getOsAccountbyObjectid(id); List accounts = new ArrayList<>(); accounts.add(account); return accounts; From 66a8d1634b1b4f65f9d31d20ad0497e21daa3a84 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Mon, 29 Mar 2021 15:14:02 -0400 Subject: [PATCH 3/3] getOsAccountByObjectId changes --- .../org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java index e08b4a406e..d34da7822d 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/OsAccountEvent.java @@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent { @Override protected List getDataModelObjects(SleuthkitCase caseDb, List ids) throws TskCoreException { Long id = ids.get(0); - OsAccount account = caseDb.getOsAccountManager().getOsAccountbyObjectid(id); + OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id); List accounts = new ArrayList<>(); accounts.add(account); return accounts;