From 6daca4a5b369982601dd857ede703b663cbc3154 Mon Sep 17 00:00:00 2001 From: Brian Carrier <carrier@sleuthkit.org> Date: Mon, 12 Aug 2013 11:59:36 -0400 Subject: [PATCH] Added GenInfo methods to Context --- API-CHANGES.txt | 1 + .../src/org/sleuthkit/datamodel/AbstractContent.java | 12 ++++++++++++ .../java/src/org/sleuthkit/datamodel/Content.java | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/API-CHANGES.txt b/API-CHANGES.txt index 18c4bc6f4..d008b21af 100644 --- a/API-CHANGES.txt +++ b/API-CHANGES.txt @@ -1,3 +1,4 @@ Changes to make once we are ready to do a backwards incompatible change. - TSK_SERVICE_ACCOUNT to TSK_ACCOUNT - HashDB to use new TSK_BASE_HASHDB enum instead of its own ENUM +- Java SLeuthkitCase.addArtifactType shoudl return different if artifact already exists or getArtifactId should.... diff --git a/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java b/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java index fcec827f0..d618e915d 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java +++ b/bindings/java/src/org/sleuthkit/datamodel/AbstractContent.java @@ -208,6 +208,18 @@ public ArrayList<BlackboardArtifact> getArtifacts(int artifactTypeID) throws Tsk public ArrayList<BlackboardArtifact> getArtifacts(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException { return db.getBlackboardArtifacts(type, objId); } + + @Override + public BlackboardArtifact getGenInfoArtifact() throws TskCoreException { + ArrayList<BlackboardArtifact> arts = getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); + if (arts.isEmpty()) { + BlackboardArtifact art = newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); + return art; + } + else { + return arts.get(0); + } + } @Override public ArrayList<BlackboardArtifact> getAllArtifacts() throws TskCoreException { diff --git a/bindings/java/src/org/sleuthkit/datamodel/Content.java b/bindings/java/src/org/sleuthkit/datamodel/Content.java index e918e701f..d8b87688c 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Content.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Content.java @@ -163,6 +163,16 @@ public interface Content extends SleuthkitVisitableItem { */ public ArrayList<BlackboardArtifact> getArtifacts(String artifactTypeName) throws TskCoreException; + + /** + * Return the TSK_GEN_INFO artifact for the file so that individual attributes + * can be added to it. + * + * @returna Instance of the TSK_GEN_INFO artifact + * @throws TskCoreException + */ + public BlackboardArtifact getGenInfoArtifact() throws TskCoreException; + /** * Get all artifacts associated with this content that have the given type * id -- GitLab