From: Niels Erik G. Nielsen Date: Sun, 21 Apr 2013 13:19:23 +0000 (-0400) Subject: Adds some debug log statements for target filter X-Git-Tag: v0.0.7~149 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=acc76cb20c186e9754c285eaf2a1aac0c8d8c8ed;p=mkjsf-moved-to-github.git Adds some debug log statements for target filter --- diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java index 749742e..5e4e07b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java @@ -150,13 +150,14 @@ public class SearchCommand extends Pazpar2Command { if (hasSingleTargetFilter(new SingleTargetFilter(targetId,targetName))) { logger.debug("Already using target filter " + this.singleTargetFilter.getFilterExpression()); } else { + logger.debug("Setting new single target filter for [" + targetName + "]"); this.singleTargetFilter = new SingleTargetFilter(targetId,targetName); setParameter(new CommandParameter("filter","=",this.singleTargetFilter.getFilterExpression())); } } public SingleTargetFilter getSingleTargetFilter () { - logger.debug("request to get the current single target filter"); + logger.debug("request to get the current single target filter " + singleTargetFilter); return singleTargetFilter; } @@ -164,10 +165,11 @@ public class SearchCommand extends Pazpar2Command { * Removes the current target filter from the search * */ - public void removeSingleTargetFilter () { + public String removeSingleTargetFilter () { logger.debug("Removing target filter " + singleTargetFilter.getFilterExpression()); this.singleTargetFilter = null; - removeParameter("filter"); + removeParameter("filter"); + return null; } /** @@ -178,7 +180,7 @@ public class SearchCommand extends Pazpar2Command { logger.debug("Checking if a single target filter is set: " + (singleTargetFilter != null)); return singleTargetFilter != null; } - + /** * Resolves if the current search command has a target filter - to * be used by the UI for conditional rendering of target filter info. @@ -187,6 +189,7 @@ public class SearchCommand extends Pazpar2Command { * filter */ protected boolean hasSingleTargetFilter(SingleTargetFilter targetFilter) { + logger.debug("Checking if target filter for [" + targetFilter.getTargetName() + "] is set."); return hasSingleTargetFilter() && targetFilter.equals(this.singleTargetFilter); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SingleTargetFilter.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SingleTargetFilter.java index 4aea8a2..ef6303e 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SingleTargetFilter.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SingleTargetFilter.java @@ -8,8 +8,8 @@ public class SingleTargetFilter implements Serializable { private static final long serialVersionUID = 2389085467202526537L; - private String targetName; - private String targetId; + private String targetName = ""; + private String targetId = ""; public SingleTargetFilter (String targetId, String targetName) { this.targetId = targetId; @@ -43,5 +43,9 @@ public class SingleTargetFilter implements Serializable { return (targetId+targetName).hashCode(); } + @Override + public String toString () { + return targetName + " (" + targetId + ")"; + } }