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.toLabel.text=To:
MessageArtifactViewer.htmlPane.TabConstraints.tabTitle=HTML
CallLogArtifactViewer.localAccountPersonaLabel.text=Persona:
CallLogArtifactViewer.localAccountPersonaLabel.text=Persona
CallLogArtifactViewer.localAccountPersonaNameLabel.text=jLabel1
CallLogArtifactViewer.localAccountPersonaButton.text=jButton1
ContactArtifactViewer.personasLabel.text=Personas

View File

@ -454,11 +454,8 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
if (callLogViewData.getLocalAccountId() != null) {
localAccountIdLabel.setText(callLogViewData.getLocalAccountId());
// kick off a task to find the persona for this account
PersonaSearcherTask task = new PersonaSearcherTask(new AccountPersonaSearcherData(callLogViewData.getLocalAccountId(), localAccountPersonaNameLabel, localAccountPersonaButton));
personaSearchtasks.add(task);
personatasksExecutor.submit(task);
// Get the persona for the local account.
getPersona(new AccountPersonaSearcherData(callLogViewData.getLocalAccountId(), localAccountPersonaNameLabel, localAccountPersonaButton));
} else {
// no local account info, hide all fields.
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.
*
@ -502,7 +528,7 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
* Display a call participant in the view.
*
* @param participantDesignator Label to show - To/From.
* @param accountIdentifier account identifier for the participant.
* @param accountIdentifier account identifier for the participant.
* @param gridBagLayout
* @param constraints
*/
@ -575,13 +601,10 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
constraints.insets = new java.awt.Insets(TOP_INSET, 0, 0, 0);
// Kick off a background thread to search for the persona
// for this particpant account.
PersonaSearcherTask task = new PersonaSearcherTask(new AccountPersonaSearcherData(accountIdentifier, participantPersonaNameLabel, personaButton));
personaSearchtasks.add(task);
personatasksExecutor.submit(task);
// Get the persona for this party, and update the persona name & button.
getPersona(new AccountPersonaSearcherData(accountIdentifier, participantPersonaNameLabel, personaButton));
// add a filler to take up rest of the space
// Add a filler to take up rest of the space
constraints.gridx++;
constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
@ -757,8 +780,8 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
* Extracts the other recipients numbers from the given attribute. Updates
* the given CallLogViewData with the other recipients list.
*
* @param recipientsAttr TO attribute, must not be null.
* @param directionAttr Direction attribute.
* @param recipientsAttr TO attribute, must not be null.
* @param directionAttr Direction attribute.
* @param callLogViewData CallLogViewData object to update.
*
*/
@ -813,9 +836,9 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
* Extract the call time and duration from the artifact and saves in the
* CallLogViewData.
*
* @param artifact Call log artifact.
* @param artifact Call log artifact.
* @param callLogViewData CallLogViewData object to save the time & duration
* in.
* in.
*
* @throws TskCoreException
*/

View File

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