allow Device Account Type (and filter) in Visualization panel

This commit is contained in:
millmanorama 2018-02-06 13:53:00 +01:00
parent db89695d5d
commit 70997fa7da
3 changed files with 21 additions and 5 deletions

View File

@ -24,6 +24,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.sleuthkit.datamodel.Account;
import org.sleuthkit.datamodel.AccountDeviceInstance; import org.sleuthkit.datamodel.AccountDeviceInstance;
import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsFilter;
import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.CommunicationsManager;
@ -53,8 +54,11 @@ final class AccountDeviceInstanceNodeFactory extends ChildFactory<AccountDeviceI
final List<AccountDeviceInstance> accountDeviceInstancesWithRelationships = final List<AccountDeviceInstance> accountDeviceInstancesWithRelationships =
commsManager.getAccountDeviceInstancesWithRelationships(commsFilter); commsManager.getAccountDeviceInstancesWithRelationships(commsFilter);
for (AccountDeviceInstance accountDeviceInstance : accountDeviceInstancesWithRelationships) { for (AccountDeviceInstance accountDeviceInstance : accountDeviceInstancesWithRelationships) {
long communicationsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, commsFilter); //Filter out device accounts, in the table.
accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter, communicationsCount)); if (Account.Type.DEVICE.equals(accountDeviceInstance.getAccount().getAccountType()) ==false) {
long communicationsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, commsFilter);
accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter, communicationsCount));
}
} }
} catch (TskCoreException tskCoreException) { } catch (TskCoreException tskCoreException) {
logger.log(Level.SEVERE, "Error getting filtered account device instances", tskCoreException); logger.log(Level.SEVERE, "Error getting filtered account device instances", tskCoreException);

View File

@ -57,6 +57,7 @@ public final class CVTTopComponent extends TopComponent {
browseVisualizeTabPane.addChangeListener(changeEvent -> { browseVisualizeTabPane.addChangeListener(changeEvent -> {
Lookup.Provider selectedComponent = (Lookup.Provider) browseVisualizeTabPane.getSelectedComponent(); Lookup.Provider selectedComponent = (Lookup.Provider) browseVisualizeTabPane.getSelectedComponent();
proxyLookup.changeLookups(selectedComponent.getLookup()); proxyLookup.changeLookups(selectedComponent.getLookup());
filtersPane.setDeviceAccountTypeEnabled(browseVisualizeTabPane.getSelectedIndex() != 0);
}); });

View File

@ -78,6 +78,7 @@ final public class FiltersPanel extends JPanel {
* results) * results)
*/ */
private final ItemListener validationListener; private final ItemListener validationListener;
private boolean deviceAccountTypeEnabled = false;
@NbBundle.Messages({"refreshText=Refresh Results", @NbBundle.Messages({"refreshText=Refresh Results",
"applyText=Apply"}) "applyText=Apply"})
@ -196,8 +197,8 @@ final public class FiltersPanel extends JPanel {
Account.Type.PREDEFINED_ACCOUNT_TYPES.forEach(type -> { Account.Type.PREDEFINED_ACCOUNT_TYPES.forEach(type -> {
if (type.equals(Account.Type.CREDIT_CARD)) { if (type.equals(Account.Type.CREDIT_CARD)) {
//don't show a check box for credit cards //don't show a check box for credit cards
} else if (type.equals(Account.Type.DEVICE)) { // } else if (type.equals(Account.Type.DEVICE)) {
//don't show a check box fro device // //don't show a check box fro device
} else { } else {
accountTypeMap.computeIfAbsent(type, t -> { accountTypeMap.computeIfAbsent(type, t -> {
final JCheckBox jCheckBox = new JCheckBox( final JCheckBox jCheckBox = new JCheckBox(
@ -209,6 +210,9 @@ final public class FiltersPanel extends JPanel {
); );
jCheckBox.addItemListener(validationListener); jCheckBox.addItemListener(validationListener);
accountTypePane.add(jCheckBox); accountTypePane.add(jCheckBox);
if (t.equals(Account.Type.DEVICE)) {
jCheckBox.setEnabled(deviceAccountTypeEnabled);
}
return jCheckBox; return jCheckBox;
}); });
} }
@ -485,7 +489,7 @@ final public class FiltersPanel extends JPanel {
validateFilters(); validateFilters();
} }
private CommunicationsFilter getFilter() { private CommunicationsFilter getFilter() {
CommunicationsFilter commsFilter = new CommunicationsFilter(); CommunicationsFilter commsFilter = new CommunicationsFilter();
commsFilter.addAndFilter(getDeviceFilter()); commsFilter.addAndFilter(getDeviceFilter());
commsFilter.addAndFilter(getAccountTypeFilter()); commsFilter.addAndFilter(getAccountTypeFilter());
@ -618,4 +622,11 @@ final public class FiltersPanel extends JPanel {
private final javax.swing.JButton unCheckAllDevicesButton = new javax.swing.JButton(); private final javax.swing.JButton unCheckAllDevicesButton = new javax.swing.JButton();
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
void setDeviceAccountTypeEnabled(boolean enableDeviceAccountType) {
deviceAccountTypeEnabled = enableDeviceAccountType;
JCheckBox deviceCheckbox = accountTypeMap.get(Account.Type.DEVICE);
if (deviceCheckbox != null) {
deviceCheckbox.setEnabled(deviceAccountTypeEnabled);
}
}
} }