From cabcb4dab3a30e76f1f595cf2df068b69b2d9007 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Sat, 13 Apr 2013 16:04:14 -0400 Subject: [PATCH] Moves single-target-filter class to commands package --- .../indexdata/pz2utils4jsf/pazpar2/Pz2Session.java | 3 +- .../pz2utils4jsf/pazpar2/SingleTargetFilter.java | 47 -------------------- .../pazpar2/commands/RecordCommand.java | 4 +- .../pazpar2/commands/SearchCommand.java | 1 - .../pazpar2/commands/SingleTargetFilter.java | 47 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 53 deletions(-) delete mode 100644 src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SingleTargetFilter.java create mode 100644 src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SingleTargetFilter.java diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java index 7c0cc86..4d7ac5f 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java @@ -49,8 +49,7 @@ public class Pz2Session implements Pz2Interface, StateListener { protected ErrorHelper errorHelper = null; protected List configurationErrors = null; - protected SearchClient searchClient = null; - protected SingleTargetFilter singleTargetFilter = null; + protected SearchClient searchClient = null; protected ResultsPager pager = null; public Pz2Session () { diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SingleTargetFilter.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SingleTargetFilter.java deleted file mode 100644 index 7c0bcd8..0000000 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SingleTargetFilter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.indexdata.pz2utils4jsf.pazpar2; - -import java.io.Serializable; - -import com.indexdata.pz2utils4jsf.pazpar2.SingleTargetFilter; - -public class SingleTargetFilter implements Serializable { - - private static final long serialVersionUID = 2389085467202526537L; - - private String targetName; - private String targetId; - - public SingleTargetFilter (String targetId, String targetName) { - this.targetId = targetId; - this.targetName = targetName; - } - - public String getTargetName () { - return targetName; - } - - public String getTargetId () { - return targetId; - } - - public String getFilterExpression () { - return "pz:id="+targetId; - } - - @Override - public boolean equals(Object o) { - if (o instanceof SingleTargetFilter) { - return targetName.equals(((SingleTargetFilter) o).getTargetName()) && - targetId.equals(((SingleTargetFilter) o).getTargetId()); - } else { - return false; - } - } - - @Override - public int hashCode () { - return (targetId+targetName).hashCode(); - } - - -} diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java index 656f73f..09e370c 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java @@ -16,9 +16,7 @@ public class RecordCommand extends Pazpar2Command { public String getRecordId () { return getParameterValue("id"); - } - - + } @Override public RecordCommand copy () { diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java index 6e3f500..7e0d361 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java @@ -5,7 +5,6 @@ import javax.enterprise.context.SessionScoped; import org.apache.log4j.Logger; import com.indexdata.pz2utils4jsf.pazpar2.Expression; -import com.indexdata.pz2utils4jsf.pazpar2.SingleTargetFilter; import com.indexdata.pz2utils4jsf.pazpar2.state.StateManager; @SessionScoped diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SingleTargetFilter.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SingleTargetFilter.java new file mode 100644 index 0000000..d495b70 --- /dev/null +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SingleTargetFilter.java @@ -0,0 +1,47 @@ +package com.indexdata.pz2utils4jsf.pazpar2.commands; + +import java.io.Serializable; + +import com.indexdata.pz2utils4jsf.pazpar2.commands.SingleTargetFilter; + +public class SingleTargetFilter implements Serializable { + + private static final long serialVersionUID = 2389085467202526537L; + + private String targetName; + private String targetId; + + public SingleTargetFilter (String targetId, String targetName) { + this.targetId = targetId; + this.targetName = targetName; + } + + public String getTargetName () { + return targetName; + } + + public String getTargetId () { + return targetId; + } + + public String getFilterExpression () { + return "pz:id="+targetId; + } + + @Override + public boolean equals(Object o) { + if (o instanceof SingleTargetFilter) { + return targetName.equals(((SingleTargetFilter) o).getTargetName()) && + targetId.equals(((SingleTargetFilter) o).getTargetId()); + } else { + return false; + } + } + + @Override + public int hashCode () { + return (targetId+targetName).hashCode(); + } + + +} -- 1.7.10.4