Merge pull request #6834 from gdicristofaro/7459-getId

7459 getId Changes
This commit is contained in:
Ann Priestman 2021-03-30 08:50:00 -04:00 committed by GitHub
commit bbe32a097c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 27 deletions

View File

@ -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;
}

View File

@ -42,7 +42,7 @@ public class HostsEvent extends TskDataModelChangeEvent<Host> {
private static List<Long> getIds(List<Host> hosts) {
return getSafeList(hosts).stream()
.filter(h -> h != null)
.map(h -> h.getId()).collect(Collectors.toList());
.map(h -> h.getHostId()).collect(Collectors.toList());
}
/**

View File

@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent<OsAccount> {
@Override
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
Long id = ids.get(0);
OsAccount account = caseDb.getOsAccountManager().getOsAccount(id);
OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id);
List<OsAccount> accounts = new ArrayList<>();
accounts.add(account);
return accounts;

View File

@ -42,7 +42,7 @@ public class PersonsEvent extends TskDataModelChangeEvent<Person> {
private static List<Long> getIds(List<Person> persons) {
return getSafeList(persons).stream()
.filter(h -> h != null)
.map(h -> h.getId()).collect(Collectors.toList());
.map(h -> h.getPersonId()).collect(Collectors.toList());
}
/**

View File

@ -362,7 +362,7 @@ public class OsAccountDataPanel extends JPanel {
// Add attribute lists to the hostMap
for (Host host : hosts) {
List<OsAccountAttribute> atList = idMap.get(host.getId());
List<OsAccountAttribute> atList = idMap.get(host.getHostId());
if (atList != null) {
hostMap.put(host, atList);
}

View File

@ -51,7 +51,7 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
@Override
public int hashCode() {
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
}
@Override
@ -66,8 +66,8 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
return false;
}
final HostDataSources other = (HostDataSources) obj;
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
return thisId == otherId;
}

View File

@ -51,7 +51,7 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
@Override
public int hashCode() {
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
}
@Override
@ -66,8 +66,8 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
return false;
}
final HostGrouping other = (HostGrouping) obj;
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
return thisId == otherId;
}

View File

@ -176,7 +176,7 @@ public class HostNode extends DisplayableItemNode {
String eventType = evt.getPropertyName();
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsChangedEvent) {
((HostsChangedEvent) evt).getNewValue().stream()
.filter(h -> 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);

View File

@ -52,7 +52,7 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
@Override
public int hashCode() {
return Objects.hashCode(this.person == null ? 0 : this.person.getId());
return Objects.hashCode(this.person == null ? 0 : this.person.getPersonId());
}
@Override
@ -67,8 +67,8 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
return false;
}
final PersonGrouping other = (PersonGrouping) obj;
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getId();
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getId();
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getPersonId();
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getPersonId();
return thisId == otherId;
}

View File

@ -147,7 +147,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
String eventType = evt.getPropertyName();
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsChangedEvent) {
((PersonsChangedEvent) evt).getNewValue().stream()
.filter(p -> 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));
}

View File

@ -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();

View File

@ -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);
}