diff --git a/bindings/java/doxygen/blackboard.dox b/bindings/java/doxygen/blackboard.dox index 7c4288e91bf8495f96a96e76e466da2862542fe5..fc51e88b9699fcfbdcc4d6603340602e1f134876 100644 --- a/bindings/java/doxygen/blackboard.dox +++ b/bindings/java/doxygen/blackboard.dox @@ -36,9 +36,9 @@ Consult the \ref artifact_catalog_page "artifact catalog" for a list of built-in There are may ways to create artifacts, but we will focus on creating them through the Blackboard class or directly through a Content object. Regardless of how they are created, all artifacts must be associated with a Content object. <ul> -<li>org.sleuthkit.datamodel.AbstractContent.newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) +<li>org.sleuthkit.datamodel.AbstractContent.newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) <li>org.sleuthkit.datamodel.AbstractContent.newAnalysisResult(BlackboardArtifact.Type artifactType, Score score, String conclusion, String configuration, String justification, Collection<BlackboardAttribute> attributesList) -<li>org.sleuthkit.datamodel.Blackboard.newDataArtifact(BlackboardArtifact.Type artifactType, long sourceObjId, Long dataSourceObjId, Collection<BlackboardAttribute> attributes, OsAccount osAccount) +<li>org.sleuthkit.datamodel.Blackboard.newDataArtifact(BlackboardArtifact.Type artifactType, long sourceObjId, Long dataSourceObjId, Collection<BlackboardAttribute> attributes, Long osAccountId) <li>org.sleuthkit.datamodel.Blackboard.newAnalysisResult(BlackboardArtifact.Type artifactType, long objId, Long dataSourceObjId, Score score, String conclusion, String configuration, String justification, Collection<BlackboardAttribute> attributesList, CaseDbTransaction transaction) </ul> diff --git a/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java b/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java index c37a5463a5e17605367f89457dc3b661d714a4e4..fba4638721a0b4b4398fc496c840e68287326d81 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java +++ b/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.datamodel; +import com.google.common.base.Optional; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -344,11 +345,11 @@ public AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactTyp } @Override - public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException { + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException { + DataArtifact artifact = db.getBlackboard().newDataArtifact(artifactType, objId, this.getDataSource().getId(), attributesList, osAccountId); - DataArtifact artifact = db.getBlackboard().newDataArtifact(artifactType, objId, this.getDataSource().getId(), attributesList, osAccount); - if(osAccount != null) { - db.getOsAccountManager().newOsAccountInstance(osAccount, (DataSource)getDataSource(), OsAccountInstance.OsAccountInstanceType.LAUNCHED); + if(osAccountId != null) { + db.getOsAccountManager().newOsAccountInstance(osAccountId, getDataSource().getId(), OsAccountInstance.OsAccountInstanceType.LAUNCHED); } return artifact; } diff --git a/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java b/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java index dbeb39670e7300bf883a981e46c2fad79f0f186a..c4ffa584ecb35fea3f07991f7327042fc916b451 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java +++ b/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java @@ -1412,6 +1412,23 @@ public BlackboardArtifact newArtifact(int artifactTypeID) throws TskCoreExceptio return getSleuthkitCase().newBlackboardArtifact(artifactTypeID, getId(), dataSourceObjectId); } + /** + * Create and add a data artifact associated with this abstract file. This + * method creates the data artifact with the os account id associated with + * this abstract file if one exits. + * + * @param artifactType Type of data artifact to create. + * @param attributesList Additional attributes to attach to this data + * artifact. + * + * @return DataArtifact New data artifact. + * + * @throws TskCoreException If a critical error occurred within tsk core. + */ + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList) throws TskCoreException { + return super.newDataArtifact(artifactType, attributesList, osAccountObjId); + } + /** * Initializes common fields used by AbstactFile implementations (objects in * tsk_files table) diff --git a/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java b/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java index 05d76668299d0cdec80715e6a771cfbf543f7779..50b106a98cd0863e077b7fa0f9303e4619df8d89 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java @@ -959,29 +959,24 @@ public static final class BlackboardException extends Exception { * belongs to, may be the same as the sourceObjId. * May be null. * @param attributes The attributes. May be empty or null. - * @param osAccount The OS account associated with the artifact. May - * be null. + * @param osAccountId The OS account id associated with the artifact. + * May be null. * * @return DataArtifact A new data artifact. * * @throws TskCoreException If a critical error occurs within tsk core. */ public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, long sourceObjId, Long dataSourceObjId, - Collection<BlackboardAttribute> attributes, OsAccount osAccount) throws TskCoreException { + Collection<BlackboardAttribute> attributes, Long osAccountId) throws TskCoreException { if (artifactType.getCategory() != BlackboardArtifact.Category.DATA_ARTIFACT) { throw new TskCoreException(String.format("Artifact type (name = %s) is not of Data Artifact category. ", artifactType.getTypeName())); } - Long osAccountObjdId = null; - if (osAccount != null) { - osAccountObjdId = osAccount.getId(); - } - CaseDbTransaction transaction = caseDb.beginTransaction(); try { DataArtifact dataArtifact = newDataArtifact(artifactType, sourceObjId, dataSourceObjId, - attributes, osAccountObjdId, transaction); + attributes, osAccountId, transaction); transaction.commit(); return dataArtifact; } catch (TskCoreException ex) { diff --git a/bindings/java/src/org/sleuthkit/datamodel/BlackboardArtifact.java b/bindings/java/src/org/sleuthkit/datamodel/BlackboardArtifact.java index 6c240972f8fedf91c73ee73ab5569fc860676ada..e3fbc72b66f1f80ee94ecc371e473af8210d063d 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/BlackboardArtifact.java +++ b/bindings/java/src/org/sleuthkit/datamodel/BlackboardArtifact.java @@ -697,8 +697,7 @@ public AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactTyp } @Override - public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException { - + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException { throw new TskCoreException("Cannot create data artifact of an artifact. Not supported."); } diff --git a/bindings/java/src/org/sleuthkit/datamodel/Content.java b/bindings/java/src/org/sleuthkit/datamodel/Content.java index 2d27f2a7698a0aabab3c21f20ecb5915767bea52..ca10cd5711c663d41cdb162ece05525b5ca25b78 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Content.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Content.java @@ -1,15 +1,15 @@ /* * Sleuth Kit Data Model - * + * * Copyright 2011-2016 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -179,7 +179,7 @@ public interface Content extends SleuthkitVisitableItem { * Create and add an analysis result associated with this content. * * - * @param artifactType Type of analysis result artifact to create. + * @param artifactType Type of analysis result artifact to create. * @param score Score associated with this analysis. * @param conclusion Conclusion from the analysis, may be empty. * @param configuration Configuration element associated with this @@ -188,8 +188,8 @@ public interface Content extends SleuthkitVisitableItem { * @param attributesList Additional attributes to attach to this analysis * result artifact. * - * @return AnalysisResultAdded The analysis return added and the - current aggregate score of content. + * @return AnalysisResultAdded The analysis return added and the current + * aggregate score of content. * * @throws TskCoreException if critical error occurred within tsk core. */ @@ -201,24 +201,24 @@ public interface Content extends SleuthkitVisitableItem { * @param artifactType Type of analysis result artifact to create. * @param attributesList Additional attributes to attach to this data * artifact. - * @param osAccount The OS account associated with the artifact. May be - * null. + * @param osAccountId The OS account id associated with the artifact. May + * be null. * * @return DataArtifact New data artifact. * * @throws TskCoreException If a critical error occurred within tsk core. */ - public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException; - + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException; + /** * Returns the final score for the content object. - * + * * @return Score. - * + * * @throws TskCoreException if critical error occurred within tsk core. */ public Score getAggregateScore() throws TskCoreException; - + /** * Get all artifacts associated with this content that have the given type * name @@ -232,16 +232,17 @@ public interface Content extends SleuthkitVisitableItem { public ArrayList<BlackboardArtifact> getArtifacts(String artifactTypeName) throws TskCoreException; /** - * Get all analysis results associated with this content, that have the given type. + * Get all analysis results associated with this content, that have the + * given type. * - * @param artifactType Type to look up. + * @param artifactType Type to look up. * * @return A list of analysis result artifacts matching the type. * * @throws TskCoreException If critical error occurred within tsk core. */ public List<AnalysisResult> getAnalysisResults(BlackboardArtifact.Type artifactType) throws TskCoreException; - + /** * Return the TSK_GEN_INFO artifact for the file so that individual * attributes can be added to it. Creates one if it does not already exist. @@ -317,7 +318,7 @@ public interface Content extends SleuthkitVisitableItem { * @throws TskCoreException If critical error occurred within tsk core. */ public List<AnalysisResult> getAllAnalysisResults() throws TskCoreException; - + /** * Get the names of all the hashsets that this content is in. * diff --git a/bindings/java/src/org/sleuthkit/datamodel/OsAccount.java b/bindings/java/src/org/sleuthkit/datamodel/OsAccount.java index b9fd37885012b07b9f5f969e3d78fd8dba87423a..f6c9862c5c32d8251e58439d16260466de299213 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/OsAccount.java +++ b/bindings/java/src/org/sleuthkit/datamodel/OsAccount.java @@ -58,7 +58,6 @@ public final class OsAccount extends AbstractContent { private final Long creationTime; private List<OsAccountAttribute> osAccountAttributes = null; - private List<OsAccountInstance> osAccountInstances = null; /** * Encapsulates status of an account - whether is it active or disabled or @@ -248,16 +247,6 @@ synchronized void setAttributesInternal(List<OsAccountAttribute> osAccountAttrib this.osAccountAttributes = osAccountAttributes; } - /** - * This function is used by OsAccountManger to update the list of OsAccount - * instances. - * - * @param osAccountInstanes The osAccount instances that are to be added. - */ - synchronized void setInstancesInternal(List<OsAccountInstance> osAccountInstances) { - this.osAccountInstances = osAccountInstances; - } - /** * Get the account Object Id that is unique within the scope of the case. * @@ -373,11 +362,7 @@ public synchronized List<OsAccountAttribute> getExtendedOsAccountAttributes() th * @throws TskCoreException */ public synchronized List<OsAccountInstance> getOsAccountInstances() throws TskCoreException { - if (osAccountInstances == null) { - osAccountInstances = sleuthkitCase.getOsAccountManager().getOsAccountInstances(this); - } - - return Collections.unmodifiableList(osAccountInstances); + return sleuthkitCase.getOsAccountManager().getOsAccountInstances(this); } /** diff --git a/bindings/java/src/org/sleuthkit/datamodel/OsAccountInstance.java b/bindings/java/src/org/sleuthkit/datamodel/OsAccountInstance.java index aa9aa302c84ea27ba57981b4700a4b77fd65013f..ab51a5dbc4b77b3f8168950ce82263120201ff31 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/OsAccountInstance.java +++ b/bindings/java/src/org/sleuthkit/datamodel/OsAccountInstance.java @@ -27,39 +27,28 @@ */ public class OsAccountInstance implements Comparable<OsAccountInstance> { - private DataSource dataSource = null; - private final OsAccount account; - private final OsAccountInstanceType instanceType; + private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle"); + private final SleuthkitCase skCase; + private final long accountId; private final long dataSourceId; + private final OsAccountInstanceType instanceType; - private SleuthkitCase skCase; - - private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle"); + private OsAccount account; + private DataSource dataSource = null; /** * Construct with OsAccount and DataSource instances. * + * @param skCase The case instance. * @param account The instance account. * @param dataSource The instance data source * @param instanceType The instance type. */ - OsAccountInstance(OsAccount account, DataSource dataSource, OsAccountInstanceType instanceType) { - this(account, dataSource.getId(), instanceType); + OsAccountInstance(SleuthkitCase skCase, OsAccount account, DataSource dataSource, OsAccountInstanceType instanceType) { + this(skCase, account.getId(), dataSource.getId(), instanceType); this.dataSource = dataSource; - } - - /** - * Construct with OsAccount and DataSource instances. - * - * @param account The instance account. - * @param dataSourceObjId The instance data source object id. - * @param instanceType The instance type. - */ - OsAccountInstance(OsAccount account, long dataSourceObjId, OsAccountInstanceType instanceType) { this.account = account; - this.dataSourceId = dataSourceObjId; - this.instanceType = instanceType; } /** @@ -72,10 +61,23 @@ public class OsAccountInstance implements Comparable<OsAccountInstance> { * @param instanceType The instance type. */ OsAccountInstance(SleuthkitCase skCase, OsAccount account, long dataSourceId, OsAccountInstanceType instanceType) { + this(skCase, account.getId(), dataSourceId, instanceType); this.account = account; - this.dataSourceId = dataSourceId; - this.instanceType = instanceType; + } + + /** + * Construct with OsAccount and DataSource instances. + * + * @param skCase The case instance + * @param accountId The id of the instance account. + * @param dataSourceObjId The instance data source object id. + * @param instanceType The instance type. + */ + OsAccountInstance(SleuthkitCase skCase, long accountId, long dataSourceObjId, OsAccountInstanceType instanceType) { this.skCase = skCase; + this.accountId = accountId; + this.dataSourceId = dataSourceObjId; + this.instanceType = instanceType; } /** @@ -83,7 +85,15 @@ public class OsAccountInstance implements Comparable<OsAccountInstance> { * * @return The OsAccount object. */ - public OsAccount getOsAccount() { + public OsAccount getOsAccount() throws TskCoreException { + if (account == null) { + try { + account = skCase.getOsAccountManager().getOsAccountByObjectId(accountId); + } catch (TskCoreException ex) { + throw new TskCoreException(String.format("Failed to get OsAccount for id %d", accountId), ex); + } + } + return account; } @@ -134,7 +144,7 @@ public int compareTo(OsAccountInstance other) { return Long.compare(dataSourceId, other.getDataSourceId()); } - return Long.compare(account.getId(), other.getOsAccount().getId()); + return Long.compare(accountId, other.accountId); } @Override @@ -149,7 +159,7 @@ public boolean equals(Object obj) { return false; } final OsAccountInstance other = (OsAccountInstance) obj; - if (this.account.getId() != other.getOsAccount().getId()) { + if (this.accountId != other.accountId) { return false; } @@ -160,7 +170,7 @@ public boolean equals(Object obj) { public int hashCode() { int hash = 7; hash = 67 * hash + Objects.hashCode(this.dataSourceId); - hash = 67 * hash + Objects.hashCode(this.account.getId()); + hash = 67 * hash + Objects.hashCode(this.accountId); hash = 67 * hash + Objects.hashCode(this.instanceType); return hash; } diff --git a/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java b/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java index 24d2ffcb41debf3a9389f042453b4460f5a26c69..99f9a8f9fd1cd5ea0d3e0cb43489700ed6352bf4 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java +++ b/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java @@ -523,7 +523,7 @@ public void newOsAccountInstance(OsAccount osAccount, DataSource dataSource, OsA } // check cache first - OsAccountInstance accountInstance = new OsAccountInstance(osAccount, dataSource, instanceType); + OsAccountInstance accountInstance = new OsAccountInstance(db, osAccount, dataSource, instanceType); if (osAccountInstanceCache.contains(accountInstance)) { return; } @@ -575,8 +575,43 @@ void newOsAccountInstance(OsAccount osAccount, long dataSourceObjId, OsAccountIn throw new TskCoreException("Cannot create account instance with null account."); } + newOsAccountInstance(osAccount.getId(), dataSourceObjId, instanceType, connection); + } + + /** + * Adds a row to the tsk_os_account_instances table. Does nothing if the + * instance already exists in the table. + * + * @param osAccountId Account id for which an instance needs to be + * added. + * @param dataSourceObjId Data source id where the instance is found. + * @param instanceType Instance type. + * + * @throws TskCoreException If there is an error creating the account + * instance. + */ + void newOsAccountInstance(long osAccountId, long dataSourceObjId, OsAccountInstance.OsAccountInstanceType instanceType) throws TskCoreException { + try (CaseDbConnection connection = this.db.getConnection()) { + newOsAccountInstance(osAccountId, dataSourceObjId, instanceType, connection); + } + } + + /** + * Adds a row to the tsk_os_account_instances table. Does nothing if the + * instance already exists in the table. + * + * @param osAccountId Account id for which an instance needs to be + * added. + * @param dataSourceObjId Data source id where the instance is found. + * @param instanceType Instance type. + * @param connection The current database connection. + * + * @throws TskCoreException If there is an error creating the account + * instance. + */ + void newOsAccountInstance(long osAccountId, long dataSourceObjId, OsAccountInstance.OsAccountInstanceType instanceType, CaseDbConnection connection) throws TskCoreException { // check cache first - OsAccountInstance accountInstance = new OsAccountInstance(osAccount, dataSourceObjId, instanceType); + OsAccountInstance accountInstance = new OsAccountInstance(db, osAccountId, dataSourceObjId, instanceType); if (osAccountInstanceCache.contains(accountInstance)) { return; } @@ -590,7 +625,7 @@ void newOsAccountInstance(OsAccount osAccount, long dataSourceObjId, OsAccountIn PreparedStatement preparedStatement = connection.getPreparedStatement(accountInsertSQL, Statement.RETURN_GENERATED_KEYS); preparedStatement.clearParameters(); - preparedStatement.setLong(1, osAccount.getId()); + preparedStatement.setLong(1, osAccountId); preparedStatement.setLong(2, dataSourceObjId); preparedStatement.setInt(3, instanceType.getId()); @@ -598,14 +633,8 @@ void newOsAccountInstance(OsAccount osAccount, long dataSourceObjId, OsAccountIn // add to the cache. osAccountInstanceCache.add(accountInstance); - - // update account instances - List<OsAccountInstance> currentInstancesList = getOsAccountInstances(osAccount, connection); - currentInstancesList.add(accountInstance); - osAccount.setInstancesInternal(currentInstancesList); - } catch (SQLException ex) { - throw new TskCoreException(String.format("Error adding os account instance for account = %s, data source object id = %d", osAccount.getAddr().orElse(osAccount.getLoginName().orElse("UNKNOWN")), dataSourceObjId), ex); + throw new TskCoreException(String.format("Error adding os account instance id = %d, data source object id = %d", osAccountId, dataSourceObjId), ex); } finally { db.releaseSingleUserCaseWriteLock(); } diff --git a/bindings/java/src/org/sleuthkit/datamodel/Report.java b/bindings/java/src/org/sleuthkit/datamodel/Report.java index d5894c6419ce603f07920ec40330d8111d3ee359..78eceef6c3ff152092c350a1f9d2f34aea89a70a 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Report.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Report.java @@ -256,13 +256,13 @@ public AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactTyp } @Override - public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException { + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException { if (artifactType.getTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) { throw new TskCoreException("Reports can only have keyword hit artifacts."); } - return db.getBlackboard().newDataArtifact(artifactType, objectId, this.getDataSource().getId(), attributesList, osAccount); + return db.getBlackboard().newDataArtifact(artifactType, objectId, this.getDataSource().getId(), attributesList, osAccountId); } @Override diff --git a/bindings/java/test/org/sleuthkit/datamodel/ArtifactTest.java b/bindings/java/test/org/sleuthkit/datamodel/ArtifactTest.java index 26c3fa00380b3f255f474781ad11a56c6d04e2cd..6b0d5174d2a06846f2de1286432d2bcbb7f89a5f 100644 --- a/bindings/java/test/org/sleuthkit/datamodel/ArtifactTest.java +++ b/bindings/java/test/org/sleuthkit/datamodel/ArtifactTest.java @@ -242,7 +242,7 @@ public void artifactTests() throws TskCoreException, Blackboard.BlackboardExcept // Test: add a new data artifact to the file - DataArtifact dataArtifact1 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH), Collections.emptyList(), osAccount1); + DataArtifact dataArtifact1 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH), Collections.emptyList(), osAccount1.getId()); OsAccountManager osAcctMgr = caseDB.getOsAccountManager(); @@ -251,14 +251,14 @@ public void artifactTests() throws TskCoreException, Blackboard.BlackboardExcept // Test: add a second data artifact to file - associate it with a different account - DataArtifact dataArtifact2 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_CLIPBOARD_CONTENT), Collections.emptyList(), osAccount2); + DataArtifact dataArtifact2 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_CLIPBOARD_CONTENT), Collections.emptyList(), osAccount2.getId()); assertTrue(dataArtifact2.getOsAccountObjectId().isPresent()); assertTrue(osAcctMgr.getOsAccountByObjectId(dataArtifact2.getOsAccountObjectId().get()).getAddr().orElse("").equalsIgnoreCase(ownerUid2)); // and two more - DataArtifact dataArtifact3 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA), Collections.emptyList(), osAccount2); - DataArtifact dataArtifact4 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA), Collections.emptyList(), osAccount2); + DataArtifact dataArtifact3 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA), Collections.emptyList(), osAccount2.getId()); + DataArtifact dataArtifact4 = abcTextFile.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA), Collections.emptyList(), osAccount2.getId()); // TEST: get all TSK_GPS_SEARCH data artifacts in the data source @@ -355,10 +355,10 @@ public void artifactTests() throws TskCoreException, Blackboard.BlackboardExcept // Create five data artifacts. Only three should create a row in tsk_data_artifacts. DataArtifact dataArt1 = defTextFile.newDataArtifact(dataArtType, java.util.Collections.emptyList(), null); - DataArtifact dataArt2 = defTextFile.newDataArtifact(dataArtType, java.util.Collections.emptyList(), osAccount2); + DataArtifact dataArt2 = defTextFile.newDataArtifact(dataArtType, java.util.Collections.emptyList(), osAccount2.getId()); BlackboardArtifact bbArt1 = defTextFile.newArtifact(dataArtType.getTypeID()); - DataArtifact dataArt3 = defTextFile.newDataArtifact(dataArtType, java.util.Collections.emptyList(), osAccount2); - DataArtifact dataArt4 = caseDB.getBlackboard().newDataArtifact(dataArtType, defTextFile.getId(), fs.getDataSource().getId(), java.util.Collections.emptyList(), osAccount2); + DataArtifact dataArt3 = defTextFile.newDataArtifact(dataArtType, java.util.Collections.emptyList(), osAccount2.getId()); + DataArtifact dataArt4 = caseDB.getBlackboard().newDataArtifact(dataArtType, defTextFile.getId(), fs.getDataSource().getId(), java.util.Collections.emptyList(), osAccount2.getId()); int dataArtifactCount = 5; // TEST: getDataArtifacts(artifact type id)