refactoring

This commit is contained in:
Greg DiCristofaro 2021-10-08 17:06:44 -04:00
parent 9a153d5beb
commit cdf6eafbf7
20 changed files with 184 additions and 87 deletions

View File

@ -44,7 +44,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResult;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo;
import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode; import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode;
import org.sleuthkit.autopsy.mainui.datamodel.ThreePanelDAO; import org.sleuthkit.autopsy.mainui.datamodel.MainDAO;
import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO;
/** /**

View File

@ -45,11 +45,11 @@ import org.sleuthkit.autopsy.mainui.nodes.DataArtifactNode;
import org.sleuthkit.autopsy.mainui.nodes.FileNode; import org.sleuthkit.autopsy.mainui.nodes.FileNode;
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeExtensionsSearchParam; import org.sleuthkit.autopsy.mainui.datamodel.FileTypeExtensionsSearchParam;
import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode; import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode;
import org.sleuthkit.autopsy.mainui.datamodel.ThreePanelDAO; import org.sleuthkit.autopsy.mainui.datamodel.MainDAO;
import org.sleuthkit.autopsy.mainui.datamodel.RowResultDTO;
import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO;
import org.sleuthkit.autopsy.directorytree.ExternalViewerShortcutAction; import org.sleuthkit.autopsy.directorytree.ExternalViewerShortcutAction;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.autopsy.mainui.datamodel.RowDTO;
/** /**
* A DataResultTopComponent object is a NetBeans top component that provides * A DataResultTopComponent object is a NetBeans top component that provides
@ -371,7 +371,7 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
dataResultPanel.setNode(selectedNode); dataResultPanel.setNode(selectedNode);
} }
private final ThreePanelDAO threePanelDAO = ThreePanelDAO.getInstance(); private final MainDAO threePanelDAO = MainDAO.getInstance();
public void displayDataArtifact(DataArtifactSearchParam dataArtifactKey) { public void displayDataArtifact(DataArtifactSearchParam dataArtifactKey) {
try { try {

View File

@ -88,7 +88,6 @@ import org.sleuthkit.autopsy.datamodel.BaseChildFactory.PageChangeEvent;
import org.sleuthkit.autopsy.datamodel.BaseChildFactory.PageCountChangeEvent; import org.sleuthkit.autopsy.datamodel.BaseChildFactory.PageCountChangeEvent;
import org.sleuthkit.autopsy.datamodel.BaseChildFactory.PageSizeChangeEvent; import org.sleuthkit.autopsy.datamodel.BaseChildFactory.PageSizeChangeEvent;
import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode; import org.sleuthkit.autopsy.mainui.nodes.SearchResultRootNode;
import org.sleuthkit.autopsy.mainui.datamodel.ThreePanelDAO;
import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO;
import org.sleuthkit.datamodel.Score.Significance; import org.sleuthkit.datamodel.Score.Significance;

View File

@ -23,13 +23,13 @@ import java.util.List;
/** /**
* Base implementation for a row result. * Base implementation for a row result.
*/ */
public class BaseRowResultDTO implements RowResultDTO { public class BaseRowDTO implements RowDTO {
private final List<Object> cellValues; private final List<Object> cellValues;
private final long id; private final long id;
private final String typeId; private final String typeId;
public BaseRowResultDTO(List<Object> cellValues, String typeId, long id) { public BaseRowDTO(List<Object> cellValues, String typeId, long id) {
this.cellValues = cellValues; this.cellValues = cellValues;
this.id = id; this.id = id;
this.typeId = typeId; this.typeId = typeId;
@ -68,7 +68,7 @@ public class BaseRowResultDTO implements RowResultDTO {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final BaseRowResultDTO other = (BaseRowResultDTO) obj; final BaseRowDTO other = (BaseRowDTO) obj;
if (this.id != other.id) { if (this.id != other.id) {
return false; return false;
} }

View File

@ -0,0 +1,49 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.mainui.datamodel;
/**
* Base implementation of search parameters to provide to a DAO.
*/
public class BaseSearchParam implements SearchParam {
private final long startItem;
private final Long maxResultsCount;
/**
* Constructor that gets all results.
*/
public BaseSearchParam() {
this(0, null);
}
public BaseSearchParam(long startItem, Long maxResultsCount) {
this.startItem = startItem;
this.maxResultsCount = maxResultsCount;
}
@Override
public long getStartItem() {
return startItem;
}
@Override
public Long getMaxResultsCount() {
return maxResultsCount;
}
}

View File

@ -28,15 +28,15 @@ public class BaseSearchResultsDTO implements SearchResultsDTO {
private final String typeId; private final String typeId;
private final String displayName; private final String displayName;
private final List<ColumnKey> columns; private final List<ColumnKey> columns;
private final List<RowResultDTO> items; private final List<RowDTO> items;
private final long totalResultsCount; private final long totalResultsCount;
private final long startItem; private final long startItem;
public BaseSearchResultsDTO(String typeId, String displayName, List<ColumnKey> columns, List<RowResultDTO> items) { public BaseSearchResultsDTO(String typeId, String displayName, List<ColumnKey> columns, List<RowDTO> items) {
this(typeId, displayName, columns, items, 0, items == null ? 0 : items.size()); this(typeId, displayName, columns, items, 0, items == null ? 0 : items.size());
} }
public BaseSearchResultsDTO(String typeId, String displayName, List<ColumnKey> columns, List<RowResultDTO> items, long startItem, long totalResultsCount) { public BaseSearchResultsDTO(String typeId, String displayName, List<ColumnKey> columns, List<RowDTO> items, long startItem, long totalResultsCount) {
this.typeId = typeId; this.typeId = typeId;
this.displayName = displayName; this.displayName = displayName;
this.columns = columns; this.columns = columns;
@ -61,7 +61,7 @@ public class BaseSearchResultsDTO implements SearchResultsDTO {
} }
@Override @Override
public List<RowResultDTO> getItems() { public List<RowDTO> getItems() {
return items; return items;
} }

View File

@ -35,7 +35,7 @@ import org.openide.util.NbBundle.Messages;
"CountsRowResultDTO_columns_count_displayName=Name", "CountsRowResultDTO_columns_count_displayName=Name",
"CountsRowResultDTO_columns_count_description=Name" "CountsRowResultDTO_columns_count_description=Name"
}) })
public class CountsRowResultDTO implements RowResultDTO { public class CountsRowDTO implements RowDTO {
private static final String DEFAULT_TYPE_ID = "COUNTS"; private static final String DEFAULT_TYPE_ID = "COUNTS";
@ -55,11 +55,11 @@ public class CountsRowResultDTO implements RowResultDTO {
private final List<Object> cellValues; private final List<Object> cellValues;
private final String typeId; private final String typeId;
public CountsRowResultDTO(long id, String displayName, long count) { public CountsRowDTO(long id, String displayName, long count) {
this(DEFAULT_TYPE_ID, id, displayName, count); this(DEFAULT_TYPE_ID, id, displayName, count);
} }
public CountsRowResultDTO(String typeId, long id, String displayName, long count) { public CountsRowDTO(String typeId, long id, String displayName, long count) {
this.typeId = typeId; this.typeId = typeId;
this.id = id; this.id = id;
this.displayName = displayName; this.displayName = displayName;

View File

@ -65,7 +65,7 @@ import org.sleuthkit.datamodel.TskCoreException;
"ThreePanelDataArtifactDAO.dataArtifact.columnKeys.dataSource.displayName=Data Source", "ThreePanelDataArtifactDAO.dataArtifact.columnKeys.dataSource.displayName=Data Source",
"ThreePanelDataArtifactDAO.dataArtifact.columnKeys.dataSource.description=Data Source" "ThreePanelDataArtifactDAO.dataArtifact.columnKeys.dataSource.description=Data Source"
}) })
public class ThreePanelDataArtifactDAO { public class DataArtifactDAO {
// GVDTODO there is a different standard for normal attr strings and email attr strings // GVDTODO there is a different standard for normal attr strings and email attr strings
private static final int STRING_LENGTH_MAX = 160; private static final int STRING_LENGTH_MAX = 160;
@ -117,11 +117,11 @@ public class ThreePanelDataArtifactDAO {
Bundle.ThreePanelDataArtifactDAO_dataArtifact_columnKeys_dataSource_description() Bundle.ThreePanelDataArtifactDAO_dataArtifact_columnKeys_dataSource_description()
); );
private static ThreePanelDataArtifactDAO instance = null; private static DataArtifactDAO instance = null;
synchronized static ThreePanelDataArtifactDAO getInstance() { synchronized static DataArtifactDAO getInstance() {
if (instance == null) { if (instance == null) {
instance = new ThreePanelDataArtifactDAO(); instance = new DataArtifactDAO();
} }
return instance; return instance;
@ -174,7 +174,7 @@ public class ThreePanelDataArtifactDAO {
columnKeys.add(DATASOURCE_COL); columnKeys.add(DATASOURCE_COL);
// determine all different attribute types present as well as row data for each artifact // determine all different attribute types present as well as row data for each artifact
List<RowResultDTO> rows = new ArrayList<>(); List<RowDTO> rows = new ArrayList<>();
for (DataArtifact artifact : arts) { for (DataArtifact artifact : arts) {
List<Object> cellValues = new ArrayList<>(); List<Object> cellValues = new ArrayList<>();
@ -204,7 +204,7 @@ public class ThreePanelDataArtifactDAO {
boolean isTimelineSupported = isTimelineSupported(attrValues.keySet()); boolean isTimelineSupported = isTimelineSupported(attrValues.keySet());
rows.add(new DataArtifactTableDTO(artifact, srcContent, linkedFile, isTimelineSupported, cellValues, id)); rows.add(new DataArtifactRowDTO(artifact, srcContent, linkedFile, isTimelineSupported, cellValues, id));
} }
return new DataArtifactTableSearchResultsDTO(artType, columnKeys, rows); return new DataArtifactTableSearchResultsDTO(artType, columnKeys, rows);

View File

@ -25,7 +25,7 @@ import org.sleuthkit.datamodel.DataArtifact;
/** /**
* A result for a data artifact. * A result for a data artifact.
*/ */
public class DataArtifactTableDTO extends BaseRowResultDTO { public class DataArtifactRowDTO extends BaseRowDTO {
private static final String TYPE_ID = "DATA_ARTIFACT"; private static final String TYPE_ID = "DATA_ARTIFACT";
@ -39,7 +39,7 @@ public class DataArtifactTableDTO extends BaseRowResultDTO {
final Content linkedFile; final Content linkedFile;
final boolean isTimelineSupported; final boolean isTimelineSupported;
public DataArtifactTableDTO(DataArtifact dataArtifact, Content srcContent, Content linkedFile, boolean isTimelineSupported, List<Object> cellValues, long id) { public DataArtifactRowDTO(DataArtifact dataArtifact, Content srcContent, Content linkedFile, boolean isTimelineSupported, List<Object> cellValues, long id) {
super(cellValues, TYPE_ID, id); super(cellValues, TYPE_ID, id);
this.dataArtifact = dataArtifact; this.dataArtifact = dataArtifact;
this.srcContent = srcContent; this.srcContent = srcContent;

View File

@ -24,7 +24,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
/** /**
* Key for data artifact in order to retrieve data from DAO. * Key for data artifact in order to retrieve data from DAO.
*/ */
public class DataArtifactSearchParam { public class DataArtifactSearchParam extends BaseSearchParam {
private final BlackboardArtifact.Type artifactType; private final BlackboardArtifact.Type artifactType;
private final Long dataSourceId; private final Long dataSourceId;
@ -33,6 +33,12 @@ public class DataArtifactSearchParam {
this.dataSourceId = dataSourceId; this.dataSourceId = dataSourceId;
} }
public DataArtifactSearchParam(BlackboardArtifact.Type artifactType, Long dataSourceId, long startItem, Long maxResultsCount) {
super(startItem, maxResultsCount);
this.artifactType = artifactType;
this.dataSourceId = dataSourceId;
}
public BlackboardArtifact.Type getArtifactType() { public BlackboardArtifact.Type getArtifactType() {
return artifactType; return artifactType;
} }

View File

@ -30,7 +30,7 @@ public class DataArtifactTableSearchResultsDTO extends BaseSearchResultsDTO {
private final BlackboardArtifact.Type artifactType; private final BlackboardArtifact.Type artifactType;
public DataArtifactTableSearchResultsDTO(BlackboardArtifact.Type artifactType, List<ColumnKey> columns, List<RowResultDTO> items) { public DataArtifactTableSearchResultsDTO(BlackboardArtifact.Type artifactType, List<ColumnKey> columns, List<RowDTO> items) {
super(TYPE_ID, artifactType.getDisplayName(), columns, items); super(TYPE_ID, artifactType.getDisplayName(), columns, items);
this.artifactType = artifactType; this.artifactType = artifactType;
} }

View File

@ -25,7 +25,7 @@ import org.sleuthkit.datamodel.TskData;
/** /**
* DTO Representing an abstract file in the results view. * DTO Representing an abstract file in the results view.
*/ */
public class FileRowDTO extends BaseRowResultDTO { public class FileRowDTO extends BaseRowDTO {
public enum ExtensionMediaType { public enum ExtensionMediaType {
IMAGE, VIDEO, AUDIO, DOC, EXECUTABLE, TEXT, WEB, PDF, ARCHIVE, UNCATEGORIZED IMAGE, VIDEO, AUDIO, DOC, EXECUTABLE, TEXT, WEB, PDF, ARCHIVE, UNCATEGORIZED
@ -37,15 +37,18 @@ public class FileRowDTO extends BaseRowResultDTO {
return TYPE_ID; return TYPE_ID;
} }
final AbstractFile abstractFile; private final AbstractFile abstractFile;
final String fileName; private final String fileName;
final String extension; private final String extension;
final ExtensionMediaType extensionMediaType; private final ExtensionMediaType extensionMediaType;
final boolean allocated; private final boolean allocated;
final TskData.TSK_DB_FILES_TYPE_ENUM fileType; private final TskData.TSK_DB_FILES_TYPE_ENUM fileType;
final boolean encryptionDetected; private final boolean encryptionDetected;
private final boolean visibleChildren;
public FileRowDTO(AbstractFile abstractFile, long id, String fileName, String extension, ExtensionMediaType extensionMediaType, boolean allocated, TskData.TSK_DB_FILES_TYPE_ENUM fileType, boolean encryptionDetected, List<Object> cellValues) { public FileRowDTO(AbstractFile abstractFile, long id, String fileName, String extension,
ExtensionMediaType extensionMediaType, boolean allocated, TskData.TSK_DB_FILES_TYPE_ENUM fileType,
boolean encryptionDetected, boolean visibleChildren, List<Object> cellValues) {
super(cellValues, TYPE_ID, id); super(cellValues, TYPE_ID, id);
this.abstractFile = abstractFile; this.abstractFile = abstractFile;
this.fileName = fileName; this.fileName = fileName;
@ -54,6 +57,7 @@ public class FileRowDTO extends BaseRowResultDTO {
this.allocated = allocated; this.allocated = allocated;
this.fileType = fileType; this.fileType = fileType;
this.encryptionDetected = encryptionDetected; this.encryptionDetected = encryptionDetected;
this.visibleChildren = visibleChildren;
} }
public ExtensionMediaType getExtensionMediaType() { public ExtensionMediaType getExtensionMediaType() {
@ -83,5 +87,8 @@ public class FileRowDTO extends BaseRowResultDTO {
public String getFileName() { public String getFileName() {
return fileName; return fileName;
} }
public boolean hasVisibleChildren() {
return visibleChildren;
}
} }

View File

@ -23,7 +23,7 @@ import java.util.Objects;
/** /**
* Key for accessing data about file type extensions from the DAO. * Key for accessing data about file type extensions from the DAO.
*/ */
public class FileTypeExtensionsSearchParam { public class FileTypeExtensionsSearchParam extends BaseSearchParam {
private final FileExtSearchFilter filter; private final FileExtSearchFilter filter;
private final Long dataSourceId; private final Long dataSourceId;
@ -37,6 +37,13 @@ public class FileTypeExtensionsSearchParam {
this.knownShown = showKnown; this.knownShown = showKnown;
} }
public FileTypeExtensionsSearchParam(FileExtSearchFilter filter, Long dataSourceId, boolean knownShown, long startItem, Long maxResultsCount) {
super(startItem, maxResultsCount);
this.filter = filter;
this.dataSourceId = dataSourceId;
this.knownShown = knownShown;
}
public FileExtSearchFilter getFilter() { public FileExtSearchFilter getFilter() {
return filter; return filter;
} }

View File

@ -22,26 +22,26 @@ package org.sleuthkit.autopsy.mainui.datamodel;
* Main entry point for DAO for providing data to populate the data results * Main entry point for DAO for providing data to populate the data results
* viewer. * viewer.
*/ */
public class ThreePanelDAO { public class MainDAO {
private static ThreePanelDAO instance = null; private static MainDAO instance = null;
public synchronized static ThreePanelDAO getInstance() { public synchronized static MainDAO getInstance() {
if (instance == null) { if (instance == null) {
instance = new ThreePanelDAO(); instance = new MainDAO();
} }
return instance; return instance;
} }
private final ThreePanelDataArtifactDAO dataArtifactDAO = ThreePanelDataArtifactDAO.getInstance(); private final DataArtifactDAO dataArtifactDAO = DataArtifactDAO.getInstance();
private final ThreePanelViewsDAO viewsDAO = ThreePanelViewsDAO.getInstance(); private final ViewsDAO viewsDAO = ViewsDAO.getInstance();
public ThreePanelDataArtifactDAO getDataArtifactsDAO() { public DataArtifactDAO getDataArtifactsDAO() {
return dataArtifactDAO; return dataArtifactDAO;
} }
public ThreePanelViewsDAO getViewsDAO() { public ViewsDAO getViewsDAO() {
return viewsDAO; return viewsDAO;
} }
} }

View File

@ -23,7 +23,7 @@ import java.util.List;
/** /**
* DTO representing an individual row in search results. * DTO representing an individual row in search results.
*/ */
public interface RowResultDTO { public interface RowDTO {
List<Object> getCellValues(); List<Object> getCellValues();

View File

@ -0,0 +1,30 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.mainui.datamodel;
/**
* Describes parameters to provide to the DAO for fetching data.
*/
public interface SearchParam {
long getStartItem();
// null if no max defined
Long getMaxResultsCount();
}

View File

@ -32,7 +32,7 @@ public interface SearchResultsDTO {
List<ColumnKey> getColumns(); List<ColumnKey> getColumns();
List<RowResultDTO> getItems(); List<RowDTO> getItems();
long getTotalResultsCount(); long getTotalResultsCount();

View File

@ -71,7 +71,7 @@ import org.sleuthkit.datamodel.TskData;
"ThreePanelViewsDAO.fileColumns.mimeType=MIME Type", "ThreePanelViewsDAO.fileColumns.mimeType=MIME Type",
"ThreePanelViewsDAO.fileColumns.extensionColLbl=Extension", "ThreePanelViewsDAO.fileColumns.extensionColLbl=Extension",
"ThreePanelViewsDAO.fileColumns.noDescription=No Description"}) "ThreePanelViewsDAO.fileColumns.noDescription=No Description"})
public class ThreePanelViewsDAO { public class ViewsDAO {
private static final String FILE_VIEW_EXT_TYPE_ID = "FILE_VIEW_BY_EXT"; private static final String FILE_VIEW_EXT_TYPE_ID = "FILE_VIEW_BY_EXT";
@ -89,26 +89,25 @@ public class ThreePanelViewsDAO {
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_sizeColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_sizeColLbl()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_flagsDirColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_flagsDirColLbl()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_flagsMetaColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_flagsMetaColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_modeColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_modeColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_useridColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_useridColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_groupidColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_groupidColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_metaAddrColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_metaAddrColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_attrAddrColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_attrAddrColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_typeDirColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_typeDirColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_typeMetaColLbl()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_typeMetaColLbl()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_knownColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_knownColLbl()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_md5HashColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_md5HashColLbl()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_sha256HashColLbl()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_sha256HashColLbl()),
// getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_objectId()), // getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_objectId()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_mimeType()), getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_mimeType()),
getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_extensionColLbl())); getFileColumnKey(Bundle.ThreePanelViewsDAO_fileColumns_extensionColLbl()));
private static ViewsDAO instance = null;
private static ThreePanelViewsDAO instance = null;
synchronized static ThreePanelViewsDAO getInstance() { synchronized static ViewsDAO getInstance() {
if (instance == null) { if (instance == null) {
instance = new ThreePanelViewsDAO(); instance = new ViewsDAO();
} }
return instance; return instance;
@ -207,12 +206,13 @@ public class ThreePanelViewsDAO {
String whereStatement = getFileWhereStatement(filter, dataSourceId, showKnown); String whereStatement = getFileWhereStatement(filter, dataSourceId, showKnown);
List<AbstractFile> files = getCase().findAllFilesWhere(whereStatement); List<AbstractFile> files = getCase().findAllFilesWhere(whereStatement);
List<RowResultDTO> fileRows = new ArrayList<>(); List<RowDTO> fileRows = new ArrayList<>();
for (AbstractFile file : files) { for (AbstractFile file : files) {
boolean encryptionDetected = FileTypeExtensions.getArchiveExtensions().contains("." + file.getNameExtension().toLowerCase()) boolean isArchive = FileTypeExtensions.getArchiveExtensions().contains("." + file.getNameExtension().toLowerCase());
&& file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0; boolean encryptionDetected = isArchive && file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0;
boolean hasVisibleChildren = isArchive || file.isDir();
List<Object> cellValues = Arrays.asList( List<Object> cellValues = Arrays.asList(
file.getName(), // GVDTODO handle . and .. from getContentDisplayName() file.getName(), // GVDTODO handle . and .. from getContentDisplayName()
// GVDTODO translation column // GVDTODO translation column
@ -229,21 +229,19 @@ public class ThreePanelViewsDAO {
file.getSize(), file.getSize(),
file.getDirFlagAsString(), file.getDirFlagAsString(),
file.getMetaFlagsAsString(), file.getMetaFlagsAsString(),
// mode,
// mode, // userid,
// userid, // groupid,
// groupid, // metaAddr,
// metaAddr, // attrAddr,
// attrAddr, // typeDir,
// typeDir, // typeMeta,
// typeMeta,
file.getKnown().getName(), file.getKnown().getName(),
StringUtils.defaultString(file.getMd5Hash()), StringUtils.defaultString(file.getMd5Hash()),
StringUtils.defaultString(file.getSha256Hash()), StringUtils.defaultString(file.getSha256Hash()),
// objectId,
// objectId,
StringUtils.defaultString(file.getMIMEType()), StringUtils.defaultString(file.getMIMEType()),
file.getNameExtension() file.getNameExtension()
); );
@ -257,6 +255,7 @@ public class ThreePanelViewsDAO {
file.isDirNameFlagSet(TskData.TSK_FS_NAME_FLAG_ENUM.ALLOC), file.isDirNameFlagSet(TskData.TSK_FS_NAME_FLAG_ENUM.ALLOC),
file.getType(), file.getType(),
encryptionDetected, encryptionDetected,
hasVisibleChildren,
cellValues)); cellValues));
} }

View File

@ -65,7 +65,7 @@ import org.sleuthkit.autopsy.directorytree.ExternalViewerShortcutAction;
import org.sleuthkit.autopsy.directorytree.ExtractAction; import org.sleuthkit.autopsy.directorytree.ExtractAction;
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
import org.sleuthkit.autopsy.directorytree.ViewContextAction; import org.sleuthkit.autopsy.directorytree.ViewContextAction;
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableDTO; import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactRowDTO;
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableSearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableSearchResultsDTO;
import org.sleuthkit.datamodel.DataArtifact; import org.sleuthkit.datamodel.DataArtifact;
import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.DerivedFile;
@ -86,7 +86,7 @@ public class DataArtifactNode extends AbstractNode {
private static final Logger logger = Logger.getLogger(DataArtifactNode.class.getName()); private static final Logger logger = Logger.getLogger(DataArtifactNode.class.getName());
private static Lookup createLookup(DataArtifactTableDTO row) { private static Lookup createLookup(DataArtifactRowDTO row) {
DataArtifactItem artifactItem = new DataArtifactItem(row.getDataArtifact(), row.getSrcContent()); DataArtifactItem artifactItem = new DataArtifactItem(row.getDataArtifact(), row.getSrcContent());
if (row.getSrcContent() == null) { if (row.getSrcContent() == null) {
return Lookups.fixed(row.getDataArtifact(), artifactItem); return Lookups.fixed(row.getDataArtifact(), artifactItem);
@ -96,14 +96,14 @@ public class DataArtifactNode extends AbstractNode {
} }
private final BlackboardArtifact.Type artifactType; private final BlackboardArtifact.Type artifactType;
private final DataArtifactTableDTO artifactRow; private final DataArtifactRowDTO artifactRow;
private final List<ColumnKey> columns; private final List<ColumnKey> columns;
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactTableDTO artifactRow) { public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow) {
this(tableData, artifactRow, IconsUtil.getIconFilePath(tableData.getArtifactType().getTypeID())); this(tableData, artifactRow, IconsUtil.getIconFilePath(tableData.getArtifactType().getTypeID()));
} }
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactTableDTO artifactRow, String iconPath) { public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow, String iconPath) {
super(Children.LEAF, createLookup(artifactRow)); super(Children.LEAF, createLookup(artifactRow));
// use first cell value for display name // use first cell value for display name

View File

@ -27,12 +27,12 @@ import java.util.stream.Collectors;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableDTO; import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactRowDTO;
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableSearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactTableSearchResultsDTO;
import org.sleuthkit.autopsy.mainui.datamodel.FileRowDTO; import org.sleuthkit.autopsy.mainui.datamodel.FileRowDTO;
import org.sleuthkit.autopsy.mainui.nodes.SearchResultChildFactory.ChildKey; import org.sleuthkit.autopsy.mainui.nodes.SearchResultChildFactory.ChildKey;
import org.sleuthkit.autopsy.mainui.datamodel.RowResultDTO;
import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO; import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO;
import org.sleuthkit.autopsy.mainui.datamodel.RowDTO;
/** /**
* Factory for populating results in a results viewer with a SearchResultsDTO. * Factory for populating results in a results viewer with a SearchResultsDTO.
@ -64,8 +64,8 @@ public class SearchResultChildFactory extends ChildFactory<ChildKey> {
protected Node createNodeForKey(ChildKey key) { protected Node createNodeForKey(ChildKey key) {
String typeId = key.getRow().getTypeId(); String typeId = key.getRow().getTypeId();
try { try {
if (DataArtifactTableDTO.getTypeIdForClass().equals(typeId)) { if (DataArtifactRowDTO.getTypeIdForClass().equals(typeId)) {
return new DataArtifactNode((DataArtifactTableSearchResultsDTO) key.getSearchResults(), (DataArtifactTableDTO) key.getRow()); return new DataArtifactNode((DataArtifactTableSearchResultsDTO) key.getSearchResults(), (DataArtifactRowDTO) key.getRow());
} else if (FileRowDTO.getTypeIdForClass().equals(typeId)) { } else if (FileRowDTO.getTypeIdForClass().equals(typeId)) {
return new FileNode(key.getSearchResults(), (FileRowDTO) key.getRow()); return new FileNode(key.getSearchResults(), (FileRowDTO) key.getRow());
} else { } else {
@ -90,9 +90,9 @@ public class SearchResultChildFactory extends ChildFactory<ChildKey> {
static class ChildKey { static class ChildKey {
private final SearchResultsDTO searchResults; private final SearchResultsDTO searchResults;
private final RowResultDTO row; private final RowDTO row;
ChildKey(SearchResultsDTO searchResults, RowResultDTO child) { ChildKey(SearchResultsDTO searchResults, RowDTO child) {
this.searchResults = searchResults; this.searchResults = searchResults;
this.row = child; this.row = child;
} }
@ -101,7 +101,7 @@ public class SearchResultChildFactory extends ChildFactory<ChildKey> {
return searchResults; return searchResults;
} }
RowResultDTO getRow() { RowDTO getRow() {
return row; return row;
} }