mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
6390 persona searching by account
This commit is contained in:
parent
795fe87f72
commit
c8e60d55fa
@ -394,6 +394,34 @@ public class Persona {
|
|||||||
return queryCallback.getPersonas();
|
return queryCallback.getPersonas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the rows from the Personas table where persona accounts' names are
|
||||||
|
* similar to the given one. Persona marked as DELETED are not returned.
|
||||||
|
*
|
||||||
|
* @param partialName Name substring to match.
|
||||||
|
* @return Collection of personas matching the given name substring, may be
|
||||||
|
* empty if no match is found.
|
||||||
|
*
|
||||||
|
* @throws CentralRepoException If there is an error in querying the
|
||||||
|
* Personas table.
|
||||||
|
*/
|
||||||
|
public static Collection<Persona> getPersonaByAccountIdentifierLike(String partialName) throws CentralRepoException {
|
||||||
|
String queryClause = "SELECT DISTINCT accounts.id as a_id,"
|
||||||
|
+ "p.id, p.uuid, p.name, p.comment, p.created_date, p.modified_date, p.status_id, p.examiner_id, e.login_name, e.display_name"
|
||||||
|
+ " FROM accounts"
|
||||||
|
+ " JOIN persona_accounts as pa ON pa.account_id = accounts.id"
|
||||||
|
+ " JOIN personas as p ON p.id = pa.persona_id"
|
||||||
|
+ " JOIN examiners as e ON e.id = p.examiner_id"
|
||||||
|
+ " WHERE LOWER(accounts.account_unique_identifier) LIKE LOWER('%" + partialName + "%')"
|
||||||
|
+ " AND p.status_id != " + Persona.PersonaStatus.DELETED.getStatusId()
|
||||||
|
+ " GROUP BY p.id";
|
||||||
|
|
||||||
|
PersonaQueryCallback queryCallback = new PersonaQueryCallback();
|
||||||
|
CentralRepository.getInstance().executeSelectSQL(queryClause, queryCallback);
|
||||||
|
|
||||||
|
return queryCallback.getPersonas();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an alias for the Persona.
|
* Creates an alias for the Persona.
|
||||||
*
|
*
|
||||||
|
@ -145,7 +145,6 @@
|
|||||||
<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/centralrepository/persona/Bundle.properties" key="PersonaManagerTopComponent.searchAccountRadio.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaManagerTopComponent.searchAccountRadio.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="enabled" type="boolean" value="false"/>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Container class="javax.swing.JScrollPane" name="resultsPane">
|
<Container class="javax.swing.JScrollPane" name="resultsPane">
|
||||||
|
@ -113,6 +113,14 @@ public final class PersonaManagerTopComponent extends TopComponent {
|
|||||||
handleSelectionChange(e);
|
handleSelectionChange(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
searchNameRadio.addActionListener((ActionEvent e) -> {
|
||||||
|
searchField.setText("");
|
||||||
|
});
|
||||||
|
|
||||||
|
searchAccountRadio.addActionListener((ActionEvent e) -> {
|
||||||
|
searchField.setText("");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,7 +208,11 @@ public final class PersonaManagerTopComponent extends TopComponent {
|
|||||||
private void executeSearch() {
|
private void executeSearch() {
|
||||||
Collection<Persona> results;
|
Collection<Persona> results;
|
||||||
try {
|
try {
|
||||||
|
if (searchNameRadio.isSelected()) {
|
||||||
results = Persona.getPersonaByName(searchField.getText());
|
results = Persona.getPersonaByName(searchField.getText());
|
||||||
|
} else {
|
||||||
|
results = Persona.getPersonaByAccountIdentifierLike(searchField.getText());
|
||||||
|
}
|
||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
logger.log(Level.SEVERE, "Failed to search personas", ex);
|
logger.log(Level.SEVERE, "Failed to search personas", ex);
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
@ -254,7 +266,6 @@ public final class PersonaManagerTopComponent extends TopComponent {
|
|||||||
|
|
||||||
searchButtonGroup.add(searchAccountRadio);
|
searchButtonGroup.add(searchAccountRadio);
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(searchAccountRadio, org.openide.util.NbBundle.getMessage(PersonaManagerTopComponent.class, "PersonaManagerTopComponent.searchAccountRadio.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(searchAccountRadio, org.openide.util.NbBundle.getMessage(PersonaManagerTopComponent.class, "PersonaManagerTopComponent.searchAccountRadio.text")); // NOI18N
|
||||||
searchAccountRadio.setEnabled(false);
|
|
||||||
|
|
||||||
resultsTable.setToolTipText(org.openide.util.NbBundle.getMessage(PersonaManagerTopComponent.class, "PersonaManagerTopComponent.resultsTable.toolTipText")); // NOI18N
|
resultsTable.setToolTipText(org.openide.util.NbBundle.getMessage(PersonaManagerTopComponent.class, "PersonaManagerTopComponent.resultsTable.toolTipText")); // NOI18N
|
||||||
resultsTable.getTableHeader().setReorderingAllowed(false);
|
resultsTable.getTableHeader().setReorderingAllowed(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user