import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseParser;\r
\r
+/**\r
+ * Represents a Pazpar2 <code>record</code> command. \r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand {\r
\r
private static final long serialVersionUID = 2817539422114569506L;\r
return responseObject;\r
}\r
\r
+ /**\r
+ * Sets the <code>id</code> parameter. See Pazpar2 documentation for details.\r
+ * \r
+ * @param recId record ID\r
+ */\r
public void setId(String recId) {\r
setParameter(new CommandParameter("id","=",recId));\r
}\r
- \r
+\r
+ /** \r
+ * Returns the <code>id</code> parameter value.\r
+ */\r
public String getId () {\r
return getParameterValue("id");\r
}\r
- \r
+\r
+ /**\r
+ * Sets the <code>offset</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setOffset (String offset) {\r
setParameter(new CommandParameter("offset","=",offset));\r
}\r
- \r
+\r
+ /** \r
+ * Returns the <code>offset</code> parameter value.\r
+ */\r
public String getOffset () {\r
return getParameterValue("offset");\r
}\r
\r
+ /**\r
+ * Sets the <code>checksum</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setChecksum (String checksum) {\r
setParameter(new CommandParameter("checksum","=",checksum));\r
}\r
\r
+ /** \r
+ * Returns the <code>checksum</code> parameter value.\r
+ */\r
public String getChecksum () {\r
return getParameterValue("checksum");\r
}\r
\r
+ /**\r
+ * Sets the <code>nativesyntax</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setNativesyntax (String nativesyntax) {\r
setParameterInState(new CommandParameter("nativesyntax","=",nativesyntax));\r
}\r
\r
+ /** \r
+ * Returns the <code>nativesyntax</code> parameter value.\r
+ */\r
public String getNativesyntax () {\r
return getParameterValue("nativesyntax");\r
}\r
\r
+ /**\r
+ * Sets the <code>syntax</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setSyntax (String syntax) {\r
setParameterInState(new CommandParameter("syntax","=",syntax)); \r
}\r
\r
+ /** \r
+ * Returns the <code>syntax</code> parameter value.\r
+ */\r
public String getSyntax () {\r
return getParameterValue("syntax");\r
}\r
\r
+ /**\r
+ * Sets the <code>esn</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setEsn (String esn) {\r
setParameter(new CommandParameter("esn","=",esn));\r
}\r
\r
+ /** \r
+ * Returns the <code>esn</code> parameter value.\r
+ */\r
public String getEsn () {\r
return getParameterValue("esn");\r
}\r
\r
+ /**\r
+ * Sets the <code>binary</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setBinary (String binary) {\r
setParameter(new CommandParameter("binary","=",binary));\r
}\r
\r
+ /** \r
+ * Returns the <code>binary</code> parameter value.\r
+ */\r
public String getBinary () {\r
return getParameterValue("binary");\r
}\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Represents a Pazpar2 <code>search</code> command. \r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
@SessionScoped @Named\r
public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand {\r
\r
Pz2Service.get().getSearchClient().setSearchCommand(this);\r
return super.run();\r
}\r
- \r
+\r
+ /**\r
+ * Sets the <code>query</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setQuery(String query) { \r
setParameter(new QueryParameter("query","=",query));\r
}\r
checkInState(copy);\r
}\r
\r
+ /** \r
+ * Returns the simple part of the <code>query</code> parameter value, excluding parts that \r
+ * were added as expressions (that is, not set with <code>setQuery()</code>).\r
+ */\r
public String getQuery () { \r
return getParameter("query") == null ? null : getParameter("query").getSimpleValue();\r
}\r
- \r
+\r
+ /** \r
+ * Returns the complete <code>query</code> parameter value, including expressions.\r
+ */\r
public String getExtendedQuery () { \r
return getParameter("query") == null ? null : getParameter("query").getValueWithExpressions();\r
}\r
- \r
+ \r
+ /**\r
+ * Sets the <code>filter</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setFilter(String filterExpression) {\r
if (filterExpression != null && filterExpression.length()>0) {\r
if (filterExpression.split("[=~]").length==1) {\r
}\r
}\r
\r
+ /**\r
+ * Sets the <code>filter</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setFilter(String field, String operator, String value, String label) {\r
setParameter(new FilterParameter(new Expression(field,operator,value,label)));\r
}\r
- \r
+\r
+ /**\r
+ * Checks if there are any filter expressions matching any of the given expressionFields\r
+ * @param expressionFields expression fields (left-of-operator entities) to look for\r
+ * @return true if expression(s) found with any of <code>expressionFields</code> \r
+ */\r
public boolean hasFilterExpression(String... expressionFields) {\r
logger.trace("Checking for filter expression for " + Arrays.deepToString(expressionFields));\r
for (String field : expressionFields) {\r
}\r
\r
\r
+ /** \r
+ * Returns the <code>filter</code> parameter value.\r
+ */\r
public String getFilter() {\r
return getParameter("filter") == null ? null : ((FilterParameter)getParameter("filter")).getValueWithExpressions();\r
}\r
\r
+ /**\r
+ * Returns the first filter expression of the given type\r
+ * @param expressionField expression field (left-of-operator entity) to look for\r
+ * @return the first filter expression found with the field <code>expressionField</code> or null if none found \r
+ */\r
public Expression getOneFilterExpression(String expressionField) {\r
List<Expression> exprs = getFilterExpressions(expressionField);\r
if (exprs != null && exprs.size()>0) {\r
}\r
\r
\r
+ /**\r
+ * Returns list of all filter expressions \r
+ */\r
public List<Expression> getFilterExpressions() {\r
return getParameter("filter").getExpressions();\r
}\r
\r
+ \r
public List<Expression> getFilterExpressions(String... expressionFields) {\r
logger.trace("Checking for filter parameter");\r
if (parameters.get("filter")!=null) {\r
public boolean hasFilter () {\r
return getFilter().length()>0;\r
}\r
- \r
+\r
+ /**\r
+ * Adds a filter expression with a label for display. The filter is added to the end\r
+ * of an ordered list. \r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ * @param label\r
+ */\r
public void addFilter(String field, String operator, String value, String label) {\r
if (getParameter("filter") == null) {\r
setFilter(field + operator + value);\r
addExpression("filter",new Expression(field,operator,value,(label != null ? label : value)));\r
}\r
}\r
- \r
+\r
+ /**\r
+ * Clears the filter parameter\r
+ */\r
public void removeFilters () {\r
removeParameter("filter");\r
}\r
- \r
+\r
+ /**\r
+ * Removes a filter expression by exact attributes\r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ */\r
public void removeFilter(String field, String operator, String value) {\r
removeExpression("filter",new Expression(field, operator, value, null));\r
}\r
\r
+ /**\r
+ * Removes all filter expressions matching a field listed in <code>fieldsToRemove</code>\r
+ * @param fieldsToRemove\r
+ */\r
public void removeFilters(String... fieldsToRemove) { \r
removeExpressions("filter",fieldsToRemove); \r
} \r
- \r
+\r
+ /**\r
+ * Removes filter expressions coming after the expression matching the provided filter expression, \r
+ * if they have a field listed in <code>fieldsToRemove</code>. To be used for bread crumb like UI \r
+ * controls.\r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ * @param fieldsToRemove\r
+ */\r
public void removeFiltersAfter(String field, String operator, String value, String... fieldsToRemove) { \r
removeExpressionsAfter("filter",new Expression(field,operator,value,null),fieldsToRemove); \r
}\r
\r
+ /**\r
+ * Sets the <code>limit</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setLimit (String limitExpression) { \r
if (limitExpression != null && limitExpression.length()>0) {\r
setParameter(new LimitParameter(new Expression(limitExpression)));\r
}\r
}\r
\r
+ /**\r
+ * Sets the <code>limit</code> parameter including a label. See Pazpar2 documentation for details.\r
+ */ \r
public void setLimit(String field, String operator, String value, String label) {\r
setParameter(new LimitParameter(new Expression(field,operator,value,label)));\r
}\r
\r
+ /** \r
+ * Returns the <code>limit</code> parameter value.\r
+ */\r
public String getLimit () {\r
return getParameter("limit") == null ? null : ((FilterParameter)getParameter("limit")).getValueWithExpressions(); \r
}\r
\r
+ /**\r
+ * Checks if there are any limit expressions matching any of the given expressionFields\r
+ * @param expressionFields expression fields (left-of-operator entities) to look for\r
+ * @return true if expression(s) found with any of <code>expressionFields</code> \r
+ */\r
public boolean hasLimitExpression(String... expressionFields) {\r
logger.trace("Checking for limit expression for " + Arrays.deepToString(expressionFields));\r
for (String field : expressionFields) {\r
return false;\r
}\r
\r
+ /**\r
+ * Returns the first limit expression of the given type\r
+ * @param expressionField expression field (left-of-operator entity) to look for\r
+ * @return the first limit expression found with the field <code>expressionField</code> or null if none found \r
+ */\r
public Expression getOneLimitExpression(String expressionField) {\r
List<Expression> exprs = getLimitExpressions(expressionField);\r
if (exprs != null && exprs.size()>0) {\r
} \r
}\r
\r
+ /**\r
+ * Return a list of all current limit expressions\r
+ */\r
public List<Expression> getLimitExpressions() {\r
return getParameter("limit").getExpressions();\r
}\r
\r
+ /**\r
+ * Returns a list of limit expressions with fields that matches on of <code>expressionFields</code>\r
+ * \r
+ * @param expressionFields limit expressions to look for\r
+ */\r
public List<Expression> getLimitExpressions(String... expressionFields) {\r
logger.trace("Checking for limit parameter");\r
if (parameters.get("limit")!=null) {\r
}\r
}\r
\r
+ /**\r
+ * Adds a limit expression with a label for display. The limit is added to the end\r
+ * of an ordered list. \r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ * @param label\r
+ */\r
public void addLimit(String field, String operator, String value, String label) {\r
if (getParameter("limit") == null) {\r
setLimit(field, operator, value, label);\r
}\r
}\r
\r
+ /**\r
+ * Clears the limit parameter\r
+ */\r
public void removeLimits() {\r
removeParameter("limit");\r
}\r
\r
+ /**\r
+ * Removes all limit expressions that have fields as listed in <code>fieldsToRemove</code>\r
+ * @param fieldsToRemove\r
+ */\r
public void removeLimits(String... fieldsToRemove) { \r
removeExpressions("limit",fieldsToRemove); \r
}\r
\r
+ /**\r
+ * Removes a limit expression by exact attributes\r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ */\r
public void removeLimit(String field, String operator, String value) {\r
removeExpression("limit",new Expression(field, operator, value, null)); \r
}\r
\r
+ /**\r
+ * Removes limit expressions coming after the provided limit expression, if they have a field listed in\r
+ * <code>fieldsToRemove</code>. To be used for bread crumb like UI controls.\r
+ * \r
+ * @param field\r
+ * @param operator\r
+ * @param value\r
+ * @param fieldsToRemove\r
+ */\r
public void removeLimitsAfter(String field, String operator, String value, String... fieldsToRemove) { \r
removeExpressionsAfter("limit",new Expression(field,operator,value,null),fieldsToRemove); \r
}\r
\r
\r
+ /**\r
+ * Sets the <code>startrecs</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setStartrecs (String startrecs) {\r
setParameter(new CommandParameter("startrecs","=",startrecs));\r
}\r
\r
+ /** \r
+ * Returns the <code>startrecs</code> parameter value.\r
+ */\r
public String getStartrecs () {\r
return getParameterValue("startrecs");\r
}\r
\r
+ /**\r
+ * Sets the <code>maxrecs</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setMaxrecs (String maxrecs) {\r
setParameter(new CommandParameter("maxrecs","=",maxrecs));\r
}\r
\r
+ /** \r
+ * Returns the <code>maxrecs</code> parameter value.\r
+ */\r
public String getMaxrecs () {\r
return getParameterValue("maxrecs");\r
}\r
\r
+ /**\r
+ * Sets the <code>sort</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setSort (String sort) {\r
setParameter(new CommandParameter("sort","=",sort));\r
}\r
\r
+ /** \r
+ * Returns the <code>sort</code> parameter value.\r
+ */\r
public String getSort () {\r
return getParameterValue("sort");\r
}\r
\r
+ /**\r
+ * Sets the <code>rank</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setRank (String rank) {\r
setParameter(new CommandParameter("rank","=",rank));\r
}\r
\r
+ /** \r
+ * Returns the <code>rank</code> parameter value.\r
+ */\r
public String getRank () {\r
return getParameterValue("rank");\r
}\r
\r
+ /**\r
+ * Sets the <code>mergekey</code> parameter. See Pazpar2 documentation for details.\r
+ */ \r
public void setMergekey (String mergekey) {\r
setParameter(new CommandParameter("mergekey","=",mergekey));\r
}\r
\r
+ /** \r
+ * Returns the <code>mergekey</code> parameter value.\r
+ */\r
public String getMergekey () {\r
return getParameterValue("mergekey");\r
}\r