diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index 77bea497af..24083965fb 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -61,6 +61,7 @@ DefaultArtifactContentViewer.attrsTableHeader.type=Type DefaultArtifactContentViewer.attrsTableHeader.value=Value DefaultArtifactContentViewer.copyMenuItem.text=Copy DefaultArtifactContentViewer.selectAllMenuItem.text=Select All +MessageAccountPanel.account.justification=Account found in Message artifact MessageAccountPanel_button_create_label=Create MessageAccountPanel_button_view_label=View MessageAccountPanel_contact_label=Contact: @@ -85,5 +86,6 @@ MessageArtifactViewer.subjectLabel.text=Subject: MessageArtifactViewer.attachmentsPanel.TabConstraints.tabTitle=Attachments MessageArtifactViewer.ccText.text=cc list goes here MessageArtifactViewer.textbodyScrollPane.TabConstraints.tabTitle=Text +PersonaAccountFetcher.account.justification=Account found in Call Log artifact # {0} - Persona count PersonaDisplayTask_persona_count_suffix=(1 of {0}) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/MessageAccountPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/MessageAccountPanel.java index e51577819a..8192bdcc22 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/MessageAccountPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/MessageAccountPanel.java @@ -36,8 +36,11 @@ import javax.swing.JPanel; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; +import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.Persona; import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount; @@ -51,6 +54,7 @@ import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.CommunicationsManager; +import org.sleuthkit.datamodel.InvalidAccountIDException; import org.sleuthkit.datamodel.TskCoreException; /** @@ -450,6 +454,9 @@ final class MessageAccountPanel extends JPanel { this.accountContainer = accountContainer; } + @NbBundle.Messages({ + "MessageAccountPanel.account.justification=Account found in Message artifact" + }) @Override public void actionPerformed(ActionEvent e) { Persona persona = accountContainer.getPersona(); @@ -464,8 +471,28 @@ final class MessageAccountPanel extends JPanel { // Pre populate the persona name and accounts if we have them. PersonaDetailsPanel personaPanel = createPersonaDialog.getDetailsPanel(); + // Set a default name personaPanel.setPersonaName(accountContainer.getAccount().getTypeSpecificID()); + // Set up each matching account. We don't know what type of account we have, so check all the types to + // find any matches. + try { + for (CentralRepoAccount.CentralRepoAccountType type : CentralRepository.getInstance().getAllAccountTypes()) { + try { + // Try to load any matching accounts of this type. Throws an InvalidAccountIDException if the account is the + // wrong format (i.e., when we try to load email accounts for a phone number-type string). + CentralRepoAccount account = CentralRepository.getInstance().getAccount(type, accountContainer.getAccount().getTypeSpecificID()); + if (account != null) { + personaPanel.addAccount(account, Bundle.MessageAccountPanel_account_justification(), Persona.Confidence.HIGH); + } + } catch (InvalidAccountIDException ex2) { + // These are expected when the account identifier doesn't match the format of the account type. + } + } + } catch (CentralRepoException ex) { + logger.log(Level.SEVERE, "Error looking up account types in the central repository", ex); + } + // display the dialog now createPersonaDialog.display(); } else { diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/PersonaAccountFetcher.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/PersonaAccountFetcher.java index 2ffef0ce3e..834785801d 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/PersonaAccountFetcher.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/PersonaAccountFetcher.java @@ -30,17 +30,23 @@ import java.util.concurrent.ExecutionException; import java.util.logging.Level; import javax.swing.JButton; import javax.swing.SwingWorker; +import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.Persona; import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount; import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialog; import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialogCallback; import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsMode; +import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsPanel; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.CommunicationsManager; +import org.sleuthkit.datamodel.InvalidAccountIDException; /** * SwingWorker for fetching and updating Persona controls. @@ -173,11 +179,43 @@ class PersonaAccountFetcher extends SwingWorker> this.personaSearcherData = personaSearcherData; } + @NbBundle.Messages({ + "PersonaAccountFetcher.account.justification=Account found in Call Log artifact" + }) @Override public void actionPerformed(java.awt.event.ActionEvent evt) { // Launch the Persona Create dialog - new PersonaDetailsDialog(parentComponent, - PersonaDetailsMode.CREATE, null, new PersonaCreateCallbackImpl(parentComponent, personaSearcherData)); + + PersonaDetailsDialog dialog = new PersonaDetailsDialog(parentComponent, + PersonaDetailsMode.CREATE, null, new PersonaCreateCallbackImpl(parentComponent, personaSearcherData), false); + + // Pre populate the persona name and accounts if we have them. + PersonaDetailsPanel personaPanel = dialog.getDetailsPanel(); + + // Set a default name + personaPanel.setPersonaName(personaSearcherData.getAccountIdentifer()); + + // Set up each matching account. We don't know what type of account we have, so check all the types to + // find any matches. + try { + for (CentralRepoAccount.CentralRepoAccountType type : CentralRepository.getInstance().getAllAccountTypes()) { + try { + // Try to load any matching accounts of this type. Throws an InvalidAccountIDException if the account is the + // wrong format (i.e., when we try to load email accounts for a phone number-type string). + CentralRepoAccount account = CentralRepository.getInstance().getAccount(type, personaSearcherData.getAccountIdentifer()); + if (account != null) { + personaPanel.addAccount(account, Bundle.PersonaAccountFetcher_account_justification(), Persona.Confidence.HIGH); + } + } catch (InvalidAccountIDException ex2) { + // These are expected when the account identifier doesn't match the format of the account type. + } + } + } catch (CentralRepoException ex) { + logger.log(Level.SEVERE, "Error looking up account types in the central repository", ex); + } + + // display the dialog now + dialog.display(); } }