1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-09-04 06:50:00 +00:00

inline method

This commit is contained in:
millmanorama
2017-12-02 16:17:35 +01:00
parent d27d13ba68
commit 63174e0dfc
3 changed files with 19 additions and 31 deletions

View File

@@ -127,17 +127,15 @@ class AccountsRootChildren extends ChildFactory<AccountDeviceInstanceKey> {
private String getDataSourceName() {
try {
final SleuthkitCase sleuthkitCase = Case.getCurrentCase()
.getSleuthkitCase();
List<DataSource> dataSources = sleuthkitCase.getDataSources();
for (DataSource dataSource : dataSources) {
final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
if (dataSource.getDeviceId().equals(getAccountDeviceInstance().getDeviceId())) {
return sleuthkitCase.getContentById(dataSource.getId()).getName();
}
}
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting datasource name, falling back on device ID.", ex);
}
logger.log(Level.SEVERE, "Error getting datasource name, falling back on device ID.", ex);
}
return getAccountDeviceInstance().getDeviceId();
}
}

View File

@@ -30,7 +30,6 @@
</Group>
<Component id="jPanel4" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -70,15 +69,15 @@
</Component>
<Component class="javax.swing.JLabel" name="filtersTitleLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="16" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/communications/images/funnel.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="FiltersPanel.filtersTitleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="16" style="0"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
@@ -97,7 +96,7 @@
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jScrollPane3" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="0" pref="115" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="unCheckAllAccountTypesButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkAllAccountTypesButton" min="-2" max="-2" attributes="0"/>
@@ -182,7 +181,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="115" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="unCheckAllDevicesButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkAllDevicesButton" min="-2" max="-2" attributes="0"/>

View File

@@ -48,7 +48,6 @@ import org.sleuthkit.datamodel.CommunicationsFilter.DeviceFilter;
import org.sleuthkit.datamodel.CommunicationsManager;
import org.sleuthkit.datamodel.DataSource;
import static org.sleuthkit.datamodel.Relationship.Type.CALL_LOG;
import org.sleuthkit.datamodel.SleuthkitCase;
import static org.sleuthkit.datamodel.Relationship.Type.MESSAGE;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
@@ -188,9 +187,8 @@ final public class FiltersPanel extends javax.swing.JPanel {
final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
String dsName = getDataSourceName(sleuthkitCase, dataSource);
//store the device id in the map, but display the datasource name in the UI.
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
//store the device id in the map, but display a datasource name in the UI.
devicesMap.computeIfAbsent(dataSource.getDeviceId(), ds -> {
final JCheckBox jCheckBox = new JCheckBox(dsName, false);
devicesPane.add(jCheckBox);
@@ -205,14 +203,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
}
}
private String getDataSourceName(SleuthkitCase sleuthkitCase, DataSource dataSource) {
try {
return sleuthkitCase.getContentById(dataSource.getId()).getName();
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting datasource name, falling back on device ID.", ex);
}
return dataSource.getDeviceId();
}
/**
* This method is called from within the constructor to initialize the form.
@@ -227,9 +217,9 @@ final public class FiltersPanel extends javax.swing.JPanel {
applyFiltersButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.applyFiltersButton.text")); // NOI18N
applyFiltersButton.setPreferredSize(null);
filtersTitleLabel.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
filtersTitleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/funnel.png"))); // NOI18N
filtersTitleLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.filtersTitleLabel.text")); // NOI18N
filtersTitleLabel.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
unCheckAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllAccountTypesButton.text")); // NOI18N
unCheckAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() {
@@ -265,7 +255,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane3)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 115, Short.MAX_VALUE)
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(unCheckAllAccountTypesButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkAllAccountTypesButton)))))
@@ -318,7 +308,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(0, 115, Short.MAX_VALUE)
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(unCheckAllDevicesButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkAllDevicesButton))
@@ -409,8 +399,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
.addComponent(applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(refreshButton))
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -458,9 +447,11 @@ final public class FiltersPanel extends javax.swing.JPanel {
* @return a DeviceFilter
*/
private DeviceFilter getDeviceFilter() {
DeviceFilter deviceFilter = new DeviceFilter(devicesMap.entrySet().stream()
DeviceFilter deviceFilter = new DeviceFilter(
devicesMap.entrySet().stream()
.filter(entry -> entry.getValue().isSelected())
.map(Entry::getKey).collect(Collectors.toSet()));
.map(Entry::getKey)
.collect(Collectors.toSet()));
return deviceFilter;
}