mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
fix export and gui sync
This commit is contained in:
parent
e7c446cbd1
commit
40b8866e82
@ -663,7 +663,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
|||||||
List<KeywordSearchList> toWrite = new ArrayList<KeywordSearchList>();
|
List<KeywordSearchList> toWrite = new ArrayList<KeywordSearchList>();
|
||||||
toWrite.add(reader.getList(currentKeywordList.getName()));
|
toWrite.add(reader.getList(currentKeywordList.getName()));
|
||||||
final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs);
|
final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs);
|
||||||
boolean written = exporter.writeLists(toWrite);
|
boolean written = exporter.saveLists(toWrite);
|
||||||
if (written) {
|
if (written) {
|
||||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword lists exported",
|
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword lists exported",
|
||||||
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||||
|
@ -125,11 +125,11 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<KeywordSearchList> getListsL(boolean locked) {
|
List<KeywordSearchList> getListsL(boolean locked) {
|
||||||
List<KeywordSearchList> ret = new ArrayList<KeywordSearchList>();
|
List<KeywordSearchList> ret = new ArrayList<KeywordSearchList>();
|
||||||
for (KeywordSearchList list : theLists.values()) {
|
for (KeywordSearchList list : theLists.values()) {
|
||||||
if(list.isLocked().equals(locked)) {
|
if (list.isLocked().equals(locked)) {
|
||||||
ret.add(list);
|
ret.add(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,14 +138,16 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list names of all loaded keyword list names
|
* Get list names of all loaded keyword list names
|
||||||
|
*
|
||||||
* @return List of keyword list names
|
* @return List of keyword list names
|
||||||
*/
|
*/
|
||||||
List<String> getListNames() {
|
List<String> getListNames() {
|
||||||
return new ArrayList<String>(theLists.keySet());
|
return new ArrayList<String>(theLists.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list names of all locked or unlocked loaded keyword list names
|
* Get list names of all locked or unlocked loaded keyword list names
|
||||||
|
*
|
||||||
* @param locked true if look for locked lists, false otherwise
|
* @param locked true if look for locked lists, false otherwise
|
||||||
* @return List of keyword list names
|
* @return List of keyword list names
|
||||||
*/
|
*/
|
||||||
@ -153,15 +155,17 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
ArrayList<String> lists = new ArrayList<String>();
|
ArrayList<String> lists = new ArrayList<String>();
|
||||||
for (String listName : theLists.keySet()) {
|
for (String listName : theLists.keySet()) {
|
||||||
KeywordSearchList list = theLists.get(listName);
|
KeywordSearchList list = theLists.get(listName);
|
||||||
if (locked == list.isLocked())
|
if (locked == list.isLocked()) {
|
||||||
lists.add(listName);
|
lists.add(listName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return first list that contains the keyword
|
* return first list that contains the keyword
|
||||||
|
*
|
||||||
* @param keyword
|
* @param keyword
|
||||||
* @return found list or null
|
* @return found list or null
|
||||||
*/
|
*/
|
||||||
@ -178,6 +182,7 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* return first list that contains the keyword
|
* return first list that contains the keyword
|
||||||
|
*
|
||||||
* @param keyword
|
* @param keyword
|
||||||
* @return found list or null
|
* @return found list or null
|
||||||
*/
|
*/
|
||||||
@ -194,14 +199,16 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get number of lists currently stored
|
* get number of lists currently stored
|
||||||
|
*
|
||||||
* @return number of lists currently stored
|
* @return number of lists currently stored
|
||||||
*/
|
*/
|
||||||
int getNumberLists() {
|
int getNumberLists() {
|
||||||
return theLists.size();
|
return theLists.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get number of unlocked or locked lists currently stored
|
* get number of unlocked or locked lists currently stored
|
||||||
|
*
|
||||||
* @param locked true if look for locked lists, false otherwise
|
* @param locked true if look for locked lists, false otherwise
|
||||||
* @return number of unlocked lists currently stored
|
* @return number of unlocked lists currently stored
|
||||||
*/
|
*/
|
||||||
@ -209,14 +216,16 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
int numLists = 0;
|
int numLists = 0;
|
||||||
for (String listName : theLists.keySet()) {
|
for (String listName : theLists.keySet()) {
|
||||||
KeywordSearchList list = theLists.get(listName);
|
KeywordSearchList list = theLists.get(listName);
|
||||||
if (locked == list.isLocked())
|
if (locked == list.isLocked()) {
|
||||||
++ numLists;
|
++numLists;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return numLists;
|
return numLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get list by name or null
|
* get list by name or null
|
||||||
|
*
|
||||||
* @param name id of the list
|
* @param name id of the list
|
||||||
* @return keyword list representation
|
* @return keyword list representation
|
||||||
*/
|
*/
|
||||||
@ -226,6 +235,7 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* check if list with given name id exists
|
* check if list with given name id exists
|
||||||
|
*
|
||||||
* @param name id to check
|
* @param name id to check
|
||||||
* @return true if list already exists or false otherwise
|
* @return true if list already exists or false otherwise
|
||||||
*/
|
*/
|
||||||
@ -234,8 +244,9 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adds the new word list using name id
|
* adds the new word list using name id replacing old one if exists with the
|
||||||
* replacing old one if exists with the same name
|
* same name
|
||||||
|
*
|
||||||
* @param name the name of the new list or list to replace
|
* @param name the name of the new list or list to replace
|
||||||
* @param newList list of keywords
|
* @param newList list of keywords
|
||||||
* @param useForIngest should this list be used for ingest
|
* @param useForIngest should this list be used for ingest
|
||||||
@ -270,17 +281,18 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
boolean addList(String name, List<Keyword> newList) {
|
boolean addList(String name, List<Keyword> newList) {
|
||||||
return addList(name, newList, true, true);
|
return addList(name, newList, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean addList(KeywordSearchList list) {
|
boolean addList(KeywordSearchList list) {
|
||||||
return addList(list.getName(), list.getKeywords(), list.getUseForIngest(), list.getIngestMessages(), list.isLocked());
|
return addList(list.getName(), list.getKeywords(), list.getUseForIngest(), list.getIngestMessages(), list.isLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* write out multiple lists
|
* save multiple lists
|
||||||
|
*
|
||||||
* @param lists
|
* @param lists
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean writeLists(List<KeywordSearchList> lists) {
|
boolean saveLists(List<KeywordSearchList> lists) {
|
||||||
int oldSize = this.getNumberLists();
|
int oldSize = this.getNumberLists();
|
||||||
|
|
||||||
List<KeywordSearchList> overwritten = new ArrayList<KeywordSearchList>();
|
List<KeywordSearchList> overwritten = new ArrayList<KeywordSearchList>();
|
||||||
@ -302,11 +314,44 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName());
|
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* write out multiple lists
|
||||||
|
*
|
||||||
|
* @param lists
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean writeLists(List<KeywordSearchList> lists) {
|
||||||
|
int oldSize = this.getNumberLists();
|
||||||
|
|
||||||
|
List<KeywordSearchList> overwritten = new ArrayList<KeywordSearchList>();
|
||||||
|
List<KeywordSearchList> newLists = new ArrayList<KeywordSearchList>();
|
||||||
|
for (KeywordSearchList list : lists) {
|
||||||
|
if (this.listExists(list.getName())) {
|
||||||
|
overwritten.add(list);
|
||||||
|
} else {
|
||||||
|
newLists.add(list);
|
||||||
|
}
|
||||||
|
theLists.put(list.getName(), list);
|
||||||
|
}
|
||||||
|
//boolean saved = save();
|
||||||
|
|
||||||
|
for (KeywordSearchList list : newLists) {
|
||||||
|
changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, list.getName());
|
||||||
|
}
|
||||||
|
for (KeywordSearchList over : overwritten) {
|
||||||
|
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete list if exists and save new list
|
* delete list if exists and save new list
|
||||||
|
*
|
||||||
* @param name of list to delete
|
* @param name of list to delete
|
||||||
* @return true if deleted
|
* @return true if deleted
|
||||||
*/
|
*/
|
||||||
@ -339,8 +384,7 @@ public abstract class KeywordSearchListsAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a representation of a single keyword list
|
* a representation of a single keyword list created or loaded
|
||||||
* created or loaded
|
|
||||||
*/
|
*/
|
||||||
class KeywordSearchList {
|
class KeywordSearchList {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user