Merge branch '3788-intercase-correlation' of https://github.com/briangsweeney/autopsy into 3788-intercase-correlation

This commit is contained in:
Brian Sweeney 2018-05-11 13:13:50 -06:00
commit aa10c0b071
10 changed files with 921 additions and 415 deletions

View File

@ -178,7 +178,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public synchronized CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException { public synchronized CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException {
// check if there is already an existing CorrelationCase for this Case // check if there is already an existing CorrelationCase for this Case
CorrelationCase cRCase = getCaseByUUID(eamCase.getCaseUUID()); CorrelationCase cRCase = getCaseByUUID(eamCase.getCaseUUID());
if (cRCase != null) { if (cRCase != null) {
@ -279,10 +279,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void updateCase(CorrelationCase eamCase) throws EamDbException { public void updateCase(CorrelationCase eamCase) throws EamDbException {
if(eamCase == null) { if (eamCase == null) {
throw new EamDbException("CorrelationCase argument is null"); throw new EamDbException("CorrelationCase argument is null");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -457,10 +457,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public CorrelationDataSource getDataSource(CorrelationCase correlationCase, String dataSourceDeviceId) throws EamDbException { public CorrelationDataSource getDataSource(CorrelationCase correlationCase, String dataSourceDeviceId) throws EamDbException {
if(correlationCase == null) { if (correlationCase == null) {
throw new EamDbException("CorrelationCase argument is null"); throw new EamDbException("CorrelationCase argument is null");
} }
Connection conn = connect(); Connection conn = connect();
CorrelationDataSource eamDataSourceResult = null; CorrelationDataSource eamDataSourceResult = null;
@ -530,16 +530,16 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void addArtifact(CorrelationAttribute eamArtifact) throws EamDbException { public void addArtifact(CorrelationAttribute eamArtifact) throws EamDbException {
if(eamArtifact == null) { if (eamArtifact == null) {
throw new EamDbException("CorrelationAttribute is null"); throw new EamDbException("CorrelationAttribute is null");
} }
if(eamArtifact.getCorrelationType() == null) { if (eamArtifact.getCorrelationType() == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
if(eamArtifact.getCorrelationValue() == null) { if (eamArtifact.getCorrelationValue() == null) {
throw new EamDbException("Correlation value is null"); throw new EamDbException("Correlation value is null");
} }
Connection conn = connect(); Connection conn = connect();
List<CorrelationAttributeInstance> eamInstances = eamArtifact.getInstances(); List<CorrelationAttributeInstance> eamInstances = eamArtifact.getInstances();
@ -554,21 +554,21 @@ public abstract class AbstractSqlEamDb implements EamDb {
sql.append("VALUES ((SELECT id FROM cases WHERE case_uid=? LIMIT 1), "); sql.append("VALUES ((SELECT id FROM cases WHERE case_uid=? LIMIT 1), ");
sql.append("(SELECT id FROM data_sources WHERE device_id=? AND case_id=? LIMIT 1), ?, ?, ?, ?) "); sql.append("(SELECT id FROM data_sources WHERE device_id=? AND case_id=? LIMIT 1), ?, ?, ?, ?) ");
sql.append(getConflictClause()); sql.append(getConflictClause());
try { try {
preparedStatement = conn.prepareStatement(sql.toString()); preparedStatement = conn.prepareStatement(sql.toString());
for (CorrelationAttributeInstance eamInstance : eamInstances) { for (CorrelationAttributeInstance eamInstance : eamInstances) {
if (!eamArtifact.getCorrelationValue().isEmpty()) { if (!eamArtifact.getCorrelationValue().isEmpty()) {
if(eamInstance.getCorrelationCase() == null) { if (eamInstance.getCorrelationCase() == null) {
throw new EamDbException("CorrelationAttributeInstance has null case"); throw new EamDbException("CorrelationAttributeInstance has null case");
} }
if(eamInstance.getCorrelationDataSource() == null) { if (eamInstance.getCorrelationDataSource() == null) {
throw new EamDbException("CorrelationAttributeInstance has null data source"); throw new EamDbException("CorrelationAttributeInstance has null data source");
} }
if(eamInstance.getKnownStatus() == null) { if (eamInstance.getKnownStatus() == null) {
throw new EamDbException("CorrelationAttributeInstance has null known status"); throw new EamDbException("CorrelationAttributeInstance has null known status");
} }
preparedStatement.setString(1, eamInstance.getCorrelationCase().getCaseUUID()); preparedStatement.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
preparedStatement.setString(2, eamInstance.getCorrelationDataSource().getDeviceID()); preparedStatement.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
preparedStatement.setInt(3, eamInstance.getCorrelationDataSource().getCaseID()); preparedStatement.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
@ -605,7 +605,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public List<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException { public List<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
@ -647,6 +647,82 @@ public abstract class AbstractSqlEamDb implements EamDb {
return artifactInstances; return artifactInstances;
} }
/**
* Retrieves eamArtiifact instances from the database that match
* the given list of MD5 values and optionally filters by given case.
*
* @param correlationCase Case id to search on, if null, searches all cases
* @param values List of ArtifactInstance MD5 values to find matches of.
*
* @return List of artifact instances for a given list of MD5 values
*/
@Override
public List<CorrelationAttributeCommonInstance> getArtifactInstancesByCaseValues(CorrelationCase correlationCase, List<String> values) throws EamDbException {
CorrelationAttribute.Type aType = CorrelationAttribute.getDefaultCorrelationTypes().get(0); // Files type
if (aType == null) {
throw new EamDbException("Correlation Type is null");
}
boolean singleCase = false;
if (correlationCase != null) {
singleCase = false;
}
Connection conn = connect();
List<CorrelationAttributeCommonInstance> artifactInstances = new ArrayList<>();
CorrelationAttributeCommonInstance artifactInstance;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String valuesString = "";
StringBuilder valuesFilter = new StringBuilder(values.size());
if (!values.isEmpty()) {
for (String value : values) {
valuesFilter.append("'").append(value).append("',");
}
valuesString = valuesFilter.toString().substring(0, valuesFilter.length() - 1);
}
String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType);
StringBuilder sql = new StringBuilder(9);
sql.append("SELECT cases.case_name, cases.case_uid, data_sources.name, device_id, file_path, known_status, comment, data_sources.case_id, value FROM ");
sql.append(tableName);
sql.append(" LEFT JOIN cases ON ");
sql.append(tableName);
sql.append(".case_id=cases.id");
sql.append(" LEFT JOIN data_sources ON ");
sql.append(tableName);
sql.append(".data_source_id=data_sources.id");
sql.append(" WHERE value IN (?)");
if (singleCase) {
sql.append(" AND ");
sql.append(tableName);
sql.append(".case_id = ?");
}
try {
preparedStatement = conn.prepareStatement(sql.toString());
preparedStatement.setString(1, valuesString);
if (singleCase && correlationCase != null) {
preparedStatement.setString(2, String.valueOf(correlationCase.getID()));
}
resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
artifactInstance = getCommonEamArtifactInstanceFromResultSet(resultSet);
artifactInstances.add(artifactInstance);
}
} catch (SQLException ex) {
throw new EamDbException("Error getting artifact instances by artifactType and artifactValue.", ex); // NON-NLS
} finally {
EamDbUtil.closePreparedStatement(preparedStatement);
EamDbUtil.closeResultSet(resultSet);
EamDbUtil.closeConnection(conn);
}
return artifactInstances;
}
/** /**
* Retrieves eamArtifact instances from the database that are associated * Retrieves eamArtifact instances from the database that are associated
* with the aType and filePath * with the aType and filePath
@ -660,10 +736,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public List<CorrelationAttributeInstance> getArtifactInstancesByPath(CorrelationAttribute.Type aType, String filePath) throws EamDbException { public List<CorrelationAttributeInstance> getArtifactInstancesByPath(CorrelationAttribute.Type aType, String filePath) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
if(filePath == null) { if (filePath == null) {
throw new EamDbException("Correlation value is null"); throw new EamDbException("Correlation value is null");
} }
Connection conn = connect(); Connection conn = connect();
@ -717,13 +793,13 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public Long getCountArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException { public Long getCountArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
if(value == null) { if (value == null) {
throw new EamDbException("Correlation value is null"); throw new EamDbException("Correlation value is null");
} }
Connection conn = connect(); Connection conn = connect();
Long instanceCount = 0L; Long instanceCount = 0L;
@ -776,10 +852,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException { public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
Long instanceCount = 0L; Long instanceCount = 0L;
@ -901,10 +977,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
@Override @Override
public void prepareBulkArtifact(CorrelationAttribute eamArtifact) throws EamDbException { public void prepareBulkArtifact(CorrelationAttribute eamArtifact) throws EamDbException {
if(eamArtifact.getCorrelationType() == null) { if (eamArtifact.getCorrelationType() == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
synchronized (bulkArtifacts) { synchronized (bulkArtifacts) {
bulkArtifacts.get(eamArtifact.getCorrelationType().getDbTableName()).add(eamArtifact); bulkArtifacts.get(eamArtifact.getCorrelationType().getDbTableName()).add(eamArtifact);
bulkArtifactsCount++; bulkArtifactsCount++;
@ -958,17 +1034,17 @@ public abstract class AbstractSqlEamDb implements EamDb {
for (CorrelationAttributeInstance eamInstance : eamInstances) { for (CorrelationAttributeInstance eamInstance : eamInstances) {
if (!eamArtifact.getCorrelationValue().isEmpty()) { if (!eamArtifact.getCorrelationValue().isEmpty()) {
if(eamInstance.getCorrelationCase() == null) { if (eamInstance.getCorrelationCase() == null) {
throw new EamDbException("Correlation attribute instance has null case"); throw new EamDbException("Correlation attribute instance has null case");
} }
if(eamInstance.getCorrelationDataSource() == null) { if (eamInstance.getCorrelationDataSource() == null) {
throw new EamDbException("Correlation attribute instance has null data source"); throw new EamDbException("Correlation attribute instance has null data source");
} }
if(eamInstance.getKnownStatus()== null) { if (eamInstance.getKnownStatus() == null) {
throw new EamDbException("Correlation attribute instance has null known known status"); throw new EamDbException("Correlation attribute instance has null known known status");
} }
bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID()); bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID()); bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID()); bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
@ -1005,16 +1081,16 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException { public void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException {
if(cases == null) { if (cases == null) {
throw new EamDbException("cases argument is null"); throw new EamDbException("cases argument is null");
} }
if (cases.isEmpty()) { if (cases.isEmpty()) {
return; return;
} }
Connection conn = connect(); Connection conn = connect();
int counter = 0; int counter = 0;
PreparedStatement bulkPs = null; PreparedStatement bulkPs = null;
try { try {
@ -1081,38 +1157,38 @@ public abstract class AbstractSqlEamDb implements EamDb {
} }
/** /**
* Sets an eamArtifact instance to the given knownStatus. * Sets an eamArtifact instance to the given knownStatus. knownStatus should
* knownStatus should be BAD if the file has been tagged with a notable tag and * be BAD if the file has been tagged with a notable tag and UNKNOWN
* UNKNOWN otherwise. If eamArtifact * otherwise. If eamArtifact exists, it is updated. If eamArtifact does not
* exists, it is updated. If eamArtifact does not exist it is added with the * exist it is added with the given status.
* given status.
* *
* @param eamArtifact Artifact containing exactly one (1) ArtifactInstance. * @param eamArtifact Artifact containing exactly one (1) ArtifactInstance.
* @param knownStatus The status to change the artifact to. Should never be KNOWN * @param knownStatus The status to change the artifact to. Should never be
* KNOWN
*/ */
@Override @Override
public void setArtifactInstanceKnownStatus(CorrelationAttribute eamArtifact, TskData.FileKnown knownStatus) throws EamDbException { public void setArtifactInstanceKnownStatus(CorrelationAttribute eamArtifact, TskData.FileKnown knownStatus) throws EamDbException {
if(eamArtifact == null) { if (eamArtifact == null) {
throw new EamDbException("Correlation attribute is null"); throw new EamDbException("Correlation attribute is null");
} }
if(knownStatus == null) { if (knownStatus == null) {
throw new EamDbException("Known status is null"); throw new EamDbException("Known status is null");
} }
if (1 != eamArtifact.getInstances().size()) { if (1 != eamArtifact.getInstances().size()) {
throw new EamDbException("Error: Artifact must have exactly one (1) Artifact Instance to set as notable."); // NON-NLS throw new EamDbException("Error: Artifact must have exactly one (1) Artifact Instance to set as notable."); // NON-NLS
} }
List<CorrelationAttributeInstance> eamInstances = eamArtifact.getInstances(); List<CorrelationAttributeInstance> eamInstances = eamArtifact.getInstances();
CorrelationAttributeInstance eamInstance = eamInstances.get(0); CorrelationAttributeInstance eamInstance = eamInstances.get(0);
if(eamInstance.getCorrelationCase() == null) { if (eamInstance.getCorrelationCase() == null) {
throw new EamDbException("Correlation case is null"); throw new EamDbException("Correlation case is null");
} }
if(eamInstance.getCorrelationDataSource() == null) { if (eamInstance.getCorrelationDataSource() == null) {
throw new EamDbException("Correlation data source is null"); throw new EamDbException("Correlation data source is null");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedUpdate = null; PreparedStatement preparedUpdate = null;
PreparedStatement preparedQuery = null; PreparedStatement preparedQuery = null;
@ -1196,10 +1272,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException { public List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
List<CorrelationAttributeInstance> artifactInstances = new ArrayList<>(); List<CorrelationAttributeInstance> artifactInstances = new ArrayList<>();
@ -1250,10 +1326,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public Long getCountArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException { public Long getCountArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
Long badInstances = 0L; Long badInstances = 0L;
@ -1298,10 +1374,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public List<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException { public List<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
Collection<String> caseNames = new LinkedHashSet<>(); Collection<String> caseNames = new LinkedHashSet<>();
@ -1418,7 +1494,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
@Override @Override
public boolean referenceSetIsValid(int referenceSetID, String setName, String version) throws EamDbException { public boolean referenceSetIsValid(int referenceSetID, String setName, String version) throws EamDbException {
EamGlobalSet refSet = this.getReferenceSetByID(referenceSetID); EamGlobalSet refSet = this.getReferenceSetByID(referenceSetID);
if(refSet == null) { if (refSet == null) {
return false; return false;
} }
@ -1487,7 +1563,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public boolean isArtifactKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException { public boolean isArtifactKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("null correlation type"); throw new EamDbException("null correlation type");
} }
@ -1532,10 +1608,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public long newOrganization(EamOrganization eamOrg) throws EamDbException { public long newOrganization(EamOrganization eamOrg) throws EamDbException {
if(eamOrg == null) { if (eamOrg == null) {
throw new EamDbException("EamOrganization is null"); throw new EamDbException("EamOrganization is null");
} }
Connection conn = connect(); Connection conn = connect();
ResultSet generatedKeys = null; ResultSet generatedKeys = null;
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -1642,7 +1718,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
public EamOrganization getReferenceSetOrganization(int referenceSetID) throws EamDbException { public EamOrganization getReferenceSetOrganization(int referenceSetID) throws EamDbException {
EamGlobalSet globalSet = getReferenceSetByID(referenceSetID); EamGlobalSet globalSet = getReferenceSetByID(referenceSetID);
if(globalSet == null) { if (globalSet == null) {
throw new EamDbException("Reference set with ID " + referenceSetID + " not found"); throw new EamDbException("Reference set with ID " + referenceSetID + " not found");
} }
return (getOrganizationByID(globalSet.getOrgID())); return (getOrganizationByID(globalSet.getOrgID()));
@ -1658,10 +1734,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void updateOrganization(EamOrganization updatedOrganization) throws EamDbException { public void updateOrganization(EamOrganization updatedOrganization) throws EamDbException {
if(updatedOrganization == null) { if (updatedOrganization == null) {
throw new EamDbException("null updatedOrganization"); throw new EamDbException("null updatedOrganization");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
String sql = "UPDATE organizations SET org_name = ?, poc_name = ?, poc_email = ?, poc_phone = ? WHERE id = ?"; String sql = "UPDATE organizations SET org_name = ?, poc_name = ?, poc_email = ?, poc_phone = ? WHERE id = ?";
@ -1686,10 +1762,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
"AbstractSqlEamDb.deleteOrganization.errorDeleting.message=Error executing query when attempting to delete organization by id."}) "AbstractSqlEamDb.deleteOrganization.errorDeleting.message=Error executing query when attempting to delete organization by id."})
@Override @Override
public void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException { public void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException {
if(organizationToDelete == null) { if (organizationToDelete == null) {
throw new EamDbException("Organization to delete is null"); throw new EamDbException("Organization to delete is null");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement checkIfUsedStatement = null; PreparedStatement checkIfUsedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
@ -1729,18 +1805,18 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException { public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException {
if(eamGlobalSet == null){ if (eamGlobalSet == null) {
throw new EamDbException("EamGlobalSet argument is null"); throw new EamDbException("EamGlobalSet argument is null");
} }
if(eamGlobalSet.getFileKnownStatus() == null){ if (eamGlobalSet.getFileKnownStatus() == null) {
throw new EamDbException("File known status on the EamGlobalSet is null"); throw new EamDbException("File known status on the EamGlobalSet is null");
} }
if(eamGlobalSet.getType() == null){ if (eamGlobalSet.getType() == null) {
throw new EamDbException("Type on the EamGlobalSet is null"); throw new EamDbException("Type on the EamGlobalSet is null");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement1 = null; PreparedStatement preparedStatement1 = null;
@ -1803,7 +1879,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
preparedStatement1 = conn.prepareStatement(sql1); preparedStatement1 = conn.prepareStatement(sql1);
preparedStatement1.setInt(1, referenceSetID); preparedStatement1.setInt(1, referenceSetID);
resultSet = preparedStatement1.executeQuery(); resultSet = preparedStatement1.executeQuery();
if(resultSet.next()) { if (resultSet.next()) {
return getEamGlobalSetFromResultSet(resultSet); return getEamGlobalSetFromResultSet(resultSet);
} else { } else {
return null; return null;
@ -1822,18 +1898,18 @@ public abstract class AbstractSqlEamDb implements EamDb {
* Get all reference sets * Get all reference sets
* *
* @param correlationType Type of sets to return * @param correlationType Type of sets to return
* *
* @return List of all reference sets in the central repository * @return List of all reference sets in the central repository
* *
* @throws EamDbException * @throws EamDbException
*/ */
@Override @Override
public List<EamGlobalSet> getAllReferenceSets(CorrelationAttribute.Type correlationType) throws EamDbException { public List<EamGlobalSet> getAllReferenceSets(CorrelationAttribute.Type correlationType) throws EamDbException {
if(correlationType == null){ if (correlationType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
List<EamGlobalSet> results = new ArrayList<>(); List<EamGlobalSet> results = new ArrayList<>();
Connection conn = connect(); Connection conn = connect();
@ -1868,13 +1944,13 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttribute.Type correlationType) throws EamDbException { public void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttribute.Type correlationType) throws EamDbException {
if(eamGlobalFileInstance.getKnownStatus() == null){ if (eamGlobalFileInstance.getKnownStatus() == null) {
throw new EamDbException("known status of EamGlobalFileInstance is null"); throw new EamDbException("known status of EamGlobalFileInstance is null");
} }
if(correlationType == null){ if (correlationType == null) {
throw new EamDbException("Correlation type is null"); throw new EamDbException("Correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -1939,10 +2015,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public void bulkInsertReferenceTypeEntries(Set<EamGlobalFileInstance> globalInstances, CorrelationAttribute.Type contentType) throws EamDbException { public void bulkInsertReferenceTypeEntries(Set<EamGlobalFileInstance> globalInstances, CorrelationAttribute.Type contentType) throws EamDbException {
if(contentType == null) { if (contentType == null) {
throw new EamDbException("Null correlation type"); throw new EamDbException("Null correlation type");
} }
if(globalInstances == null) { if (globalInstances == null) {
throw new EamDbException("Null set of EamGlobalFileInstance"); throw new EamDbException("Null set of EamGlobalFileInstance");
} }
@ -1959,10 +2035,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
bulkPs = conn.prepareStatement(String.format(sql, EamDbUtil.correlationTypeToReferenceTableName(contentType))); bulkPs = conn.prepareStatement(String.format(sql, EamDbUtil.correlationTypeToReferenceTableName(contentType)));
for (EamGlobalFileInstance globalInstance : globalInstances) { for (EamGlobalFileInstance globalInstance : globalInstances) {
if(globalInstance.getKnownStatus() == null){ if (globalInstance.getKnownStatus() == null) {
throw new EamDbException("EamGlobalFileInstance with value " + globalInstance.getMD5Hash() + " has null known status"); throw new EamDbException("EamGlobalFileInstance with value " + globalInstance.getMD5Hash() + " has null known status");
} }
bulkPs.setInt(1, globalInstance.getGlobalSetID()); bulkPs.setInt(1, globalInstance.getGlobalSetID());
bulkPs.setString(2, globalInstance.getMD5Hash()); bulkPs.setString(2, globalInstance.getMD5Hash());
bulkPs.setByte(3, globalInstance.getKnownStatus().getFileKnownValue()); bulkPs.setByte(3, globalInstance.getKnownStatus().getFileKnownValue());
@ -1997,10 +2073,10 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/ */
@Override @Override
public List<EamGlobalFileInstance> getReferenceInstancesByTypeValue(CorrelationAttribute.Type aType, String aValue) throws EamDbException { public List<EamGlobalFileInstance> getReferenceInstancesByTypeValue(CorrelationAttribute.Type aType, String aValue) throws EamDbException {
if(aType == null) { if (aType == null) {
throw new EamDbException("correlation type is null"); throw new EamDbException("correlation type is null");
} }
Connection conn = connect(); Connection conn = connect();
List<EamGlobalFileInstance> globalFileInstances = new ArrayList<>(); List<EamGlobalFileInstance> globalFileInstances = new ArrayList<>();
@ -2040,7 +2116,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
if (newType == null) { if (newType == null) {
throw new EamDbException("null correlation type"); throw new EamDbException("null correlation type");
} }
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -2245,7 +2321,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
preparedStatement = conn.prepareStatement(sql); preparedStatement = conn.prepareStatement(sql);
preparedStatement.setInt(1, typeId); preparedStatement.setInt(1, typeId);
resultSet = preparedStatement.executeQuery(); resultSet = preparedStatement.executeQuery();
if(resultSet.next()) { if (resultSet.next()) {
aType = getCorrelationTypeFromResultSet(resultSet); aType = getCorrelationTypeFromResultSet(resultSet);
return aType; return aType;
} else { } else {
@ -2356,6 +2432,32 @@ public abstract class AbstractSqlEamDb implements EamDb {
return eamArtifactInstance; return eamArtifactInstance;
} }
/**
* Convert a ResultSet to a Common EamArtifactInstance object
*
* @param resultSet A resultSet with a set of values to create a
* EamArtifactInstance object.
*
* @return fully populated EamArtifactInstance, or null
*
* @throws SQLException when an expected column name is not in the resultSet
*/
private CorrelationAttributeCommonInstance getCommonEamArtifactInstanceFromResultSet(ResultSet resultSet) throws SQLException, EamDbException {
if (null == resultSet) {
return null;
}
CorrelationAttributeCommonInstance eamArtifactInstance = new CorrelationAttributeCommonInstance(
new CorrelationCase(resultSet.getInt("case_id"), resultSet.getString("case_uid"), resultSet.getString("case_name")),
new CorrelationDataSource(-1, resultSet.getInt("case_id"), resultSet.getString("device_id"), resultSet.getString("name")),
resultSet.getString("file_path"),
resultSet.getString("comment"),
TskData.FileKnown.valueOf(resultSet.getByte("known_status")),
resultSet.getString("value")
);
return eamArtifactInstance;
}
private EamOrganization getEamOrganizationFromResultSet(ResultSet resultSet) throws SQLException { private EamOrganization getEamOrganizationFromResultSet(ResultSet resultSet) throws SQLException {
if (null == resultSet) { if (null == resultSet) {
return null; return null;

View File

@ -0,0 +1,46 @@
/*
* Central Repository
*
* Copyright 2015-2017 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.centralrepository.datamodel;
import org.sleuthkit.datamodel.TskData;
/**
* Common Files Search usage which extends CorrelationAttributeInstance
* by adding the MD5 value to match on for the results table.
*/
public class CorrelationAttributeCommonInstance extends CorrelationAttributeInstance {
private static final long serialVersionUID = 1L;
/**
* The common MD5 value
*/
private final String value;
public CorrelationAttributeCommonInstance(CorrelationCase eamCase, CorrelationDataSource eamDataSource, String filePath, String comment, TskData.FileKnown knownStatus, String value) throws EamDbException {
super(eamCase, eamDataSource, filePath, comment, knownStatus);
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@ -178,7 +178,7 @@ public interface EamDb {
* @return List of cases * @return List of cases
*/ */
List<CorrelationCase> getCases() throws EamDbException; List<CorrelationCase> getCases() throws EamDbException;
/** /**
* Creates new Data Source in the database * Creates new Data Source in the database
* *
@ -223,6 +223,17 @@ public interface EamDb {
*/ */
List<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException; List<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttribute.Type aType, String value) throws EamDbException;
/**
* Retrieves eamArtiifact instances from the database that match the given
* list of MD5 values;
*
* @param correlationCase Case id to search on
* @param values List of ArtifactInstance MD5 values to find matches of.
*
* @return List of artifact instances for a given list of MD5 values
*/
List<CorrelationAttributeCommonInstance> getArtifactInstancesByCaseValues(CorrelationCase correlationCase, List<String> values) throws EamDbException;
/** /**
* Retrieves eamArtifact instances from the database that are associated * Retrieves eamArtifact instances from the database that are associated
* with the aType and filePath * with the aType and filePath

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.centralrepository.datamodel;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;

View File

@ -0,0 +1,58 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 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.commonfilesearch;
import java.util.Map;
import static org.sleuthkit.autopsy.commonfilesearch.CommonFilesMetadataBuilder.SELECT_PREFIX;
/**
* Provides logic for selecting common files from all data sources for all files to source for EamDB query.
*/
public class AllDataSourcesEamDbCommonFilesAlgorithm extends CommonFilesMetadataBuilder {
private static final String WHERE_CLAUSE = "%s md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL)%s GROUP BY md5) order by md5"; //NON-NLS
/**
* Implements the algorithm for getting common files across all data
* sources.
*
* @param dataSourceIdMap a map of obj_id to datasource name
* @param filterByMediaMimeType match only on files whose mime types can be broadly categorized as media types
* @param filterByDocMimeType match only on files whose mime types can be broadly categorized as document types
*/
AllDataSourcesEamDbCommonFilesAlgorithm(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
}
@Override
protected String buildSqlSelectStatement() {
Object[] args = new String[]{SELECT_PREFIX, determineMimeTypeFilter()};
return String.format(WHERE_CLAUSE, args);
}
@Override
protected String buildTabTitle() {
final String buildCategorySelectionString = this.buildCategorySelectionString();
final String titleTemplate = Bundle.CommonFilesMetadataBuilder_buildTabTitle_titleEamDb();
return String.format(titleTemplate, new Object[]{buildCategorySelectionString});
}
}

View File

@ -1,15 +1,21 @@
CommonFilesPanel.searchButton.text=Search CommonFilesPanel.searchButton.text=Search
CommonFilesPanel.withinDataSourceRadioButton.text=At least one instance of a given MD5 must appear in the data source selected below: CommonFilesPanel.withinDataSourceRadioButton.text=At least one match must appear in the data source selected below:
CommonFilesPanel.allDataSourcesRadioButton.text=Files can be in any data source CommonFilesPanel.allDataSourcesRadioButton.text=Matches may be from any data source
CommonFilesPanel.cancelButton.text=Cancel CommonFilesPanel.cancelButton.text=Cancel
CommonFilesPanel.cancelButton.actionCommand=Cancel CommonFilesPanel.cancelButton.actionCommand=Cancel
CommonFilesPanel.selectedFileCategoriesButton.text=Match on the following file categories: CommonFilesPanel.selectedFileCategoriesButton.text=Match on the following file categories:
CommonFilesPanel.selectedFileCategoriesButton.toolTipText=Select from the options below... CommonFilesPanel.selectedFileCategoriesButton.toolTipText=Select from the options below...
CommonFilesPanel.pictureVideoCheckbox.text=Pictures and Videos CommonFilesPanel.pictureVideoCheckbox.text=Pictures and Videos
CommonFilesPanel.documentsCheckbox.text=Documents CommonFilesPanel.documentsCheckbox.text=Documents
CommonFilesPanel.commonFilesSearchLabel.text=<html>Find duplicate files in the current case.</html>
CommonFilesPanel.allFileCategoriesRadioButton.toolTipText=No filtering applied to results... CommonFilesPanel.allFileCategoriesRadioButton.toolTipText=No filtering applied to results...
CommonFilesPanel.allFileCategoriesRadioButton.text=Match on all file types CommonFilesPanel.allFileCategoriesRadioButton.text=Match on all file types
CommonFilesPanel.text=Indicate which data sources to consider while searching for duplicates: CommonFilesPanel.text=Indicate which data sources to consider while searching for duplicates:
CommonFilesPanel.categoriesLabel.text=Indicate which file types to include in results: CommonFilesPanel.categoriesLabel.text=Indicate which file types to include in results:
CommonFilesPanel.errorText.text=In order to search, you must select a file category. CommonFilesPanel.errorText.text=In order to search, you must select a file category.
CommonFilesPanel.commonFilesSearchLabel1.text=<html>Find Common Files.</html>
CommonFilesPanel.jRadioButton1.text=jRadioButton1
CommonFilesPanel.jRadioButton2.text=Correlate amongst external cases (compares files in current case with Central Repo)
CommonFilesPanel.intraCaseRadio.label=Correlate within current case only
CommonFilesPanel.interCaseRadio.label=Correlate amongst all known cases (uses Central Repo)
CommonFilesPanel.anCentralRepoCaseRadio.text_1=Matches may be from any Central Repo case
CommonFilesPanel.specificCentralRepoCaseRadio.text_1=Matches must be from the following Central Repo case:

View File

@ -22,16 +22,25 @@ package org.sleuthkit.autopsy.commonfilesearch;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeCommonInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import static org.sleuthkit.autopsy.timeline.datamodel.eventtype.ArtifactEventType.LOGGER;
import org.sleuthkit.datamodel.HashUtility; import org.sleuthkit.datamodel.HashUtility;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
@ -201,6 +210,64 @@ abstract class CommonFilesMetadataBuilder {
return new CommonFilesMetadata(commonFiles); return new CommonFilesMetadata(commonFiles);
} }
/**
* TODO Refactor, abstract shared code above, call this method via new AllDataSourcesEamDbCommonFilesAlgorithm Class
* @param correlationCase Optionally null, otherwise a case, or could be a CR case ID
* @return
* @throws TskCoreException
* @throws NoCurrentCaseException
* @throws SQLException
* @throws EamDbException
*/
public CommonFilesMetadata findEamDbCommonFiles(CorrelationCase correlationCase) throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException {
CommonFilesMetadata metaData = this.findCommonFiles();
Map<String, Md5Metadata> commonFiles = metaData.getMetadata();
List<String> values = Arrays.asList((String[]) commonFiles.keySet().toArray());
Map<String, Md5Metadata> interCaseCommonFiles = metaData.getMetadata();
try {
EamDb dbManager = EamDb.getInstance();
Collection<CorrelationAttributeCommonInstance> artifactInstances = dbManager.getArtifactInstancesByCaseValues(correlationCase, values).stream()
.collect(Collectors.toList());
for (CorrelationAttributeCommonInstance instance : artifactInstances) {
//Long objectId = 1L; //TODO, need to retrieve ALL (even count < 2) AbstractFiles from this case to us for objectId for CR matches;
String md5 = instance.getValue();
String dataSource = instance.getCorrelationDataSource().getName();
if (md5 == null || HashUtility.isNoDataMd5(md5)) {
continue;
}
//Builds a 3rd list which contains instances which are in commonFiles map, uses current case objectId
if (commonFiles.containsKey(md5)) {
// TODO sloppy, but we don't *have* all the information for the rows in the CR, so what do we do?
Long objectId = commonFiles.get(md5).getMetadata().iterator().next().getObjectId();
if(interCaseCommonFiles.containsKey(md5)) {
//Add to intercase metaData
final Md5Metadata md5Metadata = interCaseCommonFiles.get(md5);
md5Metadata.addFileInstanceMetadata(new FileInstanceMetadata(objectId, dataSource));
} else {
// Create new intercase metadata
final Md5Metadata md5Metadata = commonFiles.get(md5);
md5Metadata.addFileInstanceMetadata(new FileInstanceMetadata(objectId, dataSource));
interCaseCommonFiles.put(md5, md5Metadata);
}
} else {
// TODO This should never happen. All current case files with potential matches are in comonFiles Map.
}
}
} catch (EamDbException ex) {
LOGGER.log(Level.SEVERE, "Error getting artifact instances from database.", ex); // NON-NLS
}
// Builds intercase-only matches metadata
return new CommonFilesMetadata(interCaseCommonFiles);
}
/** /**
* Should be used by subclasses, in their * Should be used by subclasses, in their
@ -235,7 +302,8 @@ abstract class CommonFilesMetadataBuilder {
@NbBundle.Messages({ @NbBundle.Messages({
"CommonFilesMetadataBuilder.buildTabTitle.titleAll=Common Files (All Data Sources, %s)", "CommonFilesMetadataBuilder.buildTabTitle.titleAll=Common Files (All Data Sources, %s)",
"CommonFilesMetadataBuilder.buildTabTitle.titleSingle=Common Files (Match Within Data Source: %s, %s)" "CommonFilesMetadataBuilder.buildTabTitle.titleSingle=Common Files (Match Within Data Source: %s, %s)",
"CommonFilesMetadataBuilder.buildTabTitle.titleEamDb=Common Files (Central Repository Source(s), %s)",
}) })
protected abstract String buildTabTitle(); protected abstract String buildTabTitle();

View File

@ -6,6 +6,10 @@
</Component> </Component>
<Component class="javax.swing.ButtonGroup" name="fileTypeFilterButtonGroup"> <Component class="javax.swing.ButtonGroup" name="fileTypeFilterButtonGroup">
</Component> </Component>
<Component class="javax.swing.ButtonGroup" name="interIntraButtonGroup">
</Component>
<Component class="javax.swing.ButtonGroup" name="caseSelectionButtonGroup">
</Component>
</NonVisualComponents> </NonVisualComponents>
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
@ -23,45 +27,72 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="102" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="errorText" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="categoriesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="commonFilesSearchLabel" min="-2" max="-2" attributes="0"/>
<Component id="dataSourceLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace min="6" pref="6" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="commonFilesSearchLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="categoriesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/> <EmptySpace min="6" pref="6" max="-2" attributes="0"/>
<Component id="selectDataSourceComboBox" min="-2" pref="261" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Component id="allFileCategoriesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="selectedFileCategoriesButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pictureVideoCheckbox" min="-2" max="-2" attributes="0"/>
<Component id="documentsCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group> </Group>
<Component id="withinDataSourceRadioButton" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="intraCaseRadio" min="-2" max="-2" attributes="0"/>
<Component id="allDataSourcesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/> <Group type="102" attributes="0">
<Component id="allFileCategoriesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/> <EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Component id="selectedFileCategoriesButton" alignment="0" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Component id="withinDataSourceRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="allDataSourcesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="47" max="-2" attributes="0"/>
<Component id="selectDataSourceComboBox" min="-2" pref="261" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="interCaseRadio" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/> <EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="pictureVideoCheckbox" min="-2" max="-2" attributes="0"/> <Component id="anCentralRepoCaseRadio" min="-2" max="-2" attributes="0"/>
<Component id="documentsCheckbox" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="specificCentralRepoCaseRadio" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="caseComboBox" min="-2" pref="261" max="-2" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
</Group> </Group>
</Group> </Group>
</Group> </Group>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/> <EmptySpace min="0" pref="13" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="errorText" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -69,16 +100,24 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="commonFilesSearchLabel" min="-2" max="-2" attributes="0"/> <Component id="commonFilesSearchLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="dataSourceLabel" min="-2" max="-2" attributes="0"/> <Component id="intraCaseRadio" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="allDataSourcesRadioButton" min="-2" max="-2" attributes="0"/> <Component id="allDataSourcesRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="withinDataSourceRadioButton" min="-2" max="-2" attributes="0"/> <Component id="withinDataSourceRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="selectDataSourceComboBox" min="-2" max="-2" attributes="0"/> <Component id="selectDataSourceComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="interCaseRadio" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="anCentralRepoCaseRadio" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="specificCentralRepoCaseRadio" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="caseComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="categoriesLabel" min="-2" max="-2" attributes="0"/> <Component id="categoriesLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="selectedFileCategoriesButton" min="-2" max="-2" attributes="0"/> <Component id="selectedFileCategoriesButton" min="-2" max="-2" attributes="0"/>
@ -94,6 +133,7 @@
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="errorText" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="errorText" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -116,7 +156,6 @@
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="dataSourcesButtonGroup"/> <ComponentRef name="dataSourcesButtonGroup"/>
</Property> </Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.allDataSourcesRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.allDataSourcesRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
@ -154,14 +193,6 @@
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="commonFilesSearchLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.commonFilesSearchLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="cancelButton"> <Component class="javax.swing.JButton" name="cancelButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -231,14 +262,6 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="documentsCheckboxActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="documentsCheckboxActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="dataSourceLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="name" type="java.lang.String" value="" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="categoriesLabel"> <Component class="javax.swing.JLabel" name="categoriesLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -257,5 +280,79 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="commonFilesSearchLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.commonFilesSearchLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="intraCaseRadio">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="interIntraButtonGroup"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="label" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.intraCaseRadio.label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="intraCaseRadioActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="interCaseRadio">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="interIntraButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.jRadioButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="interCaseRadioActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="anCentralRepoCaseRadio">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="caseSelectionButtonGroup"/>
</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/commonfilesearch/Bundle.properties" key="CommonFilesPanel.anCentralRepoCaseRadio.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="specificCentralRepoCaseRadio">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="caseSelectionButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.specificCentralRepoCaseRadio.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="caseComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -273,7 +273,10 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
builder = new SingleDataSource(dataSourceId, CommonFilesPanel.this.dataSourceMap, filterByMedia, filterByDocuments); builder = new SingleDataSource(dataSourceId, CommonFilesPanel.this.dataSourceMap, filterByMedia, filterByDocuments);
setTitleForSingleSource(dataSourceId); setTitleForSingleSource(dataSourceId);
} }// else if(false) {
// TODO, is CR cases, add option chosen CorrelationCase ID lookup
// builder = new AllDataSourcesEamDbCommonFilesAlgorithm(CommonFilesPanel.this.dataSourceMap, filterByMedia, filterByDocuments);
//}
this.tabTitle = builder.buildTabTitle(); this.tabTitle = builder.buildTabTitle();
@ -338,19 +341,25 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
dataSourcesButtonGroup = new javax.swing.ButtonGroup(); dataSourcesButtonGroup = new javax.swing.ButtonGroup();
fileTypeFilterButtonGroup = new javax.swing.ButtonGroup(); fileTypeFilterButtonGroup = new javax.swing.ButtonGroup();
interIntraButtonGroup = new javax.swing.ButtonGroup();
caseSelectionButtonGroup = new javax.swing.ButtonGroup();
searchButton = new javax.swing.JButton(); searchButton = new javax.swing.JButton();
allDataSourcesRadioButton = new javax.swing.JRadioButton(); allDataSourcesRadioButton = new javax.swing.JRadioButton();
withinDataSourceRadioButton = new javax.swing.JRadioButton(); withinDataSourceRadioButton = new javax.swing.JRadioButton();
selectDataSourceComboBox = new javax.swing.JComboBox<>(); selectDataSourceComboBox = new javax.swing.JComboBox<>();
commonFilesSearchLabel = new javax.swing.JLabel();
cancelButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton();
allFileCategoriesRadioButton = new javax.swing.JRadioButton(); allFileCategoriesRadioButton = new javax.swing.JRadioButton();
selectedFileCategoriesButton = new javax.swing.JRadioButton(); selectedFileCategoriesButton = new javax.swing.JRadioButton();
pictureVideoCheckbox = new javax.swing.JCheckBox(); pictureVideoCheckbox = new javax.swing.JCheckBox();
documentsCheckbox = new javax.swing.JCheckBox(); documentsCheckbox = new javax.swing.JCheckBox();
dataSourceLabel = new javax.swing.JLabel();
categoriesLabel = new javax.swing.JLabel(); categoriesLabel = new javax.swing.JLabel();
errorText = new javax.swing.JLabel(); errorText = new javax.swing.JLabel();
commonFilesSearchLabel1 = new javax.swing.JLabel();
intraCaseRadio = new javax.swing.JRadioButton();
interCaseRadio = new javax.swing.JRadioButton();
anCentralRepoCaseRadio = new javax.swing.JRadioButton();
specificCentralRepoCaseRadio = new javax.swing.JRadioButton();
caseComboBox = new javax.swing.JComboBox<>();
org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.searchButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.searchButton.text")); // NOI18N
searchButton.setEnabled(false); searchButton.setEnabled(false);
@ -362,7 +371,6 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
}); });
dataSourcesButtonGroup.add(allDataSourcesRadioButton); dataSourcesButtonGroup.add(allDataSourcesRadioButton);
allDataSourcesRadioButton.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(allDataSourcesRadioButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.allDataSourcesRadioButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(allDataSourcesRadioButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.allDataSourcesRadioButton.text")); // NOI18N
allDataSourcesRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); allDataSourcesRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
allDataSourcesRadioButton.addActionListener(new java.awt.event.ActionListener() { allDataSourcesRadioButton.addActionListener(new java.awt.event.ActionListener() {
@ -388,9 +396,6 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(commonFilesSearchLabel, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.commonFilesSearchLabel.text")); // NOI18N
commonFilesSearchLabel.setFocusable(false);
org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.text")); // NOI18N
cancelButton.setActionCommand(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.actionCommand")); // NOI18N cancelButton.setActionCommand(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.actionCommand")); // NOI18N
cancelButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); cancelButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
@ -435,65 +440,123 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(dataSourceLabel, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.text")); // NOI18N
dataSourceLabel.setName(""); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(categoriesLabel, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.categoriesLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(categoriesLabel, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.categoriesLabel.text")); // NOI18N
categoriesLabel.setName(""); // NOI18N categoriesLabel.setName(""); // NOI18N
errorText.setForeground(new java.awt.Color(255, 0, 0)); errorText.setForeground(new java.awt.Color(255, 0, 0));
org.openide.awt.Mnemonics.setLocalizedText(errorText, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.errorText.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(errorText, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.errorText.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(commonFilesSearchLabel1, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.commonFilesSearchLabel1.text")); // NOI18N
commonFilesSearchLabel1.setFocusable(false);
interIntraButtonGroup.add(intraCaseRadio);
intraCaseRadio.setSelected(true);
intraCaseRadio.setLabel(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.intraCaseRadio.label")); // NOI18N
intraCaseRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
intraCaseRadioActionPerformed(evt);
}
});
interIntraButtonGroup.add(interCaseRadio);
org.openide.awt.Mnemonics.setLocalizedText(interCaseRadio, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.jRadioButton2.text")); // NOI18N
interCaseRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
interCaseRadioActionPerformed(evt);
}
});
caseSelectionButtonGroup.add(anCentralRepoCaseRadio);
anCentralRepoCaseRadio.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(anCentralRepoCaseRadio, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.anCentralRepoCaseRadio.text_1")); // NOI18N
anCentralRepoCaseRadio.setEnabled(false);
caseSelectionButtonGroup.add(specificCentralRepoCaseRadio);
org.openide.awt.Mnemonics.setLocalizedText(specificCentralRepoCaseRadio, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.specificCentralRepoCaseRadio.text_1")); // NOI18N
specificCentralRepoCaseRadio.setEnabled(false);
caseComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
caseComboBox.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(errorText)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(searchButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)
.addContainerGap())
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(categoriesLabel)
.addComponent(commonFilesSearchLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dataSourceLabel)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6) .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(commonFilesSearchLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(categoriesLabel)
.addComponent(withinDataSourceRadioButton) .addGroup(layout.createSequentialGroup()
.addComponent(allDataSourcesRadioButton) .addGap(6, 6, 6)
.addComponent(allFileCategoriesRadioButton) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(selectedFileCategoriesButton) .addComponent(allFileCategoriesRadioButton)
.addComponent(selectedFileCategoriesButton)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pictureVideoCheckbox)
.addComponent(documentsCheckbox))))))
.addGap(277, 277, 277))
.addComponent(intraCaseRadio)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21) .addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pictureVideoCheckbox) .addComponent(withinDataSourceRadioButton)
.addComponent(documentsCheckbox)))))) .addComponent(allDataSourcesRadioButton)))))
.addGap(19, 19, 19)))) .addGroup(layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(interCaseRadio)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(anCentralRepoCaseRadio)
.addComponent(specificCentralRepoCaseRadio)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(errorText)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)))
.addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(commonFilesSearchLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(commonFilesSearchLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(dataSourceLabel) .addComponent(intraCaseRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(allDataSourcesRadioButton) .addComponent(allDataSourcesRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(withinDataSourceRadioButton) .addComponent(withinDataSourceRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(interCaseRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(anCentralRepoCaseRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(specificCentralRepoCaseRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(caseComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(categoriesLabel) .addComponent(categoriesLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(selectedFileCategoriesButton) .addComponent(selectedFileCategoriesButton)
@ -507,7 +570,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton) .addComponent(cancelButton)
.addComponent(searchButton) .addComponent(searchButton)
.addComponent(errorText))) .addComponent(errorText))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -555,6 +619,27 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
this.toggleErrorTextAndSearchBox(); this.toggleErrorTextAndSearchBox();
}//GEN-LAST:event_documentsCheckboxActionPerformed }//GEN-LAST:event_documentsCheckboxActionPerformed
private void intraCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_intraCaseRadioActionPerformed
this.allDataSourcesRadioButton.setEnabled(true);
this.withinDataSourceRadioButton.setEnabled(true);
this.selectDataSourceComboBox.setEnabled(true);
this.anCentralRepoCaseRadio.setEnabled(false);
this.specificCentralRepoCaseRadio.setEnabled(false);
this.caseComboBox.setEnabled(false);
}//GEN-LAST:event_intraCaseRadioActionPerformed
private void interCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_interCaseRadioActionPerformed
this.anCentralRepoCaseRadio.setEnabled(true);
this.specificCentralRepoCaseRadio.setEnabled(true);
this.caseComboBox.setEnabled(true);
this.allDataSourcesRadioButton.setEnabled(false);
this.withinDataSourceRadioButton.setEnabled(false);
this.selectDataSourceComboBox.setEnabled(false);
}//GEN-LAST:event_interCaseRadioActionPerformed
private void toggleErrorTextAndSearchBox() { private void toggleErrorTextAndSearchBox() {
if (!this.pictureVideoCheckbox.isSelected() && !this.documentsCheckbox.isSelected() && !this.allFileCategoriesRadioButton.isSelected()) { if (!this.pictureVideoCheckbox.isSelected() && !this.documentsCheckbox.isSelected() && !this.allFileCategoriesRadioButton.isSelected()) {
this.searchButton.setEnabled(false); this.searchButton.setEnabled(false);
@ -599,18 +684,24 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton allDataSourcesRadioButton; private javax.swing.JRadioButton allDataSourcesRadioButton;
private javax.swing.JRadioButton allFileCategoriesRadioButton; private javax.swing.JRadioButton allFileCategoriesRadioButton;
private javax.swing.JRadioButton anCentralRepoCaseRadio;
private javax.swing.JButton cancelButton; private javax.swing.JButton cancelButton;
private javax.swing.JComboBox<String> caseComboBox;
private javax.swing.ButtonGroup caseSelectionButtonGroup;
private javax.swing.JLabel categoriesLabel; private javax.swing.JLabel categoriesLabel;
private javax.swing.JLabel commonFilesSearchLabel; private javax.swing.JLabel commonFilesSearchLabel1;
private javax.swing.JLabel dataSourceLabel;
private javax.swing.ButtonGroup dataSourcesButtonGroup; private javax.swing.ButtonGroup dataSourcesButtonGroup;
private javax.swing.JCheckBox documentsCheckbox; private javax.swing.JCheckBox documentsCheckbox;
private javax.swing.JLabel errorText; private javax.swing.JLabel errorText;
private javax.swing.ButtonGroup fileTypeFilterButtonGroup; private javax.swing.ButtonGroup fileTypeFilterButtonGroup;
private javax.swing.JRadioButton interCaseRadio;
private javax.swing.ButtonGroup interIntraButtonGroup;
private javax.swing.JRadioButton intraCaseRadio;
private javax.swing.JCheckBox pictureVideoCheckbox; private javax.swing.JCheckBox pictureVideoCheckbox;
private javax.swing.JButton searchButton; private javax.swing.JButton searchButton;
private javax.swing.JComboBox<String> selectDataSourceComboBox; private javax.swing.JComboBox<String> selectDataSourceComboBox;
private javax.swing.JRadioButton selectedFileCategoriesButton; private javax.swing.JRadioButton selectedFileCategoriesButton;
private javax.swing.JRadioButton specificCentralRepoCaseRadio;
private javax.swing.JRadioButton withinDataSourceRadioButton; private javax.swing.JRadioButton withinDataSourceRadioButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }