diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaAlias.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaAlias.java index cdebd7097d..7014e013bd 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaAlias.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaAlias.java @@ -149,7 +149,8 @@ public class PersonaAlias { public static Collection getPersonaAliases(long personaId) throws CentralRepoException { String queryClause = "SELECT pa.id, pa.persona_id, pa.alias, pa.justification, pa.confidence_id, pa.date_added, pa.examiner_id, e.login_name, e.display_name " + "FROM persona_alias as pa " - + "INNER JOIN examiners as e ON e.id = pa.examiner_id "; + + "INNER JOIN examiners as e ON e.id = pa.examiner_id " + + "WHERE pa.persona_id = " + personaId; PersonaAliasesQueryCallback queryCallback = new PersonaAliasesQueryCallback(); CentralRepository.getInstance().executeSelectSQL(queryClause, queryCallback); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaMetadata.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaMetadata.java index 713f00a981..e6fcb5da71 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaMetadata.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PersonaMetadata.java @@ -160,8 +160,9 @@ public class PersonaMetadata { static Collection getPersonaMetadata(long personaId) throws CentralRepoException { String queryClause = "SELECT pmd.id, pmd.persona_id, pmd.name, pmd.value, pmd.justification, pmd.confidence_id, pmd.date_added, pmd.examiner_id, e.login_name, e.display_name " + "FROM persona_metadata as pmd " - + "INNER JOIN examiners as e ON e.id = pmd.examiner_id "; - + + "INNER JOIN examiners as e ON e.id = pmd.examiner_id " + + "WHERE pmd.persona_id = " + personaId; + PersonaMetadataQueryCallback queryCallback = new PersonaMetadataQueryCallback(); CentralRepository.getInstance().executeSelectSQL(queryClause, queryCallback); diff --git a/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties index 6dde31add8..092b975370 100644 --- a/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/report/Bundle_ja.properties @@ -293,7 +293,6 @@ ReportGenerator.artTableColHdr.osInstallDate.text=\u30a4\u30f3\u30b9\u30c8\u30fc ReportGenerator.errList.failedMakeRptFolder=\u30ec\u30dd\u30fc\u30c8\u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30ec\u30dd\u30fc\u30c8\u3092\u751f\u6210\u3067\u304d\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 ReportGenerator.notifyErr.errsDuringRptGen=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: ReportGenerator.errList.failedGetContentTags=\u30b3\u30f3\u30c6\u30f3\u30c4\u30bf\u30b0\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -ReportGenerator.errList.failedGetBBArtifactTags=\u30d6\u30e9\u30c3\u30af\u30dc\u30fc\u30c9\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u30bf\u30b0\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 ReportGenerator.errList.errGetContentFromBBArtifact=\u30ec\u30dd\u30fc\u30c8\u4f5c\u6210\u5bfe\u8c61\u306e\u30d6\u30e9\u30c3\u30af\u30dc\u30fc\u30c9\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u53d6\u5f97\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 ReportGenerator.errList.failedGetBBAttribs=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u4e2d\u306b\u30d6\u30e9\u30c3\u30af\u30dc\u30fc\u30c9\u5c5e\u6027\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 ReportGenerator.errList.failedGetBBArtifacts=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u4e2d\u306b\u30d6\u30e9\u30c3\u30af\u30dc\u30fc\u30c9\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties index 8d6d7e88a1..cdab8b0cfa 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties @@ -169,7 +169,6 @@ ReportGenerator.notifyErr.errsDuringRptGen=Errors during report generation: ReportGenerator.errList.failedGetAllTagsArtifacts=Failed get all possible tag names and artifact types. ReportGenerator.errList.noReportSettings=Report settings have not been configured. ReportGenerator.errList.failedGetContentTags=Failed to get content tags. -ReportGenerator.errList.failedGetBBArtifactTags=Failed to get blackboard artifact tags. ReportGenerator.errList.errGetContentFromBBArtifact=Error while getting content from a blackboard artifact to report on. ReportGenerator.errList.failedGetBBAttribs=Failed to get Blackboard Attributes when generating report. ReportGenerator.errList.failedGetBBArtifacts=Failed to get Blackboard Artifacts when generating report. diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED index d36c0f5ca6..14e603e61b 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED @@ -7,6 +7,7 @@ PortableCaseTagsListPanel.error.errorLoadingTags=Error loading tags PortableCaseTagsListPanel.error.errorTitle=Error getting tag names for case PortableCaseTagsListPanel.error.noOpenCase=There is no case open ReportGenerator.artTableColHdr.comment=Comment +ReportGenerator.errList.failedGetBBArtifactTags=Failed to get result tags. ReportGenerator.errList.noOpenCase=No open case available. ReportGenerator.tagTable.header.userName=User Name ReportProgressIndicator.cancelledMessage=Report generation cancelled @@ -188,7 +189,6 @@ ReportGenerator.notifyErr.errsDuringRptGen=Errors during report generation: ReportGenerator.errList.failedGetAllTagsArtifacts=Failed get all possible tag names and artifact types. ReportGenerator.errList.noReportSettings=Report settings have not been configured. ReportGenerator.errList.failedGetContentTags=Failed to get content tags. -ReportGenerator.errList.failedGetBBArtifactTags=Failed to get blackboard artifact tags. ReportGenerator.errList.errGetContentFromBBArtifact=Error while getting content from a blackboard artifact to report on. ReportGenerator.errList.failedGetBBAttribs=Failed to get Blackboard Attributes when generating report. ReportGenerator.errList.failedGetBBArtifacts=Failed to get Blackboard Artifacts when generating report. diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle_ja.properties index 5077b78fd1..c278634512 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle_ja.properties @@ -150,7 +150,6 @@ ReportGenerator.errList.coreExceptionWhileGenRptRow=\u30a2\u30fc\u30c6\u30a3\u30 ReportGenerator.errList.errGetContentFromBBArtifact=Blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u304b\u3089\u30ec\u30dd\u30fc\u30c8\u7528\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u53d6\u5f97\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 ReportGenerator.errList.failedGetAbstractFileByID=ID\u306b\u57fa\u3065\u304d\u30a2\u30d6\u30b9\u30c8\u30e9\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3059\u308b\u306e\u3092\u5931\u6557\u3057\u307e\u3057\u305f ReportGenerator.errList.failedGetBBArtifacts=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u4e2d\u306bBlackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 -ReportGenerator.errList.failedGetBBArtifactTags=Blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8\u30bf\u30b0\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 ReportGenerator.errList.failedGetBBAttribs=\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u4e2d\u306bBlackboard\u5c5e\u6027\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 ReportGenerator.errList.failedGetContentTags=\u30b3\u30f3\u30c6\u30f3\u30c4\u30bf\u30b0\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 ReportGenerator.errList.failedMakeRptFolder=\u30ec\u30dd\u30fc\u30c8\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u304c\u3067\u304d\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index a889d4f2a8..3894af6e2e 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -321,9 +321,16 @@ public class ReportGenerator { TableReportGenerator generator = new TableReportGenerator(tableReportSettings, progressIndicator, tableReport); generator.execute(); tableReport.endReport(); + // finish progress, wrap up - progressIndicator.complete(ReportProgressPanel.ReportStatus.COMPLETE); errorList = generator.getErrorList(); + + // if error list is empty, the operation has completed successfully. If not there is an error + ReportProgressPanel.ReportStatus finalStatus = (errorList == null || errorList.isEmpty()) ? + ReportProgressPanel.ReportStatus.COMPLETE : + ReportProgressPanel.ReportStatus.ERROR; + + progressIndicator.complete(finalStatus); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java index 527301f491..6b8e4a4957 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java @@ -424,6 +424,9 @@ class TableReportGenerator { * Generate the tables for the tagged artifacts */ @SuppressWarnings("deprecation") + @Messages({ + "ReportGenerator.errList.failedGetBBArtifactTags=Failed to get result tags." + }) private void makeBlackboardArtifactTagsTables() { List tags; diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPersonasTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPersonasTest.java index 531a2c01f0..fcfb44e520 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPersonasTest.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPersonasTest.java @@ -383,6 +383,129 @@ public class CentralRepoPersonasTest extends TestCase { } } + /** + * Tests Persona alias and metadata. + * + */ + public void testPersonaAliasesAndMetadata() { + + + try { + + // Step 1: Create an account + CentralRepoAccount phoneAccount1 = CentralRepository.getInstance() + .getOrCreateAccount(phoneAccountType, PHONE_NUM_1); + + + // Step 2: Create a Persona for the Account + String comment = "The best dog ever"; + Persona.PersonaStatus status = Persona.PersonaStatus.ACTIVE; + Persona dogPersona = Persona.createPersonaForAccount(DOG_PERSONA_NAME, comment , status, phoneAccount1, "Because I said so", Persona.Confidence.LOW ); + + + // Step 3. Add Persona Aliases + PersonaAlias alias1 = dogPersona.addAlias("Good Boy", "Coz he's is the best dog ever", Persona.Confidence.MEDIUM); + PersonaAlias alias2 = dogPersona.addAlias("WoofWoof", "How many dumb comments can I come up with?", Persona.Confidence.LOW); + + Assert.assertNotNull(alias1); + Assert.assertNotNull(alias2); + + //Step 4: Add Persona metadata + PersonaMetadata metadata1 = dogPersona.addMetadata("Color", "Black", "He's got thick black hair.", Persona.Confidence.MEDIUM); + PersonaMetadata metadata2 = dogPersona.addMetadata("Gender", "Male", "Because...", Persona.Confidence.LOW); + + Assert.assertNotNull(metadata1); + Assert.assertNotNull(metadata2); + + // get all aliases for persona1 + Collection dogAliases1 = dogPersona.getAliases(); + Assert.assertEquals(2, dogAliases1.size()); + for (PersonaAlias alias: dogAliases1) { + //System.out.println(" Dog Alias: "+ alias.getAlias()) ; + Assert.assertFalse(alias.getAlias().isEmpty()); + } + // get all metadata for persona1 + Collection dogMetadataList = dogPersona.getMetadata(); + Assert.assertEquals(2, dogMetadataList.size()); + for (PersonaMetadata md: dogMetadataList) { + //System.out.println(String.format("Metadata: %s : %s", md.getName(), md.getValue())) ; + Assert.assertFalse(md.getName().isEmpty()); + Assert.assertFalse(md.getValue().isEmpty()); + } + + + // Step 5: Create another account + CentralRepoAccount catdogFBAccount = CentralRepository.getInstance() + .getOrCreateAccount(facebookAccountType, FACEBOOK_ID_CATDOG); + + // Add an account to persona + dogPersona.addAccountToPersona(catdogFBAccount, "Looks like dog, barks like a dog...", Persona.Confidence.MEDIUM); + + + // Step 6: Create a Second Persona + + String comment2 = "The fiercest cat alive."; + Persona catPersona = Persona.createPersonaForAccount(CAT_PERSONA_NAME, comment2 , Persona.PersonaStatus.ACTIVE, catdogFBAccount, "Smells like a cat.", Persona.Confidence.LOW ); + Assert.assertNotNull(catPersona); + Assert.assertTrue(catPersona.getName().equalsIgnoreCase(CAT_PERSONA_NAME)); + + + // Add Persona Aliases + PersonaAlias catAlias1 = catPersona.addAlias("CutieKitty", "Because", Persona.Confidence.MEDIUM); + Assert.assertNotNull(catAlias1); + + + //Step 4: Add Persona metadata + PersonaMetadata catMetadata1 = catPersona.addMetadata("Color", "White", "White as snow.", Persona.Confidence.MEDIUM); + PersonaMetadata catMetadata2 = catPersona.addMetadata("Breed", "Persian", "Just Because...", Persona.Confidence.LOW); + PersonaMetadata catMetadata3 = catPersona.addMetadata("Legs", "Four", "I counted", Persona.Confidence.HIGH); + + Assert.assertNotNull(catMetadata1); + Assert.assertNotNull(catMetadata2); + Assert.assertNotNull(catMetadata3); + + + // get all aliases for persona2 + Collection catAliases1 = catPersona.getAliases(); + Assert.assertEquals(1, catAliases1.size()); + for (PersonaAlias alias: dogAliases1) { + //System.out.println("Alias: "+ alias.getAlias()) ; + Assert.assertFalse(alias.getAlias().isEmpty()); + } + // get all metadata for persona2 + Collection catMetadataList = catPersona.getMetadata(); + Assert.assertEquals(3, catMetadataList.size()); + for (PersonaMetadata md: catMetadataList) { + //System.out.println(String.format("Metadata: %s : %s", md.getName(), md.getValue())) ; + Assert.assertFalse(md.getName().isEmpty()); + Assert.assertFalse(md.getValue().isEmpty()); + } + + + // Create a 3rd account and persona + CentralRepoAccount holmesSkypeAccount = CentralRepository.getInstance() + .getOrCreateAccount(skypeAccountType, HOLMES_SKYPE_ID); + + // Create a person for the Skype account + Persona holmesPersona = Persona.createPersonaForAccount(HOLMES_PERSONA_NAME, + "Has a Pipe in his mouth.", Persona.PersonaStatus.ACTIVE, + holmesSkypeAccount, "The name says it all.", Persona.Confidence.LOW); + + // This persona has no aliases or metadata. Verify + // get all aliases for holmesPersona + Collection holmesAliases = holmesPersona.getAliases(); + Assert.assertEquals(0, holmesAliases.size()); + + // get all metadata for holmesPersona + Collection holmesMetadataList = holmesPersona.getMetadata(); + Assert.assertEquals(0, holmesMetadataList.size()); + + + } catch (CentralRepoException ex) { + Assert.fail("Didn't expect an exception here. Exception: " + ex); + } + } + /** * Tests Personas & X_Accounts and X_instances in the context of Case/data source. * There are 4 Cases.