mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #6834 from gdicristofaro/7459-getId
7459 getId Changes
This commit is contained in:
commit
bbe32a097c
@ -79,7 +79,7 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
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;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
final HostListItem other = (HostListItem) obj;
|
final HostListItem other = (HostListItem) obj;
|
||||||
if (!Objects.equals(
|
if (!Objects.equals(
|
||||||
this.host == null ? 0 : this.host.getId(),
|
this.host == null ? 0 : this.host.getHostId(),
|
||||||
other.host == null ? 0 : other.host.getId())) {
|
other.host == null ? 0 : other.host.getHostId())) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class HostsEvent extends TskDataModelChangeEvent<Host> {
|
|||||||
private static List<Long> getIds(List<Host> hosts) {
|
private static List<Long> getIds(List<Host> hosts) {
|
||||||
return getSafeList(hosts).stream()
|
return getSafeList(hosts).stream()
|
||||||
.filter(h -> h != null)
|
.filter(h -> h != null)
|
||||||
.map(h -> h.getId()).collect(Collectors.toList());
|
.map(h -> h.getHostId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent<OsAccount> {
|
|||||||
@Override
|
@Override
|
||||||
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
||||||
Long id = ids.get(0);
|
Long id = ids.get(0);
|
||||||
OsAccount account = caseDb.getOsAccountManager().getOsAccount(id);
|
OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id);
|
||||||
List<OsAccount> accounts = new ArrayList<>();
|
List<OsAccount> accounts = new ArrayList<>();
|
||||||
accounts.add(account);
|
accounts.add(account);
|
||||||
return accounts;
|
return accounts;
|
||||||
|
@ -42,7 +42,7 @@ public class PersonsEvent extends TskDataModelChangeEvent<Person> {
|
|||||||
private static List<Long> getIds(List<Person> persons) {
|
private static List<Long> getIds(List<Person> persons) {
|
||||||
return getSafeList(persons).stream()
|
return getSafeList(persons).stream()
|
||||||
.filter(h -> h != null)
|
.filter(h -> h != null)
|
||||||
.map(h -> h.getId()).collect(Collectors.toList());
|
.map(h -> h.getPersonId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -362,7 +362,7 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
|
|
||||||
// Add attribute lists to the hostMap
|
// Add attribute lists to the hostMap
|
||||||
for (Host host : hosts) {
|
for (Host host : hosts) {
|
||||||
List<OsAccountAttribute> atList = idMap.get(host.getId());
|
List<OsAccountAttribute> atList = idMap.get(host.getHostId());
|
||||||
if (atList != null) {
|
if (atList != null) {
|
||||||
hostMap.put(host, atList);
|
hostMap.put(host, atList);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,8 +66,8 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HostDataSources other = (HostDataSources) obj;
|
final HostDataSources other = (HostDataSources) obj;
|
||||||
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
|
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
|
||||||
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
|
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,8 +66,8 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HostGrouping other = (HostGrouping) obj;
|
final HostGrouping other = (HostGrouping) obj;
|
||||||
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
|
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
|
||||||
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
|
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class HostNode extends DisplayableItemNode {
|
|||||||
String eventType = evt.getPropertyName();
|
String eventType = evt.getPropertyName();
|
||||||
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsChangedEvent) {
|
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsChangedEvent) {
|
||||||
((HostsChangedEvent) evt).getNewValue().stream()
|
((HostsChangedEvent) evt).getNewValue().stream()
|
||||||
.filter(h -> h != null && h.getId() == hostId)
|
.filter(h -> h != null && h.getHostId() == hostId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent((newHost) -> {
|
.ifPresent((newHost) -> {
|
||||||
setName(newHost.getName());
|
setName(newHost.getName());
|
||||||
@ -242,7 +242,7 @@ public class HostNode extends DisplayableItemNode {
|
|||||||
super(children,
|
super(children,
|
||||||
host == null ? Lookups.fixed(displayName) : Lookups.fixed(host, displayName));
|
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),
|
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_CHANGED),
|
||||||
WeakListeners.propertyChange(hostChangePcl, this));
|
WeakListeners.propertyChange(hostChangePcl, this));
|
||||||
super.setName(displayName);
|
super.setName(displayName);
|
||||||
|
@ -52,7 +52,7 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.person == null ? 0 : this.person.getId());
|
return Objects.hashCode(this.person == null ? 0 : this.person.getPersonId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,8 +67,8 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PersonGrouping other = (PersonGrouping) obj;
|
final PersonGrouping other = (PersonGrouping) obj;
|
||||||
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getId();
|
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getPersonId();
|
||||||
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getId();
|
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getPersonId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
|
|||||||
String eventType = evt.getPropertyName();
|
String eventType = evt.getPropertyName();
|
||||||
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsChangedEvent) {
|
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsChangedEvent) {
|
||||||
((PersonsChangedEvent) evt).getNewValue().stream()
|
((PersonsChangedEvent) evt).getNewValue().stream()
|
||||||
.filter(p -> p != null && p.getId() == personId)
|
.filter(p -> p != null && p.getPersonId() == personId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent((newPerson) -> {
|
.ifPresent((newPerson) -> {
|
||||||
setName(newPerson.getName());
|
setName(newPerson.getName());
|
||||||
@ -191,7 +191,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
|
|||||||
super.setDisplayName(displayName);
|
super.setDisplayName(displayName);
|
||||||
this.setIconBaseWithExtension(ICON_PATH);
|
this.setIconBaseWithExtension(ICON_PATH);
|
||||||
this.person = person;
|
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),
|
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_CHANGED),
|
||||||
WeakListeners.propertyChange(personChangePcl, this));
|
WeakListeners.propertyChange(personChangePcl, this));
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 5;
|
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;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
return this.host == null && other.getHost() == null;
|
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;
|
Long selectedId = null;
|
||||||
try {
|
try {
|
||||||
Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName);
|
Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName);
|
||||||
selectedId = newHost == null ? null : newHost.getId();
|
selectedId = newHost == null ? null : newHost.getHostId();
|
||||||
} catch (NoCurrentCaseException | TskCoreException e) {
|
} catch (NoCurrentCaseException | TskCoreException e) {
|
||||||
logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host.getId() == selectedId) {
|
if (host.getHostId() == selectedId) {
|
||||||
hostList.setSelectedIndex(i);
|
hostList.setSelectedIndex(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -238,11 +238,11 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
try {
|
try {
|
||||||
Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHost(selectedHost);
|
Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHost(selectedHost);
|
||||||
} catch (NoCurrentCaseException | TskCoreException e) {
|
} 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();
|
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();
|
refresh();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ final class RAOsAccountCache {
|
|||||||
|
|
||||||
for (OsAccountAttribute attribute : attributeList) {
|
for (OsAccountAttribute attribute : attributeList) {
|
||||||
if (attribute.getHostId().isPresent()
|
if (attribute.getHostId().isPresent()
|
||||||
&& attribute.getHostId().get().equals(host.getId())
|
&& attribute.getHostId().get().equals(host.getHostId())
|
||||||
&& attribute.getAttributeType().equals(homeDir)) {
|
&& attribute.getAttributeType().equals(homeDir)) {
|
||||||
accountCache.put(attribute.getValueString(), account);
|
accountCache.put(attribute.getValueString(), account);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user