29public class OsAccountInstance
implements Comparable<OsAccountInstance> {
31 private static final ResourceBundle bundle = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle");
34 private final long instanceId;
35 private final long accountId;
36 private final long dataSourceId;
55 this(skCase, instanceId, account.getId(), dataSourceId, instanceType);
56 this.account = account;
72 this.instanceId = instanceId;
73 this.accountId = accountObjId;
74 this.dataSourceId = dataSourceObjId;
75 this.instanceType = instanceType;
96 if (account ==
null) {
98 account = skCase.getOsAccountManager().getOsAccountByObjectId(accountId);
100 throw new TskCoreException(String.format(
"Failed to get OsAccount for id %d", accountId), ex);
115 if (dataSource ==
null) {
117 dataSource = skCase.getDataSource(dataSourceId);
119 throw new TskCoreException(String.format(
"Failed to get DataSource for id %d", dataSourceId), ex);
140 private long getDataSourceId() {
150 if (dataSourceId != other.getDataSourceId()) {
151 return Long.compare(dataSourceId, other.getDataSourceId());
154 return Long.compare(accountId, other.accountId);
165 if (getClass() != obj.getClass()) {
168 final OsAccountInstance other = (OsAccountInstance) obj;
170 if(this.instanceId != other.instanceId) {
174 if (this.accountId != other.accountId) {
178 if(this.instanceType != other.instanceType) {
182 return this.dataSourceId == other.getDataSourceId();
188 hash = 67 * hash + Objects.hashCode(this.instanceId);
189 hash = 67 * hash + Objects.hashCode(this.dataSourceId);
190 hash = 67 * hash + Objects.hashCode(this.accountId);
191 hash = 67 * hash + Objects.hashCode(this.instanceType);
202 LAUNCHED(0, bundle.getString(
"OsAccountInstanceType.Launched.text"), bundle.getString(
"OsAccountInstanceType.Launched.descr.text")),
203 ACCESSED(1, bundle.getString(
"OsAccountInstanceType.Accessed.text"), bundle.getString(
"OsAccountInstanceType.Accessed.descr.text")),
204 REFERENCED(2, bundle.getString(
"OsAccountInstanceType.Referenced.text"), bundle.getString(
"OsAccountInstanceType.Referenced.descr.text"));
207 private final int id;
208 private final String name;
209 private final String description;
214 this.description = description;
253 if (statusType.ordinal() == typeId) {
268 return Arrays.stream(values())
269 .filter(val -> val.getName().equals(name))
270 .findFirst().orElse(
null);