Merge pull request #5373 from wschaeferB/5674-ExcludeFoldersFilter

5674 exclude folders filter
This commit is contained in:
Richard Cordovano 2019-11-14 09:54:00 -05:00 committed by GitHub
commit 6ceee42dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 532 additions and 339 deletions

View File

@ -58,3 +58,7 @@ ResultsPanel.gotoPageLabel.text=Go to Page:
ResultsPanel.pageSizeLabel.text=Page size:
ResultsPanel.instancesList.border.title=Instances
DiscoveryExtractAction.title.extractFiles.text=Extract File
FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files

View File

@ -86,6 +86,7 @@ FileSearchFiltering.HashSetFilter.desc=Files with hash set hits in set(s): {0}
FileSearchFiltering.InterestingItemSetFilter.desc=Files with interesting item hits in set(s): {0}
# {0} - filters
FileSearchFiltering.KeywordListFilter.desc=Files with keywords in list(s): {0}
FileSearchFiltering.KnownFilter.desc=Files which are not known
# {0} - filters
FileSearchFiltering.ObjectDetectionFilter.desc=Files with objects detected in set(s): {0}
# {0} - filters
@ -93,10 +94,10 @@ FileSearchFiltering.ParentFilter.desc=Files with paths matching: {0}
FileSearchFiltering.ParentFilter.exact=(exact match)
FileSearchFiltering.ParentFilter.or=\ or
FileSearchFiltering.ParentFilter.substring=(substring)
# {0} - search term
FileSearchFiltering.ParentSearchTerm.fullString=\ {0} (exact)
# {0} - search term
FileSearchFiltering.ParentSearchTerm.subString=\ {0} (substring)
FileSearchFiltering.ParentSearchTerm.excludeString=\ (exclude)
FileSearchFiltering.ParentSearchTerm.fullString=\ (exact)
FileSearchFiltering.ParentSearchTerm.includeString=\ (include)
FileSearchFiltering.ParentSearchTerm.subString=\ (substring)
FileSearchFiltering.PreviouslyNotableFilter.desc=Files that were previously marked as notable
# {0} - filters
FileSearchFiltering.ScoreFilter.desc=Files with score(s) of : {0}
@ -178,6 +179,10 @@ ResultsPanel.gotoPageLabel.text=Go to Page:
ResultsPanel.pageSizeLabel.text=Page size:
ResultsPanel.instancesList.border.title=Instances
DiscoveryExtractAction.title.extractFiles.text=Extract File
FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files
ResultsPanel.viewFileInDir.name=View File in Directory
SearchNode.getName.text=Search Result
# {0} - numberOfInstances

View File

@ -1092,9 +1092,9 @@ public class FileSearchDialog extends javax.swing.JDialog implements ActionListe
if ( ! parentTextField.getText().isEmpty()) {
ParentSearchTerm searchTerm;
if (parentFullRadioButton.isSelected()) {
searchTerm = new ParentSearchTerm(parentTextField.getText(), true);
searchTerm = new ParentSearchTerm(parentTextField.getText(), true, true);
} else {
searchTerm = new ParentSearchTerm(parentTextField.getText(), false);
searchTerm = new ParentSearchTerm(parentTextField.getText(), false, true);
}
parentListModel.add(parentListModel.size(), searchTerm);
}

View File

@ -53,9 +53,10 @@ class FileSearchFiltering {
/**
* Run the given filters to get a list of matching files.
*
* @param filters The filters to run
* @param caseDb The case database
* @param crDb The central repo. Can be null as long as no filters need it.
* @param filters The filters to run
* @param caseDb The case database
* @param crDb The central repo. Can be null as long as no filters need
* it.
*
* @return
*/
@ -75,8 +76,8 @@ class FileSearchFiltering {
// Combine all the SQL queries from the filters into one query
String combinedQuery = "";
for (FileFilter filter : filters) {
if ( ! filter.getWhereClause().isEmpty()) {
if ( ! combinedQuery.isEmpty()) {
if (!filter.getWhereClause().isEmpty()) {
if (!combinedQuery.isEmpty()) {
combinedQuery += " AND "; // NON-NLS
}
combinedQuery += "(" + filter.getWhereClause() + ")"; // NON-NLS
@ -92,7 +93,6 @@ class FileSearchFiltering {
// Get all matching abstract files
List<ResultFile> resultList = new ArrayList<>();
logger.log(Level.INFO, "Running SQL query: {0}", combinedQuery);
List<AbstractFile> sqlResults = caseDb.findAllFilesWhere(combinedQuery);
@ -128,14 +128,20 @@ class FileSearchFiltering {
* Base class for the filters.
*/
static abstract class FileFilter {
/**
* Returns part of a query on the tsk_files table that can be AND-ed with other pieces
* @return the SQL query or an empty string if there is no SQL query for this filter.
* Returns part of a query on the tsk_files table that can be AND-ed
* with other pieces
*
* @return the SQL query or an empty string if there is no SQL query for
* this filter.
*/
abstract String getWhereClause();
/**
* Indicates whether this filter needs to use the secondary, non-SQL method applyAlternateFilter().
* Indicates whether this filter needs to use the secondary, non-SQL
* method applyAlternateFilter().
*
* @return false by default
*/
boolean useAlternateFilter() {
@ -145,15 +151,18 @@ class FileSearchFiltering {
/**
* Run a secondary filter that does not operate on tsk_files.
*
* @param currentResults The current list of matching files; empty if no filters have yet been run.
* @param currentResults The current list of matching files; empty if no
* filters have yet been run.
* @param caseDb The case database
* @param centralRepoDb The central repo database. Can be null if the filter does not require it.
* @param centralRepoDb The central repo database. Can be null if the
* filter does not require it.
*
* @return The list of files that match this filter (and any that came before it)
* @return The list of files that match this filter (and any that came
* before it)
*
* @throws FileSearchException
*/
List<ResultFile> applyAlternateFilter (List<ResultFile> currentResults, SleuthkitCase caseDb,
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException {
return new ArrayList<>();
}
@ -170,6 +179,7 @@ class FileSearchFiltering {
* A filter for specifying the file size
*/
static class SizeFilter extends FileFilter {
private final List<FileSize> fileSizes;
/**
@ -185,7 +195,7 @@ class FileSearchFiltering {
String getWhereClause() {
String queryStr = ""; // NON-NLS
for (FileSize size : fileSizes) {
if (! queryStr.isEmpty()) {
if (!queryStr.isEmpty()) {
queryStr += " OR "; // NON-NLS
}
if (size.getMaxBytes() != FileSize.NO_MAXIMUM) {
@ -203,13 +213,12 @@ class FileSearchFiltering {
"FileSearchFiltering.SizeFilter.or= or ",
"# {0} - Minimum bytes",
"# {1} - Maximum bytes",
"FileSearchFiltering.SizeFilter.range=({0} to {1})",
})
"FileSearchFiltering.SizeFilter.range=({0} to {1})",})
@Override
String getDesc() {
String desc = ""; // NON-NLS
for (FileSize size : fileSizes) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_SizeFilter_or();
}
desc += Bundle.FileSearchFiltering_SizeFilter_range(size.getMinBytes(), size.getMaxBytes());
@ -220,12 +229,14 @@ class FileSearchFiltering {
}
/**
* A utility class for the ParentFilter to store the search string
* and whether it is a full path or a substring.
* A utility class for the ParentFilter to store the search string and
* whether it is a full path or a substring.
*/
static class ParentSearchTerm {
private final String searchStr;
private final boolean isFullPath;
private final boolean fullPath;
private final boolean included;
/**
* Create the ParentSearchTerm object
@ -233,10 +244,13 @@ class FileSearchFiltering {
* @param searchStr The string to search for in the file path
* @param isFullPath True if the path should exactly match the given
* string, false to do a substring search
* @param isIncluded True if the results must include the path, false if
* the path should be excluded from the results.
*/
ParentSearchTerm(String searchStr, boolean isFullPath) {
ParentSearchTerm(String searchStr, boolean isFullPath, boolean isIncluded) {
this.searchStr = searchStr;
this.isFullPath = isFullPath;
this.fullPath = isFullPath;
this.included = isIncluded;
}
/**
@ -246,25 +260,54 @@ class FileSearchFiltering {
*/
String getSQLForTerm() {
// TODO - these should really be prepared statements
if (isFullPath) {
return "parent_path=\'" + searchStr + "\'"; // NON-NLS
if (isIncluded()) {
if (isFullPath()) {
return "parent_path=\'" + searchStr + "\'"; // NON-NLS
} else {
return "parent_path LIKE \'%" + searchStr + "%\'"; // NON-NLS
}
} else {
return "parent_path LIKE \'%" + searchStr + "%\'"; // NON-NLS
if (isFullPath()) {
return "parent_path!=\'" + searchStr + "\'"; // NON-NLS
} else {
return "parent_path NOT LIKE \'%" + searchStr + "%\'"; // NON-NLS
}
}
}
@NbBundle.Messages({
"# {0} - search term",
"FileSearchFiltering.ParentSearchTerm.fullString= {0} (exact)",
"# {0} - search term",
"FileSearchFiltering.ParentSearchTerm.subString= {0} (substring)",
})
"FileSearchFiltering.ParentSearchTerm.fullString= (exact)",
"FileSearchFiltering.ParentSearchTerm.subString= (substring)",
"FileSearchFiltering.ParentSearchTerm.includeString= (include)",
"FileSearchFiltering.ParentSearchTerm.excludeString= (exclude)",})
@Override
public String toString() {
if (isFullPath) {
return Bundle.FileSearchFiltering_ParentSearchTerm_fullString(searchStr);
String returnString = searchStr;
if (isFullPath()) {
returnString += Bundle.FileSearchFiltering_ParentSearchTerm_fullString();
} else {
returnString += Bundle.FileSearchFiltering_ParentSearchTerm_subString();
}
return Bundle.FileSearchFiltering_ParentSearchTerm_subString(searchStr);
if (isIncluded()) {
returnString += Bundle.FileSearchFiltering_ParentSearchTerm_includeString();
} else {
returnString += Bundle.FileSearchFiltering_ParentSearchTerm_excludeString();
}
return returnString;
}
/**
* @return the fullPath
*/
boolean isFullPath() {
return fullPath;
}
/**
* @return the included
*/
boolean isIncluded() {
return included;
}
}
@ -272,6 +315,7 @@ class FileSearchFiltering {
* A filter for specifying parent path (either full path or substring)
*/
static class ParentFilter extends FileFilter {
private final List<ParentSearchTerm> parentSearchTerms;
/**
@ -285,14 +329,32 @@ class FileSearchFiltering {
@Override
String getWhereClause() {
String queryStr = ""; // NON-NLS
String includeQueryStr = ""; // NON-NLS
String excludeQueryStr = "";
for (ParentSearchTerm searchTerm : parentSearchTerms) {
if (! queryStr.isEmpty()) {
queryStr += " OR "; // NON-NLS
if (searchTerm.isIncluded()) {
if (!includeQueryStr.isEmpty()) {
includeQueryStr += " OR "; // NON-NLS
}
includeQueryStr += searchTerm.getSQLForTerm();
} else {
if (!excludeQueryStr.isEmpty()) {
excludeQueryStr += " AND "; // NON-NLS
}
excludeQueryStr += searchTerm.getSQLForTerm();
}
queryStr += searchTerm.getSQLForTerm();
}
return queryStr;
if (!includeQueryStr.isEmpty()) {
includeQueryStr = "(" + includeQueryStr + ")";
}
if (!excludeQueryStr.isEmpty()) {
excludeQueryStr = "(" + excludeQueryStr + ")";
}
if (includeQueryStr.isEmpty() || excludeQueryStr.isEmpty()) {
return includeQueryStr + excludeQueryStr;
} else {
return includeQueryStr + " AND " + excludeQueryStr;
}
}
@NbBundle.Messages({
@ -300,16 +362,15 @@ class FileSearchFiltering {
"FileSearchFiltering.ParentFilter.desc=Files with paths matching: {0}",
"FileSearchFiltering.ParentFilter.or= or ",
"FileSearchFiltering.ParentFilter.exact=(exact match)",
"FileSearchFiltering.ParentFilter.substring=(substring)",
})
"FileSearchFiltering.ParentFilter.substring=(substring)",})
@Override
String getDesc() {
String desc = ""; // NON-NLS
for (ParentSearchTerm searchTerm : parentSearchTerms) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_ParentFilter_or();
}
if (searchTerm.isFullPath) {
if (searchTerm.isFullPath()) {
desc += searchTerm.searchStr + Bundle.FileSearchFiltering_ParentFilter_exact();
} else {
desc += searchTerm.searchStr + Bundle.FileSearchFiltering_ParentFilter_substring();
@ -324,6 +385,7 @@ class FileSearchFiltering {
* A filter for specifying data sources
*/
static class DataSourceFilter extends FileFilter {
private final List<DataSource> dataSources;
/**
@ -339,7 +401,7 @@ class FileSearchFiltering {
String getWhereClause() {
String queryStr = ""; // NON-NLS
for (DataSource ds : dataSources) {
if (! queryStr.isEmpty()) {
if (!queryStr.isEmpty()) {
queryStr += ","; // NON-NLS
}
queryStr += "\'" + ds.getId() + "\'"; // NON-NLS
@ -354,13 +416,12 @@ class FileSearchFiltering {
"FileSearchFiltering.DataSourceFilter.or= or ",
"# {0} - Data source name",
"# {1} - Data source ID",
"FileSearchFiltering.DataSourceFilter.datasource={0}({1})",
})
"FileSearchFiltering.DataSourceFilter.datasource={0}({1})",})
@Override
String getDesc() {
String desc = ""; // NON-NLS
for (DataSource ds : dataSources) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_DataSourceFilter_or();
}
desc += Bundle.FileSearchFiltering_DataSourceFilter_datasource(ds.getName(), ds.getId());
@ -371,14 +432,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying keyword list names.
* A file must contain a keyword from one of the given lists to pass.
* A filter for specifying keyword list names. A file must contain a keyword
* from one of the given lists to pass.
*/
static class KeywordListFilter extends FileFilter {
private final List<String> listNames;
/**
* Create the KeywordListFilter
*
* @param listNames
*/
KeywordListFilter(List<String> listNames) {
@ -389,17 +452,16 @@ class FileSearchFiltering {
String getWhereClause() {
String keywordListPart = concatenateNamesForSQL(listNames);
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " +
"(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = 9 AND attribute_type_ID = 37 " +
"AND (" + keywordListPart + "))))"; // NON-NLS
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = 9 AND attribute_type_ID = 37 "
+ "AND (" + keywordListPart + "))))"; // NON-NLS
return queryStr;
}
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.KeywordListFilter.desc=Files with keywords in list(s): {0}",
})
"FileSearchFiltering.KeywordListFilter.desc=Files with keywords in list(s): {0}",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_KeywordListFilter_desc(concatenateSetNamesForDisplay(listNames));
@ -410,10 +472,12 @@ class FileSearchFiltering {
* A filter for specifying file types.
*/
static class FileTypeFilter extends FileFilter {
private final List<FileType> categories;
/**
* Create the FileTypeFilter
*
* @param categories List of file types to filter on
*/
FileTypeFilter(List<FileType> categories) {
@ -435,7 +499,7 @@ class FileSearchFiltering {
String queryStr = ""; // NON-NLS
for (FileType cat : categories) {
for (String type : cat.getMediaTypes()) {
if (! queryStr.isEmpty()) {
if (!queryStr.isEmpty()) {
queryStr += ","; // NON-NLS
}
queryStr += "\'" + type + "\'"; // NON-NLS
@ -448,13 +512,12 @@ class FileSearchFiltering {
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.FileTypeFilter.desc=Files with type: {0}",
"FileSearchFiltering.FileTypeFilter.or= or ",
})
"FileSearchFiltering.FileTypeFilter.or= or ",})
@Override
String getDesc() {
String desc = "";
for (FileType cat : categories) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_FileTypeFilter_or();
}
desc += cat.toString();
@ -493,7 +556,7 @@ class FileSearchFiltering {
}
@Override
List<ResultFile> applyAlternateFilter (List<ResultFile> currentResults, SleuthkitCase caseDb,
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException {
if (centralRepoDb == null) {
@ -523,13 +586,12 @@ class FileSearchFiltering {
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.FrequencyFilter.desc=Files with frequency: {0}",
"FileSearchFiltering.FrequencyFilter.or= or ",
})
"FileSearchFiltering.FrequencyFilter.or= or ",})
@Override
String getDesc() {
String desc = ""; // NON-NLS
for (Frequency freq : frequencies) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_FrequencyFilter_or();
}
desc += freq.name();
@ -539,14 +601,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying hash set names.
* A file must match one of the given sets to pass.
* A filter for specifying hash set names. A file must match one of the
* given sets to pass.
*/
static class HashSetFilter extends FileFilter {
private final List<String> setNames;
/**
* Create the HashSetFilter
*
* @param setNames
*/
HashSetFilter(List<String> setNames) {
@ -557,18 +621,17 @@ class FileSearchFiltering {
String getWhereClause() {
String hashSetPart = concatenateNamesForSQL(setNames);
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " +
"(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID() +
" AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + " " +
"AND (" + hashSetPart + "))))"; // NON-NLS
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()
+ " AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + " "
+ "AND (" + hashSetPart + "))))"; // NON-NLS
return queryStr;
}
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.HashSetFilter.desc=Files with hash set hits in set(s): {0}",
})
"FileSearchFiltering.HashSetFilter.desc=Files with hash set hits in set(s): {0}",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_HashSetFilter_desc(concatenateSetNamesForDisplay(setNames));
@ -576,14 +639,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying interesting file set names.
* A file must match one of the given sets to pass.
* A filter for specifying interesting file set names. A file must match one
* of the given sets to pass.
*/
static class InterestingFileSetFilter extends FileFilter {
private final List<String> setNames;
/**
* Create the InterestingFileSetFilter
*
* @param setNames
*/
InterestingFileSetFilter(List<String> setNames) {
@ -594,18 +659,17 @@ class FileSearchFiltering {
String getWhereClause() {
String intItemSetPart = concatenateNamesForSQL(setNames);
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " +
"(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() +
" AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + " " +
"AND (" + intItemSetPart + "))))"; // NON-NLS
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
+ " AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + " "
+ "AND (" + intItemSetPart + "))))"; // NON-NLS
return queryStr;
}
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.InterestingItemSetFilter.desc=Files with interesting item hits in set(s): {0}",
})
"FileSearchFiltering.InterestingItemSetFilter.desc=Files with interesting item hits in set(s): {0}",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_InterestingItemSetFilter_desc(concatenateSetNamesForDisplay(setNames));
@ -613,14 +677,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying object types detected.
* A file must match one of the given types to pass.
* A filter for specifying object types detected. A file must match one of
* the given types to pass.
*/
static class ObjectDetectionFilter extends FileFilter {
private final List<String> typeNames;
/**
* Create the ObjectDetectionFilter
*
* @param typeNames
*/
ObjectDetectionFilter(List<String> typeNames) {
@ -631,18 +697,17 @@ class FileSearchFiltering {
String getWhereClause() {
String objTypePart = concatenateNamesForSQL(typeNames);
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " +
"(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED.getTypeID() +
" AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION.getTypeID() + " " +
"AND (" + objTypePart + "))))"; // NON-NLS
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED.getTypeID()
+ " AND attribute_type_ID = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION.getTypeID() + " "
+ "AND (" + objTypePart + "))))"; // NON-NLS
return queryStr;
}
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.ObjectDetectionFilter.desc=Files with objects detected in set(s): {0}",
})
"FileSearchFiltering.ObjectDetectionFilter.desc=Files with objects detected in set(s): {0}",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_ObjectDetectionFilter_desc(concatenateSetNamesForDisplay(typeNames));
@ -650,14 +715,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying the score.
* A file must have one of the given scores to pass
* A filter for specifying the score. A file must have one of the given
* scores to pass
*/
static class ScoreFilter extends FileFilter {
private final List<Score> scores;
/**
* Create the ObjectDetectionFilter
*
* @param typeNames
*/
ScoreFilter(List<Score> scores) {
@ -681,8 +748,8 @@ class FileSearchFiltering {
if (scores.contains(Score.INTERESTING)) {
// Matches interesting item artifact
intItemQueryPart = " (obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_type_id = " +
BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + ")) ";
intItemQueryPart = " (obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_type_id = "
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + ")) ";
}
if (scores.contains(Score.NOTABLE) && scores.contains(Score.INTERESTING)) {
@ -690,23 +757,23 @@ class FileSearchFiltering {
tagQueryPart = "(obj_id IN (SELECT obj_id FROM content_tags))";
} else if (scores.contains(Score.NOTABLE)) {
// Notable tags
tagQueryPart = "(obj_id IN (SELECT obj_id FROM content_tags WHERE tag_name_id IN (SELECT tag_name_id FROM tag_names WHERE knownStatus = " +
TskData.FileKnown.BAD.getFileKnownValue() + ")))";
tagQueryPart = "(obj_id IN (SELECT obj_id FROM content_tags WHERE tag_name_id IN (SELECT tag_name_id FROM tag_names WHERE knownStatus = "
+ TskData.FileKnown.BAD.getFileKnownValue() + ")))";
} else if (scores.contains(Score.INTERESTING)) {
// Non-notable tags
tagQueryPart = "(obj_id IN (SELECT obj_id FROM content_tags WHERE tag_name_id IN (SELECT tag_name_id FROM tag_names WHERE knownStatus != " +
TskData.FileKnown.BAD.getFileKnownValue() + ")))";
tagQueryPart = "(obj_id IN (SELECT obj_id FROM content_tags WHERE tag_name_id IN (SELECT tag_name_id FROM tag_names WHERE knownStatus != "
+ TskData.FileKnown.BAD.getFileKnownValue() + ")))";
}
String queryStr = hashsetQueryPart;
if (! intItemQueryPart.isEmpty()) {
if (! queryStr.isEmpty()) {
if (!intItemQueryPart.isEmpty()) {
if (!queryStr.isEmpty()) {
queryStr += " OR ";
}
queryStr += intItemQueryPart;
}
if (! tagQueryPart.isEmpty()) {
if (! queryStr.isEmpty()) {
if (!tagQueryPart.isEmpty()) {
if (!queryStr.isEmpty()) {
queryStr += " OR ";
}
queryStr += tagQueryPart;
@ -716,8 +783,7 @@ class FileSearchFiltering {
@NbBundle.Messages({
"# {0} - filters",
"FileSearchFiltering.ScoreFilter.desc=Files with score(s) of : {0}",
})
"FileSearchFiltering.ScoreFilter.desc=Files with score(s) of : {0}",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_ScoreFilter_desc(
@ -726,14 +792,16 @@ class FileSearchFiltering {
}
/**
* A filter for specifying tag names.
* A file must contain one of the given tags to pass.
* A filter for specifying tag names. A file must contain one of the given
* tags to pass.
*/
static class TagsFilter extends FileFilter {
private final List<TagName> tagNames;
/**
* Create the TagsFilter
*
* @param tagNames
*/
TagsFilter(List<TagName> tagNames) {
@ -744,7 +812,7 @@ class FileSearchFiltering {
String getWhereClause() {
String tagIDs = ""; // NON-NLS
for (TagName tagName : tagNames) {
if (! tagIDs.isEmpty()) {
if (!tagIDs.isEmpty()) {
tagIDs += ",";
}
tagIDs += tagName.getId();
@ -758,13 +826,12 @@ class FileSearchFiltering {
@NbBundle.Messages({
"# {0} - tag names",
"FileSearchFiltering.TagsFilter.desc=Files that have been tagged {0}",
"FileSearchFiltering.TagsFilter.or= or ",
})
"FileSearchFiltering.TagsFilter.or= or ",})
@Override
String getDesc() {
String desc = ""; // NON-NLS
for (TagName name : tagNames) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_TagsFilter_or();
}
desc += name.getDisplayName();
@ -787,16 +854,15 @@ class FileSearchFiltering {
@Override
String getWhereClause() {
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " +
"(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " +
BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() + ")))";
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = "
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() + ")))";
return queryStr;
}
@NbBundle.Messages({
"FileSearchFiltering.ExifFilter.desc=Files that contain EXIF data",
})
"FileSearchFiltering.ExifFilter.desc=Files that contain EXIF data",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_ExifFilter_desc();
@ -804,7 +870,8 @@ class FileSearchFiltering {
}
/**
* A filter for specifying that the file must have been marked as notable in the CR.
* A filter for specifying that the file must have been marked as notable in
* the CR.
*/
static class NotableFilter extends FileFilter {
@ -828,7 +895,7 @@ class FileSearchFiltering {
}
@Override
List<ResultFile> applyAlternateFilter (List<ResultFile> currentResults, SleuthkitCase caseDb,
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException {
if (centralRepoDb == null) {
@ -848,7 +915,7 @@ class FileSearchFiltering {
CorrelationAttributeInstance.Type type = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(CorrelationAttributeInstance.FILES_TYPE_ID);
for (ResultFile file : currentResults) {
if (file.getFirstInstance().getMd5Hash() != null && ! file.getFirstInstance().getMd5Hash().isEmpty()) {
if (file.getFirstInstance().getMd5Hash() != null && !file.getFirstInstance().getMd5Hash().isEmpty()) {
// Check if this file hash is marked as notable in the CR
String value = file.getFirstInstance().getMd5Hash();
@ -864,21 +931,37 @@ class FileSearchFiltering {
}
@NbBundle.Messages({
"FileSearchFiltering.PreviouslyNotableFilter.desc=Files that were previously marked as notable",
})
"FileSearchFiltering.PreviouslyNotableFilter.desc=Files that were previously marked as notable",})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_PreviouslyNotableFilter_desc();
}
}
/**
* A filter for specifying if known files should be included.
*/
static class KnownFilter extends FileFilter {
@Override
String getWhereClause() {
return "known!=" + TskData.FileKnown.KNOWN.getFileKnownValue(); // NON-NLS
}
@NbBundle.Messages({
"FileSearchFiltering.KnownFilter.desc=Files which are not known"})
@Override
String getDesc() {
return Bundle.FileSearchFiltering_KnownFilter_desc();
}
}
@NbBundle.Messages({
"FileSearchFiltering.concatenateSetNamesForDisplay.comma=, ",
})
"FileSearchFiltering.concatenateSetNamesForDisplay.comma=, ",})
private static String concatenateSetNamesForDisplay(List<String> setNames) {
String desc = ""; // NON-NLS
for (String setName : setNames) {
if ( ! desc.isEmpty()) {
if (!desc.isEmpty()) {
desc += Bundle.FileSearchFiltering_concatenateSetNamesForDisplay_comma();
}
desc += setName;
@ -887,8 +970,8 @@ class FileSearchFiltering {
}
/**
* Concatenate the set names into an "OR" separated list.
* This does not do any SQL-escaping.
* Concatenate the set names into an "OR" separated list. This does not do
* any SQL-escaping.
*
* @param setNames
*
@ -897,7 +980,7 @@ class FileSearchFiltering {
private static String concatenateNamesForSQL(List<String> setNames) {
String result = ""; // NON-NLS
for (String setName : setNames) {
if (! result.isEmpty()) {
if (!result.isEmpty()) {
result += " OR "; // NON-NLS
}
result += "value_text = \'" + setName + "\'"; // NON-NLS

View File

@ -2,10 +2,16 @@
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="parentButtonGroup">
<Component class="javax.swing.ButtonGroup" name="parentPathButtonGroup">
</Component>
<Component class="javax.swing.ButtonGroup" name="orderGroupsByButtonGroup">
</Component>
<Component class="javax.swing.ButtonGroup" name="parentIncludeButtonGroup">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
</NonVisualComponents>
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
@ -170,7 +176,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="11" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="12" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -203,7 +209,7 @@
<Component class="javax.swing.JRadioButton" name="fullRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="parentButtonGroup"/>
<ComponentRef name="parentPathButtonGroup"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -213,14 +219,14 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="substringRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="parentButtonGroup"/>
<ComponentRef name="parentPathButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.substringRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -229,7 +235,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -239,7 +245,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="14" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="6" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="16" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="6" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -264,7 +270,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="6" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="16" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="6" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -289,7 +295,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="4" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="4" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -379,7 +385,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="12" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.1"/>
<GridBagConstraints gridX="0" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.1"/>
</Constraint>
</Constraints>
</Component>
@ -389,7 +395,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="11" gridWidth="3" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="12" gridWidth="3" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -641,6 +647,54 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JRadioButton" name="includeRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="parentIncludeButtonGroup"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.includeRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="excludeRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="parentIncludeButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.excludeRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="knownFilesCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.knownFilesCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.knownFilesCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="11" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -374,9 +374,10 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* Initialize the parent path filter
*/
private void setUpParentPathFilter() {
parentButtonGroup.add(fullRadioButton);
parentButtonGroup.add(substringRadioButton);
parentPathButtonGroup.add(fullRadioButton);
parentPathButtonGroup.add(substringRadioButton);
fullRadioButton.setSelected(true);
includeRadioButton.setSelected(true);
parentListModel = (DefaultListModel<FileSearchFiltering.ParentSearchTerm>) parentList.getModel();
addListeners(parentCheckbox, parentList);
}
@ -438,6 +439,11 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
filters.add(new FileSearchFiltering.NotableFilter());
}
if (knownFilesCheckbox.isSelected()){
filters.add(new FileSearchFiltering.KnownFilter());
}
if (scoreCheckbox.isSelected()) {
filters.add(new FileSearchFiltering.ScoreFilter(scoreList.getSelectedValuesList()));
}
@ -606,8 +612,9 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
parentButtonGroup = new javax.swing.ButtonGroup();
parentPathButtonGroup = new javax.swing.ButtonGroup();
orderGroupsByButtonGroup = new javax.swing.ButtonGroup();
javax.swing.ButtonGroup parentIncludeButtonGroup = new javax.swing.ButtonGroup();
filtersScrollPane = new javax.swing.JScrollPane();
filtersPanel = new javax.swing.JPanel();
sizeCheckbox = new javax.swing.JCheckBox();
@ -648,6 +655,9 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
interestingItemsList = new javax.swing.JList<>();
scoreScrollPane = new javax.swing.JScrollPane();
scoreList = new javax.swing.JList<>();
includeRadioButton = new javax.swing.JRadioButton();
excludeRadioButton = new javax.swing.JRadioButton();
knownFilesCheckbox = new javax.swing.JCheckBox();
fileTypeLabel = new javax.swing.JLabel();
searchButton = new javax.swing.JButton();
sortingPanel = new javax.swing.JPanel();
@ -730,7 +740,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 11;
gridBagConstraints.gridy = 12;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
filtersPanel.add(parentCheckbox, gridBagConstraints);
@ -751,23 +761,23 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
filtersPanel.add(dataSourceScrollPane, gridBagConstraints);
parentButtonGroup.add(fullRadioButton);
parentPathButtonGroup.add(fullRadioButton);
fullRadioButton.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(fullRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.fullRadioButton.text")); // NOI18N
fullRadioButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 13;
gridBagConstraints.gridy = 14;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
filtersPanel.add(fullRadioButton, gridBagConstraints);
parentButtonGroup.add(substringRadioButton);
parentPathButtonGroup.add(substringRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(substringRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.substringRadioButton.text")); // NOI18N
substringRadioButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 13;
gridBagConstraints.gridy = 14;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weightx = 0.5;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
@ -776,7 +786,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
parentTextField.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 14;
gridBagConstraints.gridy = 16;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
@ -796,7 +806,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 14;
gridBagConstraints.gridy = 16;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 6);
filtersPanel.add(addButton, gridBagConstraints);
@ -813,7 +823,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 13;
gridBagConstraints.gridy = 15;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 4, 6);
filtersPanel.add(deleteButton, gridBagConstraints);
@ -867,7 +877,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
org.openide.awt.Mnemonics.setLocalizedText(parentLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.parentLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 12;
gridBagConstraints.gridy = 13;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 0.1;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 0);
@ -885,7 +895,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 11;
gridBagConstraints.gridy = 12;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
@ -1057,6 +1067,38 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 6);
filtersPanel.add(scoreScrollPane, gridBagConstraints);
parentIncludeButtonGroup.add(includeRadioButton);
includeRadioButton.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(includeRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.includeRadioButton.text")); // NOI18N
includeRadioButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 15;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
filtersPanel.add(includeRadioButton, gridBagConstraints);
parentIncludeButtonGroup.add(excludeRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(excludeRadioButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.excludeRadioButton.text")); // NOI18N
excludeRadioButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 15;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weightx = 0.5;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
filtersPanel.add(excludeRadioButton, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(knownFilesCheckbox, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.knownFilesCheckbox.text")); // NOI18N
knownFilesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.knownFilesCheckbox.toolTipText")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 11;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 4, 6);
filtersPanel.add(knownFilesCheckbox, gridBagConstraints);
filtersScrollPane.setViewportView(filtersPanel);
org.openide.awt.Mnemonics.setLocalizedText(fileTypeLabel, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.fileTypeLabel.text")); // NOI18N
@ -1262,6 +1304,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
scoreList.setEnabled(enabled && scoreCheckbox.isSelected());
exifCheckbox.setEnabled(enabled);
notableCheckbox.setEnabled(enabled);
knownFilesCheckbox.setEnabled(enabled);
parentCheckbox.setEnabled(enabled);
parentScrollPane.setEnabled(enabled && parentCheckbox.isSelected());
parentList.setEnabled(enabled && parentCheckbox.isSelected());
@ -1270,6 +1313,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
deleteButton.setEnabled(enabled && parentCheckbox.isSelected() && !parentListModel.isEmpty());
fullRadioButton.setEnabled(enabled && parentCheckbox.isSelected());
substringRadioButton.setEnabled(enabled && parentCheckbox.isSelected());
includeRadioButton.setEnabled(enabled && parentCheckbox.isSelected());
excludeRadioButton.setEnabled(enabled && parentCheckbox.isSelected());
}
/**
@ -1300,6 +1345,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
parentList.setEnabled(parentCheckbox.isSelected());
fullRadioButton.setEnabled(parentCheckbox.isSelected());
substringRadioButton.setEnabled(parentCheckbox.isSelected());
includeRadioButton.setEnabled(parentCheckbox.isSelected());
excludeRadioButton.setEnabled(parentCheckbox.isSelected());
parentTextField.setEnabled(parentCheckbox.isSelected());
addButton.setEnabled(parentCheckbox.isSelected());
deleteButton.setEnabled(parentCheckbox.isSelected() && !parentListModel.isEmpty());
@ -1320,13 +1367,10 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
if (!parentTextField.getText().isEmpty()) {
ParentSearchTerm searchTerm;
if (fullRadioButton.isSelected()) {
searchTerm = new ParentSearchTerm(parentTextField.getText(), true);
} else {
searchTerm = new ParentSearchTerm(parentTextField.getText(), false);
}
searchTerm = new ParentSearchTerm(parentTextField.getText(), fullRadioButton.isSelected(), includeRadioButton.isSelected());
parentListModel.add(parentListModel.size(), searchTerm);
validateFields();
parentTextField.setText("");
}
}//GEN-LAST:event_addButtonActionPerformed
@ -1396,6 +1440,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JScrollPane dataSourceScrollPane;
private javax.swing.JButton deleteButton;
private javax.swing.JLabel errorLabel;
private javax.swing.JRadioButton excludeRadioButton;
private javax.swing.JCheckBox exifCheckbox;
private javax.swing.JComboBox<FileType> fileTypeComboBox;
private javax.swing.JLabel fileTypeLabel;
@ -1408,12 +1453,14 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JCheckBox hashSetCheckbox;
private javax.swing.JList<String> hashSetList;
private javax.swing.JScrollPane hashSetScrollPane;
private javax.swing.JRadioButton includeRadioButton;
private javax.swing.JCheckBox interestingItemsCheckbox;
private javax.swing.JList<String> interestingItemsList;
private javax.swing.JScrollPane interestingItemsScrollPane;
private javax.swing.JCheckBox keywordCheckbox;
private javax.swing.JList<String> keywordList;
private javax.swing.JScrollPane keywordScrollPane;
private javax.swing.JCheckBox knownFilesCheckbox;
private javax.swing.JCheckBox notableCheckbox;
private javax.swing.JCheckBox objectsCheckbox;
private javax.swing.JList<String> objectsList;
@ -1422,10 +1469,10 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JLabel orderByLabel;
private javax.swing.ButtonGroup orderGroupsByButtonGroup;
private javax.swing.JLabel orderGroupsByLabel;
private javax.swing.ButtonGroup parentButtonGroup;
private javax.swing.JCheckBox parentCheckbox;
private javax.swing.JLabel parentLabel;
private javax.swing.JList<ParentSearchTerm> parentList;
private javax.swing.ButtonGroup parentPathButtonGroup;
private javax.swing.JScrollPane parentScrollPane;
private javax.swing.JTextField parentTextField;
private javax.swing.JCheckBox scoreCheckbox;