Merge pull request #7156 from kellykelly3/7838-cvt-summaryviewer-setselectioningo

7838 - CVT SummaryViewer - Moved db calls into existing SwingWorker
This commit is contained in:
Richard Cordovano 2021-08-04 16:26:31 -04:00 committed by GitHub
commit c3797fb36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 23 deletions

View File

@ -59,6 +59,7 @@ SummaryViewer_Device_Account_Description=This account was referenced by a device
SummaryViewer_Fetching_References=<Fetching File References> SummaryViewer_Fetching_References=<Fetching File References>
SummaryViewer_FileRef_Message=<Select a single account to see File References> SummaryViewer_FileRef_Message=<Select a single account to see File References>
SummaryViewer_FileRefNameColumn_Title=Path SummaryViewer_FileRefNameColumn_Title=Path
SummaryViewer_loading_count_message=Loading....
SummaryViewer_Persona_CR_Message=<Enable Central Repository to view Personas> SummaryViewer_Persona_CR_Message=<Enable Central Repository to view Personas>
SummaryViewer_Select_account_for_persona=<Select a single account to see Persona(s)> SummaryViewer_Select_account_for_persona=<Select a single account to see Persona(s)>
SummaryViewer_TabTitle=Summary SummaryViewer_TabTitle=Summary

View File

@ -43,10 +43,12 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName()); private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName());
private final Account account; private final Account account;
private final SelectionInfo selectionInfo;
// Construct a instance // Construct a instance
SummaryPanelWorker(Account account) { SummaryPanelWorker(SelectionInfo selectionInfo, Account account) {
this.account = account; this.account = account;
this.selectionInfo = selectionInfo;
} }
/** /**
@ -90,7 +92,7 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
} }
} }
return new SummaryWorkerResults(stringList, personaList, crAccount); return new SummaryWorkerResults(stringList, personaList, crAccount, new AccountSummary(account, selectionInfo.getArtifacts()));
} }
/** /**
@ -102,6 +104,7 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
private final List<String> accountFileInstancePaths; private final List<String> accountFileInstancePaths;
private final List<Persona> personaList; private final List<Persona> personaList;
private final CentralRepoAccount centralRepoAccount; private final CentralRepoAccount centralRepoAccount;
private final AccountSummary accountSummary;
/** /**
* Constructor. * Constructor.
@ -112,10 +115,11 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
* account, maybe null if CR is not * account, maybe null if CR is not
* enabled. * enabled.
*/ */
SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount) { SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount, AccountSummary accountSummary) {
this.accountFileInstancePaths = accountFileInstancePaths; this.accountFileInstancePaths = accountFileInstancePaths;
this.personaList = personaList; this.personaList = personaList;
this.centralRepoAccount = centralRepoAccount; this.centralRepoAccount = centralRepoAccount;
this.accountSummary = accountSummary;
} }
/** /**
@ -148,6 +152,10 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
CentralRepoAccount getCRAccount() { CentralRepoAccount getCRAccount() {
return centralRepoAccount; return centralRepoAccount;
} }
AccountSummary getAccountSummary() {
return accountSummary;
}
} }
} }

View File

@ -51,6 +51,8 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
private static final Logger logger = Logger.getLogger(SummaryViewer.class.getName()); private static final Logger logger = Logger.getLogger(SummaryViewer.class.getName());
private SummaryPanelWorker worker;
@Messages({ @Messages({
"SummaryViewer_TabTitle=Summary", "SummaryViewer_TabTitle=Summary",
"SummaryViewer_FileRefNameColumn_Title=Path", "SummaryViewer_FileRefNameColumn_Title=Path",
@ -62,7 +64,8 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
"SummaryViewer_Account_Description=This account represents a device in the case.", "SummaryViewer_Account_Description=This account represents a device in the case.",
"SummaryViewer_Account_Description_MuliSelect=Summary information is not available when multiple accounts are selected.", "SummaryViewer_Account_Description_MuliSelect=Summary information is not available when multiple accounts are selected.",
"SummaryViewer_Country_Code=Country: ", "SummaryViewer_Country_Code=Country: ",
"SummaryViewer_Select_account_for_persona=<Select a single account to see Persona(s)>" "SummaryViewer_Select_account_for_persona=<Select a single account to see Persona(s)>",
"SummaryViewer_loading_count_message=Loading...."
}) })
/** /**
@ -85,8 +88,8 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
clearControls(); clearControls();
caseReferencesPanel.hideOutlineView(Bundle.SummaryViewer_CentralRepository_Message()); caseReferencesPanel.hideOutlineView(Bundle.SummaryViewer_CentralRepository_Message());
((SummaryPersonaPane)personaPanel).setMessage(Bundle.SummaryViewer_Select_account_for_persona()); ((SummaryPersonaPane) personaPanel).setMessage(Bundle.SummaryViewer_Select_account_for_persona());
((SummaryPersonaPane)personaPanel).showMessagePanel(); ((SummaryPersonaPane) personaPanel).showMessagePanel();
} }
@Override @Override
@ -143,19 +146,17 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
accoutDescriptionLabel.setText(Bundle.SummaryViewer_Device_Account_Description()); accoutDescriptionLabel.setText(Bundle.SummaryViewer_Device_Account_Description());
} }
AccountSummary summaryDetails = new AccountSummary(account, info.getArtifacts()); thumbnailsDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
callLogsDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
thumbnailsDataLabel.setText(Integer.toString(summaryDetails.getThumbnailCnt())); contactsDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
callLogsDataLabel.setText(Integer.toString(summaryDetails.getCallLogCnt())); messagesDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt())); attachmentDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
messagesDataLabel.setText(Integer.toString(summaryDetails.getMessagesCnt() + summaryDetails.getEmailCnt())); referencesDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
attachmentDataLabel.setText(Integer.toString(summaryDetails.getAttachmentCnt())); contactsDataLabel.setText(Bundle.SummaryViewer_loading_count_message());
referencesDataLabel.setText(Integer.toString(summaryDetails.getReferenceCnt()));
contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt()));
caseReferencesPanel.setNode(new AbstractNode(Children.create(new CorrelationCaseChildNodeFactory(info.getAccounts()), true))); caseReferencesPanel.setNode(new AbstractNode(Children.create(new CorrelationCaseChildNodeFactory(info.getAccounts()), true)));
updateOtherAccountInfo(account); updateOtherAccountInfo(info, account);
setEnabled(true); setEnabled(true);
} }
@ -207,10 +208,18 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
"SummaryViewer_Fetching_References=<Fetching File References>", "SummaryViewer_Fetching_References=<Fetching File References>",
"SummaryViewer_Persona_CR_Message=<Enable Central Repository to view Personas>" "SummaryViewer_Persona_CR_Message=<Enable Central Repository to view Personas>"
}) })
private void updateOtherAccountInfo(final Account account) { private void updateOtherAccountInfo(SelectionInfo info, Account account) {
SummaryPanelWorker worker = new SummaryPanelWorker(account) { if (worker != null) {
worker.cancel(true);
}
worker = new SummaryPanelWorker(info, account) {
@Override @Override
protected void done() { protected void done() {
if (isCancelled()) {
return;
}
try { try {
SummaryPanelWorker.SummaryWorkerResults results = get(); SummaryPanelWorker.SummaryWorkerResults results = get();
@ -234,6 +243,14 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi
((SummaryPersonaPane) personaPanel).showMessagePanel(); ((SummaryPersonaPane) personaPanel).showMessagePanel();
} }
AccountSummary summaryDetails = results.getAccountSummary();
thumbnailsDataLabel.setText(Integer.toString(summaryDetails.getThumbnailCnt()));
callLogsDataLabel.setText(Integer.toString(summaryDetails.getCallLogCnt()));
contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt()));
messagesDataLabel.setText(Integer.toString(summaryDetails.getMessagesCnt() + summaryDetails.getEmailCnt()));
attachmentDataLabel.setText(Integer.toString(summaryDetails.getAttachmentCnt()));
referencesDataLabel.setText(Integer.toString(summaryDetails.getReferenceCnt()));
contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt()));
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.WARNING, String.format(("Failed to get data for account: %d"), account.getAccountID()), ex); logger.log(Level.WARNING, String.format(("Failed to get data for account: %d"), account.getAccountID()), ex);