diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java index eec27f30e5..40cb15d27d 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java @@ -52,7 +52,7 @@ final class AccountDeviceInstanceNode extends AbstractNode { this.account = accountDeviceInstanceKey.getAccountDeviceInstance().getAccount(); setName(account.getTypeSpecificID()); setDisplayName(getName()); - setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + Utils.getIconFileName(account.getAccountType())); + setIconBaseWithExtension(Utils.getIconFilePath(account.getAccountType())); } AccountDeviceInstance getAccountDeviceInstance() { diff --git a/Core/src/org/sleuthkit/autopsy/communications/CommunicationsGraph.java b/Core/src/org/sleuthkit/autopsy/communications/CommunicationsGraph.java index 1a64f10c47..07f11a07ac 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CommunicationsGraph.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CommunicationsGraph.java @@ -168,8 +168,7 @@ final class CommunicationsGraph extends mxGraph { scopes.put("accountName", adiKey.getAccountDeviceInstance().getAccount().getTypeSpecificID()); scopes.put("size", Math.round(Math.log(adiKey.getMessageCount()) + 5)); - scopes.put("iconFileName", CommunicationsGraph.class.getResource("/org/sleuthkit/autopsy/communications/images/" - + Utils.getIconFileName(adiKey.getAccountDeviceInstance().getAccount().getAccountType()))); + scopes.put("iconFileName", CommunicationsGraph.class.getResource( Utils.getIconFilePath(adiKey.getAccountDeviceInstance().getAccount().getAccountType()))); scopes.put("pinned", pinnedAccountModel.isAccountPinned(adiKey)); scopes.put("MARKER_PIN_URL", MARKER_PIN_URL); scopes.put("locked", lockedVertexModel.isVertexLocked((mxCell) cell)); @@ -194,8 +193,7 @@ final class CommunicationsGraph extends mxGraph { scopes.put("accountName", adiKey.getAccountDeviceInstance().getAccount().getTypeSpecificID()); scopes.put("relationships", 12);// Math.round(Math.log(adiKey.getMessageCount()) + 5)); - scopes.put("iconFileName", CommunicationsGraph.class.getResource("/org/sleuthkit/autopsy/communications/images/" - + Utils.getIconFileName(adiKey.getAccountDeviceInstance().getAccount().getAccountType()))); + scopes.put("iconFileName", CommunicationsGraph.class.getResource( Utils.getIconFilePath(adiKey.getAccountDeviceInstance().getAccount().getAccountType()))); scopes.put("pinned", pinnedAccountModel.isAccountPinned(adiKey)); scopes.put("MARKER_PIN_URL", MARKER_PIN_URL); scopes.put("locked", lockedVertexModel.isVertexLocked((mxCell) cell)); diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form index 25153de997..eca450180a 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form @@ -244,7 +244,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java index f9031af04a..df898f0b8a 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java @@ -218,8 +218,7 @@ final public class FiltersPanel extends JPanel { accountTypeMap.computeIfAbsent(type, t -> { final JCheckBox jCheckBox = new JCheckBox( "
" + type.getDisplayName() + "
", true ); @@ -343,7 +342,7 @@ final public class FiltersPanel extends JPanel { } }); - devicesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/image.png"))); // NOI18N + devicesLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png"))); // NOI18N devicesLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.devicesLabel.text")); // NOI18N checkAllDevicesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.checkAllDevicesButton.text")); // NOI18N diff --git a/Core/src/org/sleuthkit/autopsy/communications/Utils.java b/Core/src/org/sleuthkit/autopsy/communications/Utils.java index 91ee1e9fdf..b155e3b4b4 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/Utils.java +++ b/Core/src/org/sleuthkit/autopsy/communications/Utils.java @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.communications; import java.time.ZoneId; import java.time.ZoneOffset; import org.sleuthkit.autopsy.core.UserPreferences; +import org.sleuthkit.autopsy.datamodel.accounts.Accounts; import org.sleuthkit.datamodel.Account; /** @@ -37,36 +38,12 @@ class Utils { } /** - * The file name of the icon for the given Account Type. Will not include - * the path but will include the extension. + * Get the path of the icon for the given Account Type. * - * @return The file name of the icon for the given Account Type. + * @return The path of the icon for the given Account Type. */ - static final String getIconFileName(Account.Type type) { - if (type.equals(Account.Type.CREDIT_CARD)) { - return "credit-card.png"; - } else if (type.equals(Account.Type.DEVICE)) { - return "image.png"; - } else if (type.equals(Account.Type.EMAIL)) { - return "email.png"; - } else if (type.equals(Account.Type.FACEBOOK)) { - return "facebook.png"; - } else if (type.equals(Account.Type.INSTAGRAM)) { - return "instagram.png"; - } else if (type.equals(Account.Type.MESSAGING_APP)) { - return "messaging.png"; - } else if (type.equals(Account.Type.PHONE)) { - return "phone.png"; - } else if (type.equals(Account.Type.TWITTER)) { - return "twitter.png"; - } else if (type.equals(Account.Type.WEBSITE)) { - return "web-file.png"; - } else if (type.equals(Account.Type.WHATSAPP)) { - return "WhatsApp.png"; - } else { - //there could be a default icon instead... - throw new IllegalArgumentException("Unknown Account.Type: " + type.getTypeName()); - } + static final String getIconFilePath(Account.Type type) { + return Accounts.getIconFilePath(type); } } diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/calllog.png b/Core/src/org/sleuthkit/autopsy/communications/images/calllog.png deleted file mode 100644 index 83eb9c448d..0000000000 Binary files a/Core/src/org/sleuthkit/autopsy/communications/images/calllog.png and /dev/null differ diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/credit-card.png b/Core/src/org/sleuthkit/autopsy/communications/images/credit-card.png deleted file mode 100644 index e8d6624d76..0000000000 Binary files a/Core/src/org/sleuthkit/autopsy/communications/images/credit-card.png and /dev/null differ diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/image.png b/Core/src/org/sleuthkit/autopsy/communications/images/image.png deleted file mode 100644 index a0fbfcfb79..0000000000 Binary files a/Core/src/org/sleuthkit/autopsy/communications/images/image.png and /dev/null differ diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/web-file.png b/Core/src/org/sleuthkit/autopsy/communications/images/web-file.png deleted file mode 100644 index ac5957ad62..0000000000 Binary files a/Core/src/org/sleuthkit/autopsy/communications/images/web-file.png and /dev/null differ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java index b3e8a9a1b1..203ca38a70 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +54,6 @@ import org.openide.nodes.Node; import org.openide.nodes.NodeNotFoundException; import org.openide.nodes.NodeOp; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.lookup.Lookups; @@ -73,7 +72,6 @@ import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Account; -import org.sleuthkit.datamodel.AccountFileInstance; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -89,6 +87,7 @@ import org.sleuthkit.datamodel.TskData.DbType; final public class Accounts implements AutopsyVisitableItem { private static final Logger LOGGER = Logger.getLogger(Accounts.class.getName()); + private static final String iconBasePath = "/org/sleuthkit/autopsy/images/"; //NON-NLS @NbBundle.Messages("AccountsRootNode.name=Accounts") final public static String NAME = Bundle.AccountsRootNode_name(); @@ -126,7 +125,7 @@ final public class Accounts implements AutopsyVisitableItem { * results from db queries. * * @return A clause that will or will not filter out rejected artifacts - * based on the state of showRejected. + * based on the state of showRejected. */ private String getRejectedArtifactFilterClause() { return showRejected ? " " : " AND blackboard_artifacts.review_status_id != " + BlackboardArtifact.ReviewStatus.REJECTED.getID() + " "; //NON-NLS @@ -137,7 +136,7 @@ final public class Accounts implements AutopsyVisitableItem { * or off. * * @return An Action that will toggle whether rejected artifacts are shown - * in the tree rooted by this Accounts instance. + * in the tree rooted by this Accounts instance. */ public Action newToggleShowRejectedAction() { return new ToggleShowRejected(); @@ -225,8 +224,8 @@ final public class Accounts implements AutopsyVisitableItem { private class AccountTypeFactory extends ObservingChildren { /* - * The pcl is in this class because it has the easiest mechanisms to - * add and remove itself during its life cycles. + * The pcl is in this class because it has the easiest mechanisms to add + * and remove itself during its life cycles. */ private final PropertyChangeListener pcl = new PropertyChangeListener() { @Override @@ -310,23 +309,21 @@ final public class Accounts implements AutopsyVisitableItem { } @Override - protected Node[] createNodesForKey(String key) { + protected Node[] createNodesForKey(String acountTypeName) { - String accountType = key; - if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) { + if (Account.Type.CREDIT_CARD.getTypeName().equals(acountTypeName)) { return new Node[]{new CreditCardNumberAccountTypeNode()}; } else { - String accountTypeDisplayname; + try { - accountTypeDisplayname = skCase.getCommunicationsManager().getAccountType(accountType).getDisplayName(); + Account.Type accountType = skCase.getCommunicationsManager().getAccountType(acountTypeName); + return new Node[]{new DefaultAccountTypeNode(accountType)}; } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error getting display name for account type. ", ex); - accountTypeDisplayname = accountType; } - return new Node[]{new DefaultAccountTypeNode(key, accountTypeDisplayname)}; + return new Node[]{}; } - } @Override @@ -350,10 +347,10 @@ final public class Accounts implements AutopsyVisitableItem { final private class DefaultAccountFactory extends ObservingChildren { - private final String accountTypeName; + private final Account.Type accountType; - private DefaultAccountFactory(String accountTypeName) { - this.accountTypeName = accountTypeName; + private DefaultAccountFactory(Account.Type accountType) { + this.accountType = accountType; } private final PropertyChangeListener pcl = new PropertyChangeListener() { @@ -424,13 +421,13 @@ final public class Accounts implements AutopsyVisitableItem { @Override protected boolean createKeys(List list) { - String query - = "SELECT blackboard_artifacts.artifact_id " //NON-NLS + String query = + "SELECT blackboard_artifacts.artifact_id " //NON-NLS + " FROM blackboard_artifacts " //NON-NLS + " JOIN blackboard_attributes ON blackboard_artifacts.artifact_id = blackboard_attributes.artifact_id " //NON-NLS + " WHERE blackboard_artifacts.artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID() //NON-NLS + " AND blackboard_attributes.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID() //NON-NLS - + " AND blackboard_attributes.value_text = '" + accountTypeName + "'" //NON-NLS + + " AND blackboard_attributes.value_text = '" + accountType.getTypeName() + "'" //NON-NLS + getRejectedArtifactFilterClause(); //NON-NLS try (SleuthkitCase.CaseDbQuery results = skCase.executeQuery(query); ResultSet rs = results.getResultSet();) { @@ -473,10 +470,10 @@ final public class Accounts implements AutopsyVisitableItem { */ final public class DefaultAccountTypeNode extends DisplayableItemNode { - private DefaultAccountTypeNode(String accountTypeName, String accountTypeDisplayName) { - super(Children.create(new DefaultAccountFactory(accountTypeName), true), Lookups.singleton(accountTypeDisplayName)); - setName(accountTypeDisplayName); - this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/credit-cards.png"); //NON-NLS + private DefaultAccountTypeNode(Account.Type accountType) { + super(Children.create(new DefaultAccountFactory(accountType), true), Lookups.singleton(accountType)); + setName(accountType.getDisplayName()); + this.setIconBaseWithExtension(getIconFilePath(accountType)); //NON-NLS } @Override @@ -1161,13 +1158,13 @@ final public class Accounts implements AutopsyVisitableItem { * take the result of a group_concat SQLite operation and split it into a * set of X using the mapper to to convert from string to X * - * @param the type of elements to return + * @param the type of elements to return * @param groupConcat a string containing the group_concat result ( a comma - * separated list) - * @param mapper a function from String to X + * separated list) + * @param mapper a function from String to X * * @return a Set of X, each element mapped from one element of the original - * comma delimited string + * comma delimited string */ static List unGroupConcat(String groupConcat, Function mapper) { return StringUtils.isBlank(groupConcat) ? Collections.emptyList() @@ -1187,8 +1184,8 @@ final public class Accounts implements AutopsyVisitableItem { /** * Constructor * - * @param key The FileWithCCN that backs this node. - * @param content The Content object the key represents. + * @param key The FileWithCCN that backs this node. + * @param content The Content object the key represents. * @param lookupContents The contents of this Node's lookup. It should * contain the content object and the account artifacts. */ @@ -1465,11 +1462,11 @@ final public class Accounts implements AutopsyVisitableItem { } return sheet; } - + private void updateSheet() { this.setSheet(createSheet()); } - + } /** @@ -1601,7 +1598,7 @@ final public class Accounts implements AutopsyVisitableItem { super(artifact, "org/sleuthkit/autopsy/images/credit-card.png"); //NON-NLS this.artifact = artifact; setName("" + this.artifact.getArtifactID()); - + reviewStatusBus.register(this); } @@ -1628,13 +1625,13 @@ final public class Accounts implements AutopsyVisitableItem { Bundle.Accounts_FileWithCCNNode_statusProperty_displayName(), Bundle.Accounts_FileWithCCNNode_noDescription(), artifact.getReviewStatus().getDisplayName())); - + return sheet; } - + @Subscribe void handleReviewStatusChange(ReviewStatusChangeEvent event) { - + // Update the node if event includes this artifact event.artifacts.stream().filter((art) -> (art.getArtifactID() == this.artifact.getArtifactID())).map((_item) -> { return _item; @@ -1642,11 +1639,11 @@ final public class Accounts implements AutopsyVisitableItem { updateSheet(); }); } - + private void updateSheet() { this.setSheet(createSheet()); } - + } private final class ToggleShowRejected extends AbstractAction { @@ -1755,14 +1752,47 @@ final public class Accounts implements AutopsyVisitableItem { } } - private class ReviewStatusChangeEvent { + static private class ReviewStatusChangeEvent { Collection artifacts; BlackboardArtifact.ReviewStatus newReviewStatus; - public ReviewStatusChangeEvent(Collection artifacts, BlackboardArtifact.ReviewStatus newReviewStatus) { + ReviewStatusChangeEvent(Collection artifacts, BlackboardArtifact.ReviewStatus newReviewStatus) { this.artifacts = artifacts; this.newReviewStatus = newReviewStatus; } } + + /** + * Get the path of the icon for the given Account Type. + * + * @return The path of the icon for the given Account Type. + */ + public static String getIconFilePath(Account.Type type) { + + if (type.equals(Account.Type.CREDIT_CARD)) { + return iconBasePath + "credit-card.png"; + } else if (type.equals(Account.Type.DEVICE)) { + return iconBasePath + "image.png"; + } else if (type.equals(Account.Type.EMAIL)) { + return iconBasePath + "email.png"; + } else if (type.equals(Account.Type.FACEBOOK)) { + return iconBasePath + "facebook.png"; + } else if (type.equals(Account.Type.INSTAGRAM)) { + return iconBasePath + "instagram.png"; + } else if (type.equals(Account.Type.MESSAGING_APP)) { + return iconBasePath + "messaging.png"; + } else if (type.equals(Account.Type.PHONE)) { + return iconBasePath + "phone.png"; + } else if (type.equals(Account.Type.TWITTER)) { + return iconBasePath + "twitter.png"; + } else if (type.equals(Account.Type.WEBSITE)) { + return iconBasePath + "web-file.png"; + } else if (type.equals(Account.Type.WHATSAPP)) { + return iconBasePath + "WhatsApp.png"; + } else { + //there could be a default icon instead... + throw new IllegalArgumentException("Unknown Account.Type: " + type.getTypeName()); + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/WhatsApp.png b/Core/src/org/sleuthkit/autopsy/images/WhatsApp.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/WhatsApp.png rename to Core/src/org/sleuthkit/autopsy/images/WhatsApp.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/email.png b/Core/src/org/sleuthkit/autopsy/images/email.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/email.png rename to Core/src/org/sleuthkit/autopsy/images/email.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/facebook.png b/Core/src/org/sleuthkit/autopsy/images/facebook.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/facebook.png rename to Core/src/org/sleuthkit/autopsy/images/facebook.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/instagram.png b/Core/src/org/sleuthkit/autopsy/images/instagram.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/instagram.png rename to Core/src/org/sleuthkit/autopsy/images/instagram.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/messaging.png b/Core/src/org/sleuthkit/autopsy/images/messaging.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/messaging.png rename to Core/src/org/sleuthkit/autopsy/images/messaging.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/phone.png b/Core/src/org/sleuthkit/autopsy/images/phone.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/phone.png rename to Core/src/org/sleuthkit/autopsy/images/phone.png diff --git a/Core/src/org/sleuthkit/autopsy/communications/images/twitter.png b/Core/src/org/sleuthkit/autopsy/images/twitter.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/communications/images/twitter.png rename to Core/src/org/sleuthkit/autopsy/images/twitter.png