mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-01 23:09:56 +00:00
rename AccountUtils to Utils, add Utils.getUserPreferredZoneId() method
This commit is contained in:
@@ -89,7 +89,7 @@ class AccountsRootChildren extends Children.Keys<AccountDeviceInstanceKey> {
|
||||
this.commsManager = commsManager;
|
||||
this.filter = accountDeviceInstanceKey.getCommunicationsFilter();
|
||||
setName(accountDeviceInstance.getAccount().getAccountUniqueID());
|
||||
setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + AccountUtils.getIconFileName(accountDeviceInstance.getAccount().getAccountType()));
|
||||
setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + Utils.getIconFileName(accountDeviceInstance.getAccount().getAccountType()));
|
||||
}
|
||||
|
||||
public AccountDeviceInstance getAccountDeviceInstance() {
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.communications;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,7 +30,6 @@ import javax.swing.JCheckBox;
|
||||
import org.openide.explorer.ExplorerManager;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||
import org.sleuthkit.datamodel.Account;
|
||||
@@ -77,7 +75,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
dateRangeLabel.setText("Date Range ( " + (UserPreferences.displayTimesInLocalTime() ? ZoneId.systemDefault().getId() : ZoneOffset.UTC.getId()) + "):");
|
||||
dateRangeLabel.setText("Date Range ( " + (Utils.getUserPreferredZoneId().getId() + "):");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +109,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
|
||||
final JCheckBox jCheckBox = new JCheckBox(
|
||||
"<html><table cellpadding=0><tr><td><img src=\""
|
||||
+ FiltersPanel.class.getResource("/org/sleuthkit/autopsy/communications/images/"
|
||||
+ AccountUtils.getIconFileName(type))
|
||||
+ Utils.getIconFileName(type))
|
||||
+ "\"/></td><td width=" + 3 + "><td>" + type.getDisplayName() + "</td></tr></table></html>",
|
||||
true
|
||||
);
|
||||
@@ -419,7 +417,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
private DateRangeFilter getDateRangeFilter() {
|
||||
ZoneId zone = UserPreferences.displayTimesInLocalTime() ? ZoneId.systemDefault() : ZoneOffset.UTC;
|
||||
ZoneId zone = Utils.getUserPreferredZoneId();
|
||||
long start = startDatePicker.isEnabled() ? startDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0;
|
||||
long end = endDatePicker.isEnabled() ? endDatePicker.getDate().atStartOfDay(zone).toEpochSecond() : 0;
|
||||
return new DateRangeFilter(start, end);
|
||||
|
||||
@@ -18,13 +18,10 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.communications;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
|
||||
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||
@@ -39,6 +36,7 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMA
|
||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM;
|
||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
|
||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT;
|
||||
import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME;
|
||||
import org.sleuthkit.datamodel.TimeUtilities;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
@@ -122,9 +120,9 @@ public class RelationShipNode extends BlackboardArtifactNode {
|
||||
BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attributeType.getTypeID())));
|
||||
if (attribute == null) {
|
||||
return "";
|
||||
} else if (attributeType.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
|
||||
ZoneId zone = UserPreferences.displayTimesInLocalTime() ? ZoneOffset.systemDefault() : ZoneOffset.UTC;
|
||||
return TimeUtilities.epochToTime(attribute.getValueLong(), TimeZone.getTimeZone(zone));
|
||||
} else if (attributeType.getValueType() == DATETIME) {
|
||||
return TimeUtilities.epochToTime(attribute.getValueLong(),
|
||||
TimeZone.getTimeZone(Utils.getUserPreferredZoneId()));
|
||||
} else {
|
||||
return attribute.getDisplayString();
|
||||
}
|
||||
@@ -133,4 +131,5 @@ public class RelationShipNode extends BlackboardArtifactNode {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-2
@@ -18,14 +18,22 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.communications;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
import org.sleuthkit.datamodel.Account;
|
||||
|
||||
/**
|
||||
* Utility class with helpers for dealing with accounts.
|
||||
*/
|
||||
class AccountUtils {
|
||||
class Utils {
|
||||
|
||||
private AccountUtils() {
|
||||
static ZoneId getUserPreferredZoneId() {
|
||||
ZoneId zone = UserPreferences.displayTimesInLocalTime() ? ZoneOffset.systemDefault() : ZoneOffset.UTC;
|
||||
return zone;
|
||||
}
|
||||
|
||||
private Utils() {
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user