diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClient.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClient.java
index cc81f3c8d8..688a6b9b09 100644
--- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClient.java
+++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClient.java
@@ -19,7 +19,18 @@
package org.phoebus.applications.saveandrestore.client;
import org.phoebus.applications.saveandrestore.SaveAndRestoreClientException;
-import org.phoebus.applications.saveandrestore.model.*;
+import org.phoebus.applications.saveandrestore.model.CompositeSnapshot;
+import org.phoebus.applications.saveandrestore.model.Configuration;
+import org.phoebus.applications.saveandrestore.model.ConfigurationData;
+import org.phoebus.applications.saveandrestore.model.Node;
+import org.phoebus.applications.saveandrestore.model.NodeType;
+import org.phoebus.applications.saveandrestore.model.RestoreResult;
+import org.phoebus.applications.saveandrestore.model.Snapshot;
+import org.phoebus.applications.saveandrestore.model.SnapshotData;
+import org.phoebus.applications.saveandrestore.model.SnapshotItem;
+import org.phoebus.applications.saveandrestore.model.Tag;
+import org.phoebus.applications.saveandrestore.model.TagData;
+import org.phoebus.applications.saveandrestore.model.UserData;
import org.phoebus.applications.saveandrestore.model.search.Filter;
import org.phoebus.applications.saveandrestore.model.search.SearchResult;
@@ -77,13 +88,6 @@ public interface SaveAndRestoreClient {
*/
Node createNewNode(String parentsUniqueId, Node node);
- /**
- * Updates a node, e.g. if user wishes to add or remove tags from a snapshot {@link Node}
- *
- * @param nodeToUpdate The {@link Node} subject to update.
- * @return The updated {@link Node}.
- */
- Node updateNode(Node nodeToUpdate);
/**
* Updates a node, e.g. if user wishes to add or remove tags from a snapshot {@link Node}
@@ -128,6 +132,7 @@ public interface SaveAndRestoreClient {
/**
* Constructs a path like string to facilitate location of a {@link Node} in the tree structure.
+ *
* @param uniqueNodeId Unique id
* @return Path like /Root folder/foo/bar/my/favourite/node
*/
@@ -138,8 +143,9 @@ public interface SaveAndRestoreClient {
/**
* Creates a new {@link Node} of type {@link NodeType#CONFIGURATION} in the remote
* service.
- * @param parentNodeId Non-null and non-empty unique id of an existing parent {@link Node},
- * which must be of type {@link NodeType#FOLDER}.
+ *
+ * @param parentNodeId Non-null and non-empty unique id of an existing parent {@link Node},
+ * which must be of type {@link NodeType#FOLDER}.
* @param configuration {@link ConfigurationData} object
* @return A representation of the persisted {@link Configuration}.
*/
@@ -152,8 +158,9 @@ public interface SaveAndRestoreClient {
/**
* Creates a {@link Snapshot}
+ *
* @param parentNodeId The unique id of the configuration {@link Node} associated with the {@link Snapshot}
- * @param snapshot The {@link Snapshot} data object.
+ * @param snapshot The {@link Snapshot} data object.
* @return The new {@link Snapshot} as persisted by the service
*/
Snapshot createSnapshot(String parentNodeId, Snapshot snapshot);
@@ -162,7 +169,8 @@ public interface SaveAndRestoreClient {
/**
* Creates a new {@link CompositeSnapshot}.
- * @param parentNodeId The parent {@link Node} for the new {@link CompositeSnapshot}
+ *
+ * @param parentNodeId The parent {@link Node} for the new {@link CompositeSnapshot}
* @param compositeSnapshot The data object
* @return A {@link CompositeSnapshot} as persisted by the service.
*/
@@ -172,8 +180,9 @@ public interface SaveAndRestoreClient {
* Utility for the purpose of checking whether a set of snapshots contain duplicate PV names.
* The input snapshot ids may refer to {@link Node}s of types {@link org.phoebus.applications.saveandrestore.model.NodeType#SNAPSHOT}
* and {@link org.phoebus.applications.saveandrestore.model.NodeType#COMPOSITE_SNAPSHOT}
+ *
* @param snapshotNodeIds List of {@link Node} ids corresponding to {@link Node}s of types {@link org.phoebus.applications.saveandrestore.model.NodeType#SNAPSHOT}
- * and {@link org.phoebus.applications.saveandrestore.model.NodeType#COMPOSITE_SNAPSHOT}
+ * and {@link org.phoebus.applications.saveandrestore.model.NodeType#COMPOSITE_SNAPSHOT}
* @return A list of PV names that occur more than once across the list of {@link Node}s corresponding
* to the input. Empty if no duplicates are found.
*/
@@ -182,6 +191,7 @@ public interface SaveAndRestoreClient {
/**
* Updates a composite snapshot. Note that the list of referenced snapshots must be the full list of wanted
* snapshots, i.e. there is no way to only add new references, or only remove unwanted references.
+ *
* @param compositeSnapshot A {@link CompositeSnapshot} object hold data.
* @return The updates {@link CompositeSnapshot} object.
*/
@@ -189,6 +199,7 @@ public interface SaveAndRestoreClient {
/**
* Search for {@link Node}s based on the specified search parameters.
+ *
* @param searchParams {@link MultivaluedMap} holding search parameters.
* @return A {@link SearchResult} with potentially empty list of matching {@link Node}s
*/
@@ -196,6 +207,7 @@ public interface SaveAndRestoreClient {
/**
* Save a new or updated {@link Filter}
+ *
* @param filter The {@link Filter} to save
* @return The saved {@link Filter}
*/
@@ -208,12 +220,14 @@ public interface SaveAndRestoreClient {
/**
* Deletes a {@link Filter} based on its name.
- * @param name
+ *
+ * @param name Unique name of a {@link Filter}
*/
void deleteFilter(String name);
/**
* Adds a tag to a list of unique node ids, see {@link TagData}
+ *
* @param tagData see {@link TagData}
* @return A list of updated {@link Node}s. This may contain fewer elements than the list of unique node ids
* passed in the tagData parameter.
@@ -222,6 +236,7 @@ public interface SaveAndRestoreClient {
/**
* Deletes a tag from a list of unique node ids, see {@link TagData}
+ *
* @param tagData see {@link TagData}
* @return A list of updated {@link Node}s. This may contain fewer elements than the list of unique node ids
* passed in the tagData parameter.
@@ -230,6 +245,7 @@ public interface SaveAndRestoreClient {
/**
* For the purpose of login and authentication in the service.
+ *
* @param userName User's account name
* @param password User's password
* @return A {@link UserData} object if login is successful, otherwise implementation should throw
@@ -239,6 +255,7 @@ public interface SaveAndRestoreClient {
/**
* Requests service to restore the specified {@link SnapshotItem}s
+ *
* @param snapshotItems A {@link List} of {@link SnapshotItem}s
* @return A @{@link List} of {@link RestoreResult}s with information on potentially failed {@link SnapshotItem}s.
*/
@@ -246,6 +263,7 @@ public interface SaveAndRestoreClient {
/**
* Requests service to restore the specified snapshot.
+ *
* @param snapshotNodeId Unique id of a snapshot
* @return A @{@link List} of {@link RestoreResult}s with information on potentially failed {@link SnapshotItem}s.
*/
@@ -253,6 +271,7 @@ public interface SaveAndRestoreClient {
/**
* Requests service to take a snapshot.
+ *
* @param configurationNodeId The unique id of the {@link Configuration} for which to take the snapshot
* @return A {@link List} of {@link SnapshotItem}s carrying snapshot values read by the service.
*/
diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClientImpl.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClientImpl.java
index 786270532e..05c5755d8e 100644
--- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClientImpl.java
+++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/client/SaveAndRestoreClientImpl.java
@@ -42,6 +42,7 @@
import java.time.Duration;
import java.util.Base64;
import java.util.List;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -155,11 +156,6 @@ public Node createNewNode(String parentsUniqueId, Node node) {
}
}
- @Override
- public Node updateNode(Node nodeToUpdate) {
- return updateNode(nodeToUpdate, false);
- }
-
@Override
public Node updateNode(Node nodeToUpdate, boolean customTimeForMigration) {
try {
diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/SaveAndRestoreController.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/SaveAndRestoreController.java
index 924e6d2a4d..940dfb72df 100644
--- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/SaveAndRestoreController.java
+++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/SaveAndRestoreController.java
@@ -23,6 +23,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
@@ -73,6 +75,7 @@
import org.phoebus.applications.saveandrestore.model.NodeType;
import org.phoebus.applications.saveandrestore.model.Tag;
import org.phoebus.applications.saveandrestore.model.search.Filter;
+import org.phoebus.applications.saveandrestore.model.search.FilterActivator;
import org.phoebus.applications.saveandrestore.model.search.SearchQueryUtil;
import org.phoebus.applications.saveandrestore.model.search.SearchQueryUtil.Keys;
import org.phoebus.applications.saveandrestore.model.search.SearchResult;
@@ -124,6 +127,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.ResourceBundle;
+import java.util.ServiceLoader;
import java.util.Stack;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -160,7 +164,7 @@ public class SaveAndRestoreController extends SaveAndRestoreBaseController
@SuppressWarnings("unused")
@FXML
- private CheckBox enableFilterCheckBox;
+ private CheckBox autoFilterCheckbox;
@SuppressWarnings("unused")
@FXML
@@ -173,8 +177,9 @@ public class SaveAndRestoreController extends SaveAndRestoreBaseController
protected static final Logger LOG = Logger.getLogger(SaveAndRestoreController.class.getName());
protected Comparator> treeNodeComparator;
protected SimpleBooleanProperty disabledUi = new SimpleBooleanProperty(false);
- private final SimpleBooleanProperty filterEnabledProperty = new SimpleBooleanProperty(false);
private static final Logger logger = Logger.getLogger(SaveAndRestoreController.class.getName());
+ private final ObjectProperty currentFilterProperty = new SimpleObjectProperty<>(null);
+
@SuppressWarnings("unused")
@FXML
@@ -198,6 +203,13 @@ public class SaveAndRestoreController extends SaveAndRestoreBaseController
private final MenuItem deleteNodeMenuItem = new MenuItem(Messages.contextMenuDelete, ImageCache.getImageView(ImageCache.class, "/icons/delete.png"));
private final MenuItem pasteMenuItem = new MenuItem(Messages.paste, ImageCache.getImageView(ImageCache.class, "/icons/paste.png"));
+ private final BooleanProperty autoFilterActive = new SimpleBooleanProperty();
+
+ /**
+ * Potentially empty list of {@link FilterActivator}s implementing auto selection of {@link Filter}s.
+ */
+ private final ObservableList filterActivators = FXCollections.observableArrayList();
+
List