19 package org.sleuthkit.datamodel;
21 import java.util.Collections;
22 import java.util.List;
23 import java.util.Optional;
24 import java.util.ResourceBundle;
37 private static final ResourceBundle bundle = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle");
39 final static Long NO_ACCOUNT = null;
40 final static String NO_OWNER_ID = null;
44 private final long osAccountObjId;
45 private final long realmId;
46 private final String loginName;
47 private final String addr;
49 private final String signature;
54 private final String fullName;
57 private final OsAccountDbStatus osAccountDbStatus;
58 private final Long creationTime;
60 private List<OsAccountAttribute> osAccountAttributes = null;
67 UNKNOWN(0, bundle.getString(
"OsAccountStatus.Unknown.text")),
68 ACTIVE(1, bundle.getString(
"OsAccountStatus.Active.text")),
69 DISABLED(2, bundle.getString(
"OsAccountStatus.Disabled.text")),
71 DELETED(3, bundle.getString(
"OsAccountStatus.Deleted.text")),
72 NON_EXISTENT(4, bundle.getString(
"OsAccountStatus.NonExistent.text"));
75 private final String name;
109 if (statusType.ordinal() == statusId) {
122 enum OsAccountDbStatus {
125 DELETED(2,
"Deleted");
127 private final int id;
128 private final String name;
130 OsAccountDbStatus(
int id, String name) {
143 static OsAccountDbStatus fromID(
int typeId) {
144 for (OsAccountDbStatus type : OsAccountDbStatus.values()) {
145 if (type.ordinal() == typeId) {
158 UNKNOWN(0, bundle.getString(
"OsAccountType.Unknown.text")),
159 SERVICE(1, bundle.getString(
"OsAccountType.Service.text")),
160 INTERACTIVE(2, bundle.getString(
"OsAccountType.Interactive.text"));
162 private final int id;
163 private final String name;
197 if (accountType.ordinal() == typeId) {
224 OsAccount(
SleuthkitCase sleuthkitCase,
long osAccountobjId,
long realmId, String loginName, String uniqueId, String signature,
227 super(sleuthkitCase, osAccountobjId, signature);
229 this.sleuthkitCase = sleuthkitCase;
230 this.osAccountObjId = osAccountobjId;
231 this.realmId = realmId;
232 this.loginName = loginName;
233 this.addr = uniqueId;
234 this.signature = signature;
235 this.fullName = fullName;
236 this.creationTime = creationTime;
237 this.osAccountType = accountType;
238 this.osAccountStatus = accountStatus;
239 this.osAccountDbStatus = accountDbStatus;
248 synchronized void setAttributesInternal(List<OsAccountAttribute> osAccountAttributes) {
249 this.osAccountAttributes = osAccountAttributes;
259 return osAccountObjId;
269 return Optional.ofNullable(addr);
289 return Optional.ofNullable(loginName);
297 String getSignature() {
307 return Optional.ofNullable(fullName);
316 return Optional.ofNullable(creationTime);
325 return Optional.ofNullable(osAccountType);
334 return Optional.ofNullable(osAccountStatus);
343 return osAccountDbStatus;
354 if (osAccountAttributes == null) {
357 return Collections.unmodifiableList(osAccountAttributes);
378 return sleuthkitCase;
401 throw new UnsupportedOperationException(
"Not supported yet.");
405 public <T> T accept(SleuthkitItemVisitor<T> v) {
406 return v.visit(
this);
419 private final long osAccountObjId;
420 private final Long hostId;
421 private final Long sourceObjId;
436 super(attributeType, valueInt);
438 this.osAccountObjId = osAccount.
getId();
439 this.hostId = (host != null ? host.
getHostId() : null);
440 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
454 super(attributeType, valueLong);
456 this.osAccountObjId = osAccount.
getId();
457 this.hostId = (host != null ? host.
getHostId() : null);
458 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
472 super(attributeType, valueDouble);
474 this.osAccountObjId = osAccount.
getId();
475 this.hostId = (host != null ? host.
getHostId() : null);
476 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
490 super(attributeType, valueString);
492 this.osAccountObjId = osAccount.
getId();
493 this.hostId = (host != null ? host.
getHostId() : null);
494 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
508 super(attributeType, valueBytes);
510 this.osAccountObjId = osAccount.
getId();
511 this.hostId = (host != null ? host.
getHostId() : null);
512 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
535 valueInt, valueLong, valueDouble, valueString, valueBytes,
537 this.osAccountObjId = osAccount.
getId();
538 this.hostId = (host != null ? host.
getHostId() : null);
539 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
548 return Optional.ofNullable(hostId);
557 return osAccountObjId;
566 return Optional.ofNullable(sourceObjId);
Optional< Long > getSourceObjectId()
Optional< String > getAddr()
OsAccountAttribute(BlackboardAttribute.Type attributeType, byte[] valueBytes, OsAccount osAccount, Host host, Content sourceObj)
OsAccountType(int id, String name)
static OsAccountType fromID(int typeId)
Optional< OsAccountType > getOsAccountType()
OsAccountAttribute(BlackboardAttribute.Type attributeType, String valueString, OsAccount osAccount, Host host, Content sourceObj)
OsAccountDbStatus getOsAccountDbStatus()
synchronized List< OsAccountInstance > getOsAccountInstances()
Optional< OsAccountStatus > getOsAccountStatus()
OsAccountAttribute(BlackboardAttribute.Type attributeType, long valueLong, OsAccount osAccount, Host host, Content sourceObj)
long getOsAccountObjectId()
OsAccountAttribute(BlackboardAttribute.Type attributeType, int valueInt, OsAccount osAccount, Host host, Content sourceObj)
Optional< Long > getCreationTime()
List< OsAccountInstance > getOsAccountInstances(OsAccount account)
SleuthkitCase getSleuthkitCase()
Optional< Long > getHostId()
Optional< String > getLoginName()
OsAccountManager getOsAccountManager()
static OsAccountStatus fromID(int statusId)
OsAccountStatus(int id, String name)
OsAccountAttribute(BlackboardAttribute.Type attributeType, double valueDouble, OsAccount osAccount, Host host, Content sourceObj)
Optional< String > getFullName()
int read(byte[] buf, long offset, long len)
synchronized List< OsAccountAttribute > getExtendedOsAccountAttributes()