From: Niels Erik G. Nielsen Date: Tue, 17 Dec 2013 16:35:11 +0000 (-0500) Subject: Bugfixes to compound filter and limit settings X-Git-Tag: v0.0.7~12 X-Git-Url: http://git.indexdata.com/?p=mkjsf-moved-to-github.git;a=commitdiff_plain;h=dd4fff017b784b22f3440b395fddb2418875772c Bugfixes to compound filter and limit settings --- diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java index f61642c..4a802df 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java @@ -219,6 +219,10 @@ public abstract class Pazpar2Command implements Serializable { checkInState(copy); } + public void removeParameterInState (String name) { + parameters.remove(name); + } + /** * Removes multiple parameters completely and notifies the state manager * -- once -- about the change @@ -254,6 +258,10 @@ public abstract class Pazpar2Command implements Serializable { checkInState(copy); } + public void addExpressionInState (String parameterName, Expression expression) { + getParameter(parameterName).addExpression(expression); + } + public void removeExpression(String parameterName, Expression expression) { Pazpar2Command copy = this.copy(); copy.getParameter(parameterName).removeExpression(expression); 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 f9f76a2..0c8d745 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java @@ -71,26 +71,19 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand * Sets the filter parameter. See Pazpar2 documentation for details. */ public void setFilter(String compoundExpression) { - if (compoundExpression != null && compoundExpression.length()>0) { - // Split expression by commas that are not escaped (with backslash) + if (getParameter("filter") != null) removeParameterInState("filter"); + if (compoundExpression != null && compoundExpression.length()>0) { + // Split expression by commas that are not escaped with backslash String[] subExpressions = compoundExpression.split("(?limit parameter. See Pazpar2 documentation for details. */ - public void setLimit (String compoundExpression) { - if (compoundExpression != null && compoundExpression.length()>0) { - // Split expression by commas that are not escaped (with backslash) + public void setLimit (String compoundExpression) { + if (getParameter("limit") != null) removeParameterInState("limit"); + if (compoundExpression != null && compoundExpression.length()>0) { + // Split expression by commas that are not escaped with backslash String[] subExpressions = compoundExpression.split("(?