refactor and rename

This commit is contained in:
Greg DiCristofaro 2020-11-20 15:02:24 -05:00
parent 143aabd6e0
commit e6fc2df6da
6 changed files with 35 additions and 68 deletions

View File

@ -45,7 +45,7 @@ public final class Installer extends ModuleInstall {
@Override
public void restored() {
GeolocationSummary summary = GeolocationSummary.getInstance();
WhereUsedSummary summary = WhereUsedSummary.getInstance();
try {
summary.load();
} catch (IOException ex) {

View File

@ -56,7 +56,7 @@ import org.sleuthkit.datamodel.DataSource;
@Messages({
"GeolocationSummary_cities_noRecordFound=Other"
})
public class GeolocationSummary implements DefaultArtifactUpdateGovernor {
public class WhereUsedSummary implements DefaultArtifactUpdateGovernor {
/**
* A count of hits for a particular city.
@ -197,14 +197,14 @@ public class GeolocationSummary implements DefaultArtifactUpdateGovernor {
.map(artifactType -> artifactType.getTypeID())
.collect(Collectors.toSet());
private static GeolocationSummary instance = null;
private static WhereUsedSummary instance = null;
/**
* @return The singleton instance of this class.
*/
public static GeolocationSummary getInstance() {
public static WhereUsedSummary getInstance() {
if (instance == null) {
instance = new GeolocationSummary();
instance = new WhereUsedSummary();
}
return instance;
@ -217,8 +217,8 @@ public class GeolocationSummary implements DefaultArtifactUpdateGovernor {
/**
* Main constructor.
*/
private GeolocationSummary() {
this(SleuthkitCaseProvider.DEFAULT, Logger.getLogger(GeolocationSummary.class.getName()));
private WhereUsedSummary() {
this(SleuthkitCaseProvider.DEFAULT, Logger.getLogger(WhereUsedSummary.class.getName()));
}
/**
@ -226,7 +226,7 @@ public class GeolocationSummary implements DefaultArtifactUpdateGovernor {
*
* @param provider The means of obtaining a sleuthkit case.
*/
public GeolocationSummary(SleuthkitCaseProvider provider, java.util.logging.Logger logger) {
public WhereUsedSummary(SleuthkitCaseProvider provider, java.util.logging.Logger logger) {
this.provider = provider;
this.logger = logger;
}
@ -306,7 +306,7 @@ public class GeolocationSummary implements DefaultArtifactUpdateGovernor {
* Pre-loads city data.
*/
public void load() throws IOException {
latLngMap = new LatLngMap<CityRecord>(parseCsvLines(GeolocationSummary.class.getResourceAsStream("worldcities.csv"), true));
latLngMap = new LatLngMap<CityRecord>(parseCsvLines(WhereUsedSummary.class.getResourceAsStream("worldcities.csv"), true));
}
private static CityRecord OTHER_RECORD = new CityRecord(Bundle.GeolocationSummary_cities_noRecordFound(), "", 0, 0);

View File

@ -42,4 +42,5 @@ RecentFilesPanel.attachmentLabel.text=Recent Attachments
PastCasesPanel.notableFileLabel.text=Cases with Common Items That Were Tagged as Notable
PastCasesPanel.sameIdLabel.text=Past Cases with the Same Device IDs
DataSourceSummaryTabbedPane.noDataSourceLabel.text=No data source has been selected.
GeolocationPanel.cityCountsLabel.text=Cities
WhereUsedPanel.cityCountsLabel.text=Cities
WhereUsedPanel.viewInGeolocationBtn.text=View In Geolocation

View File

@ -39,7 +39,7 @@ import org.sleuthkit.datamodel.DataSource;
"DataSourceSummaryTabbedPane_recentFileTab_title=Recent Files",
"DataSourceSummaryTabbedPane_pastCasesTab_title=Past Cases",
"DataSourceSummaryTabbedPane_analysisTab_title=Analysis",
"DataSourceSummaryTabbedPane_geolocationTab_title=Geolocation"
"DataSourceSummaryTabbedPane_whereUsedTab_title=Where Used"
})
public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
@ -124,7 +124,7 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_analysisTab_title(), new AnalysisPanel()),
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_recentFileTab_title(), new RecentFilesPanel()),
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_pastCasesTab_title(), new PastCasesPanel()),
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_geolocationTab_title(), new GeolocationPanel()),
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_whereUsedTab_title(), new WhereUsedPanel()),
// do nothing on closing
new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_ingestHistoryTab_title(), ingestHistoryPanel, ingestHistoryPanel::setDataSource, () -> {
}),

View File

@ -75,7 +75,7 @@
<Component class="javax.swing.JLabel" name="cityCountsLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/datasourcesummary/ui/Bundle.properties" key="GeolocationPanel.cityCountsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/datasourcesummary/ui/Bundle.properties" key="WhereUsedPanel.cityCountsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<AccessibilityProperties>
@ -128,43 +128,12 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
</Container>
<Component class="javax.swing.Box$Filler" name="filler2">
<Component class="javax.swing.JButton" name="viewInGeolocationBtn">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 20]"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/datasourcesummary/ui/Bundle.properties" key="WhereUsedPanel.viewInGeolocationBtn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 20]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 20]"/>
</Property>
<Property name="alignmentX" type="float" value="0.0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/>
</AuxValues>
</Component>
<Component class="javax.swing.Box$Filler" name="filler3">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 2]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 2]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 2]"/>
</Property>
<Property name="alignmentX" type="float" value="0.0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/>
</AuxValues>
</Component>
<Component class="javax.swing.Box$Filler" name="filler5">
<Properties>

View File

@ -22,9 +22,9 @@ import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.GeolocationSummary;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.GeolocationSummary.CityCount;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.GeolocationSummary.CityRecord;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.WhereUsedSummary;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.WhereUsedSummary.CityCount;
import org.sleuthkit.autopsy.datasourcesummary.datamodel.WhereUsedSummary.CityRecord;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.CellModelTableCellRenderer.DefaultCellModel;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchWorker;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchWorker.DataFetchComponents;
@ -37,11 +37,11 @@ import org.sleuthkit.datamodel.DataSource;
* A tab shown in data source summary displaying information about a data source's geolocation data.
*/
@Messages({
"GeolocationPanel_cityColumn_title=City",
"GeolocationPanel_countColumn_title=Count",
"GeolocationPanel_onNoCrIngest_message=No results will be shown because the GPX Parser was not run."
"WhereUsedPanel_cityColumn_title=City",
"WhereUsedPanel_countColumn_title=Count",
"WhereUsedPanel_onNoCrIngest_message=No results will be shown because the GPX Parser was not run."
})
public class GeolocationPanel extends BaseDataSourceSummaryPanel {
public class WhereUsedPanel extends BaseDataSourceSummaryPanel {
private static final long serialVersionUID = 1L;
private static final String GPX_FACTORY = "org.python.proxies.GPX_Parser_Module$GPXParserFileIngestModuleFactory";
@ -65,13 +65,13 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
}
private static final ColumnModel<CityCount> CITY_COL = new ColumnModel<>(
Bundle.GeolocationPanel_cityColumn_title(),
Bundle.WhereUsedPanel_cityColumn_title(),
(cityCount) -> new DefaultCellModel(getCityName(cityCount.getCityRecord())),
300
);
private static final ColumnModel<CityCount> COUNT_COL = new ColumnModel<>(
Bundle.GeolocationPanel_countColumn_title(),
Bundle.WhereUsedPanel_countColumn_title(),
(cityCount) -> new DefaultCellModel(Integer.toString(cityCount.getCount())),
100
);
@ -93,15 +93,15 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
/**
* Main constructor.
*/
public GeolocationPanel() {
this(GeolocationSummary.getInstance());
public WhereUsedPanel() {
this(WhereUsedSummary.getInstance());
}
/**
* Main constructor.
* @param geolocationData The GeolocationSummary instance to use.
*/
public GeolocationPanel(GeolocationSummary geolocationData) {
public WhereUsedPanel(WhereUsedSummary geolocationData) {
// set up data acquisition methods
dataFetchComponents = Arrays.asList(
new DataFetchWorker.DataFetchComponents<>(
@ -142,8 +142,7 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
javax.swing.JLabel cityCountsLabel = new javax.swing.JLabel();
javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2));
javax.swing.JPanel cityCountsPanel = cityCountsTable;
javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20));
javax.swing.Box.Filler filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2));
viewInGeolocationBtn = new javax.swing.JButton();
javax.swing.Box.Filler filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
mainContentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -155,9 +154,9 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
ingestRunningPanel.setPreferredSize(new java.awt.Dimension(10, 25));
mainContentPanel.add(ingestRunningPanel);
org.openide.awt.Mnemonics.setLocalizedText(cityCountsLabel, org.openide.util.NbBundle.getMessage(GeolocationPanel.class, "GeolocationPanel.cityCountsLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(cityCountsLabel, org.openide.util.NbBundle.getMessage(WhereUsedPanel.class, "WhereUsedPanel.cityCountsLabel.text")); // NOI18N
mainContentPanel.add(cityCountsLabel);
cityCountsLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(GeolocationPanel.class, "PastCasesPanel.notableFileLabel.text")); // NOI18N
cityCountsLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(WhereUsedPanel.class, "PastCasesPanel.notableFileLabel.text")); // NOI18N
filler1.setAlignmentX(0.0F);
mainContentPanel.add(filler1);
@ -168,11 +167,8 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
cityCountsPanel.setPreferredSize(new java.awt.Dimension(100, 212));
mainContentPanel.add(cityCountsPanel);
filler2.setAlignmentX(0.0F);
mainContentPanel.add(filler2);
filler3.setAlignmentX(0.0F);
mainContentPanel.add(filler3);
org.openide.awt.Mnemonics.setLocalizedText(viewInGeolocationBtn, org.openide.util.NbBundle.getMessage(WhereUsedPanel.class, "WhereUsedPanel.viewInGeolocationBtn.text")); // NOI18N
mainContentPanel.add(viewInGeolocationBtn);
filler5.setAlignmentX(0.0F);
mainContentPanel.add(filler5);
@ -193,5 +189,6 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton viewInGeolocationBtn;
// End of variables declaration//GEN-END:variables
}