6451: Do not search for personas, if Central Repo is disabled.

This commit is contained in:
Raman Arora 2020-06-12 08:48:04 -04:00
parent 747fa34ed9
commit bc10b2657a
3 changed files with 64 additions and 27 deletions

View File

@ -976,7 +976,7 @@ MessageArtifactViewer.rtfbodyScrollPane.TabConstraints.tabTitle=RTF
MessageArtifactViewer.toText.text=to list goes here MessageArtifactViewer.toText.text=to list goes here
MessageArtifactViewer.toLabel.text=To: MessageArtifactViewer.toLabel.text=To:
MessageArtifactViewer.htmlPane.TabConstraints.tabTitle=HTML MessageArtifactViewer.htmlPane.TabConstraints.tabTitle=HTML
CallLogArtifactViewer.localAccountPersonaLabel.text=Persona: CallLogArtifactViewer.localAccountPersonaLabel.text=Persona
CallLogArtifactViewer.localAccountPersonaNameLabel.text=jLabel1 CallLogArtifactViewer.localAccountPersonaNameLabel.text=jLabel1
CallLogArtifactViewer.localAccountPersonaButton.text=jButton1 CallLogArtifactViewer.localAccountPersonaButton.text=jButton1
ContactArtifactViewer.personasLabel.text=Personas ContactArtifactViewer.personasLabel.text=Personas

View File

@ -454,11 +454,8 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
if (callLogViewData.getLocalAccountId() != null) { if (callLogViewData.getLocalAccountId() != null) {
localAccountIdLabel.setText(callLogViewData.getLocalAccountId()); localAccountIdLabel.setText(callLogViewData.getLocalAccountId());
// kick off a task to find the persona for this account // Get the persona for the local account.
PersonaSearcherTask task = new PersonaSearcherTask(new AccountPersonaSearcherData(callLogViewData.getLocalAccountId(), localAccountPersonaNameLabel, localAccountPersonaButton)); getPersona(new AccountPersonaSearcherData(callLogViewData.getLocalAccountId(), localAccountPersonaNameLabel, localAccountPersonaButton));
personaSearchtasks.add(task);
personatasksExecutor.submit(task);
} else { } else {
// no local account info, hide all fields. // no local account info, hide all fields.
localAccountLabel.setVisible(false); localAccountLabel.setVisible(false);
@ -470,6 +467,35 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
} }
} }
@NbBundle.Messages({
"CallLogArtifactViewer_crdisbaled_persona_label=Unknown",
"CallLogArtifactViewer_crdisbaled_persona_button_text=Create"
})
/**
* Gets the persona for the account specified. The persona name and button are
* updated when the persona is retrieved.
*
* If CentralRepo is disabled, it disables the persona name & button.
*
* @param personaSearcherData Persona search data.
*
*/
private void getPersona(AccountPersonaSearcherData personaSearcherData) {
if (CentralRepository.isEnabled()) {
PersonaSearcherTask task = new PersonaSearcherTask(personaSearcherData);
personaSearchtasks.add(task);
personatasksExecutor.submit(task);
} else {
personaSearcherData.getPersonaNameLabel().setText(Bundle.CallLogArtifactViewer_crdisbaled_persona_label());
personaSearcherData.getPersonaNameLabel().setEnabled(false);
personaSearcherData.getPersonaActionButton().setText(Bundle.CallLogArtifactViewer_crdisbaled_persona_button_text());
personaSearcherData.getPersonaActionButton().setEnabled(false);
}
}
/** /**
* Updates the Call participants panel. * Updates the Call participants panel.
* *
@ -575,13 +601,10 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
constraints.insets = new java.awt.Insets(TOP_INSET, 0, 0, 0); constraints.insets = new java.awt.Insets(TOP_INSET, 0, 0, 0);
// Kick off a background thread to search for the persona // Get the persona for this party, and update the persona name & button.
// for this particpant account. getPersona(new AccountPersonaSearcherData(accountIdentifier, participantPersonaNameLabel, personaButton));
PersonaSearcherTask task = new PersonaSearcherTask(new AccountPersonaSearcherData(accountIdentifier, participantPersonaNameLabel, personaButton));
personaSearchtasks.add(task);
personatasksExecutor.submit(task);
// add a filler to take up rest of the space // Add a filler to take up rest of the space
constraints.gridx++; constraints.gridx++;
constraints.weightx = 1.0; constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL; constraints.fill = GridBagConstraints.HORIZONTAL;

View File

@ -42,6 +42,7 @@ import javax.swing.SwingWorker;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; 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.Persona;
import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount; import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount;
import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialog; import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialog;
@ -424,12 +425,17 @@ public class ContactArtifactViewer extends javax.swing.JPanel implements Artifac
* @throws CentralRepoException * @throws CentralRepoException
*/ */
@NbBundle.Messages({ @NbBundle.Messages({
"ContactArtifactViewer_persona_searching= Searching..." "ContactArtifactViewer_persona_searching= Searching...",
"ContactArtifactViewer_persona_unknown=Unknown"
}) })
private void initiatePersonasSearch(List<BlackboardAttribute> accountAttributesList) throws CentralRepoException { private void initiatePersonasSearch(List<BlackboardAttribute> accountAttributesList) throws CentralRepoException {
personasLabel.setVisible(true); personasLabel.setVisible(true);
String personaStatusLabelText = CentralRepository.isEnabled()
? Bundle.ContactArtifactViewer_persona_searching()
: Bundle.ContactArtifactViewer_persona_unknown();
// create a gridbag layout to show each participant on one line // create a gridbag layout to show each participant on one line
GridBagLayout gridBagLayout = new GridBagLayout(); GridBagLayout gridBagLayout = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints(); GridBagConstraints constraints = new GridBagConstraints();
@ -451,19 +457,27 @@ public class ContactArtifactViewer extends javax.swing.JPanel implements Artifac
personasPanel.add(personaLabel); personasPanel.add(personaLabel);
constraints.gridy++; constraints.gridy++;
javax.swing.JLabel primaryPersonaNameLabel = new javax.swing.JLabel(); javax.swing.JLabel personaStatusLabel = new javax.swing.JLabel();
primaryPersonaNameLabel.setText(Bundle.ContactArtifactViewer_persona_searching()); personaStatusLabel.setText(personaStatusLabelText);
gridBagLayout.setConstraints(primaryPersonaNameLabel, constraints); gridBagLayout.setConstraints(personaStatusLabel, constraints);
personasPanel.add(primaryPersonaNameLabel); personasPanel.add(personaStatusLabel);
personasPanel.setLayout(gridBagLayout);
personasPanel.revalidate(); if (CentralRepository.isEnabled() ) {
personasPanel.repaint(); personasLabel.setEnabled(true);
// Kick off a background task to serach for personas for the contact // Kick off a background task to serach for personas for the contact
ContactPersonaSearcherTask personaSearchTask = new ContactPersonaSearcherTask(accountAttributesList); ContactPersonaSearcherTask personaSearchTask = new ContactPersonaSearcherTask(accountAttributesList);
personaSearchTask.execute(); personaSearchTask.execute();
} else {
personasLabel.setEnabled(false);
personaLabel.setEnabled(false);
personaStatusLabel.setEnabled(false);
}
personasPanel.setLayout(gridBagLayout);
personasPanel.revalidate();
personasPanel.repaint();
} }
/** /**