From 017a20f6da489d3d968025f0442213aee7252c41 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 6 Jun 2013 11:34:49 -0400 Subject: [PATCH] Javadoc --- .../mkjsf/pazpar2/commands/QueryParameter.java | 2 +- .../mkjsf/pazpar2/commands/SettingsCommand.java | 6 +++ .../mkjsf/pazpar2/commands/ShowCommand.java | 54 +++++++++++++------- .../mkjsf/pazpar2/commands/StatCommand.java | 6 +++ .../mkjsf/pazpar2/commands/TermlistCommand.java | 20 +++++++- .../mkjsf/pazpar2/commands/sp/AuthCommand.java | 34 ++++++++++-- .../pazpar2/commands/sp/CategoriesCommand.java | 11 ++-- .../mkjsf/pazpar2/commands/sp/InitCommandSp.java | 7 ++- .../mkjsf/pazpar2/commands/sp/RecordCommandSp.java | 14 ++++- .../pazpar2/commands/sp/ServiceProxyCommands.java | 12 ++++- 10 files changed, 135 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/QueryParameter.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/QueryParameter.java index a447cfe..5213e52 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/QueryParameter.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/QueryParameter.java @@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands; /** * Represents a query parameter as it applies to the Pazpar2 search command * - *

A query parameter can consists of a term value and/or one or more expressions + *

A query parameter can consist of a term value and/or one or more expressions * separated by boolean operators.

* *

A complex query can be represented in the object as either one long string diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java index 267e4f8..e2b8d29 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java @@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.commands; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; +/** + * Represents a Pazpar2 settings command. + * + * @author Niels Erik + * + */ public class SettingsCommand extends Pazpar2Command implements ServiceProxyCommand { private static final long serialVersionUID = 2291179325470387102L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java index 223f8f4..a24172a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java @@ -2,6 +2,13 @@ package com.indexdata.mkjsf.pazpar2.commands; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; + +/** + * Represents a Pazpar2 show command. + * + * @author Niels Erik + * + */ public class ShowCommand extends Pazpar2Command implements ServiceProxyCommand { private static final long serialVersionUID = -8242768313266051307L; @@ -12,21 +19,14 @@ public class ShowCommand extends Pazpar2Command implements ServiceProxyCommand { } /** - * Sets the sort order for results, the updates the 'show' data object - * from pazpar2. Set valid sort options in the documentation for pazpar2. - * - * The parts of the UI that display 'show' data should be rendered following - * this request. - * - * @param sortOption + * Sets Pazpar2 parameter sort. See Pazpar2 documentation for details. */ public void setSort (String sort) { setParameter(new CommandParameter("sort","=",sort)); } /** - * Retrieves the current sort order for results - * @return sort order - i.e. 'relevance' + * Gets parameter value for sort */ public String getSort () { return getParameter("sort") != null ? getParameter("sort").value : "relevance"; @@ -56,13 +56,7 @@ public class ShowCommand extends Pazpar2Command implements ServiceProxyCommand { } /** - * Sets the first record to show - starting at record '0'. After setting - * first record number, the 'show' data object will be updated from pazpar2, - * and the parts of the UI displaying show data should be re-rendered. - * - * To be used by the UI for paging. - * - * @param start first record to show + * Sets Pazpar2 parameter start. See Pazpar2 documentation for details. */ public void setStart (int start) { setParameter(new CommandParameter("start","=",start)); @@ -79,34 +73,58 @@ public class ShowCommand extends Pazpar2Command implements ServiceProxyCommand { return getParameter("start") != null ? Integer.parseInt(getParameter("start").value) : 0; } + /** + * Sets Pazpar2 parameter num. See Pazpar2 documentation for details. + */ public void setNum (int num) { setParameter(new CommandParameter("num","=",num)); } - + + /** + * Get the parameter value for num + */ public int getNum () { return getParameter("num") != null ? Integer.parseInt(getParameter("num").value) : 0; } + /** + * Sets Pazpar2 parameter block. See Pazpar2 documentation for details. + */ public void setBlock(String block) { setParameterInState(new CommandParameter("block","=",block)); } - + + /** + * Get the parameter value for block + */ public String getBlock() { return getParameterValue("block"); } + /** + * Sets Pazpar2 parameter mergekey. See Pazpar2 documentation for details. + */ public void setMergekey (String mergekey) { setParameter(new CommandParameter("mergekey","=",mergekey)); } + /** + * Get the parameter value for mergekey + */ public String getMergekey () { return getParameterValue("mergekey"); } + /** + * Sets Pazpar2 parameter rank. See Pazpar2 documentation for details. + */ public void setRank (String rank) { setParameter(new CommandParameter("rank","=",rank)); } + /** + * Get the parameter value for rank + */ public String getRank () { return getParameterValue("rank"); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java index 73867fd..b415ec4 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java @@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.commands; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; +/** + * Represents a Pazpar2 stat command. + * + * @author Niels Erik + * + */ public class StatCommand extends Pazpar2Command implements ServiceProxyCommand { private static final long serialVersionUID = 3980630346114157336L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java index 3631b5b..adb84a3 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java @@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.commands; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; +/** + * Represents a Pazpar2 termlist command. + * + * @author Niels Erik + * + */ public class TermlistCommand extends Pazpar2Command implements ServiceProxyCommand { private static final long serialVersionUID = -7067878552863021727L; @@ -10,18 +16,30 @@ public class TermlistCommand extends Pazpar2Command implements ServiceProxyComma super("termlist"); } + /** + * Sets Pazpar2 parameter name. See Pazpar2 documentation for details. + */ public void setName(String names) { setParameter(new CommandParameter("name","=",names)); } + /** + * Gets parameter value for name + */ public String getName () { return getParameterValue("name"); } - + + /** + * Sets Pazpar2 parameter num. See Pazpar2 documentation for details. + */ public void setNum (String num) { setParameter(new CommandParameter("num","=",num)); } + /** + * Gets parameter value for num + */ public String getNum () { return getParameterValue("num"); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java index 3167720..67780e5 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java @@ -10,7 +10,9 @@ import com.indexdata.mkjsf.pazpar2.data.ResponseParser; import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject; /** - * Authenticates a user against a Pazpar2 Service Proxy + * Represents a Service Proxy auth command. + * + *

Authenticates a user against a Pazpar2 Service Proxy

* * @author Niels Erik * @@ -40,33 +42,59 @@ public class AuthCommand extends Pazpar2Command implements ServiceProxyCommand { return responseObject; } + /** + * Normalizes the response XML for the benefit of the SAX parser that creates data objects. + *

The parser expects responses to have document element names corresponding to the names of + * the commands that created the responses.

+ * + * @param responseString + * @param newName + * @return + */ private String renameResponseElement(String responseString, String newName) { responseString = responseString.replace("", "<" + newName + ">"); responseString = responseString.replace("", ""); return responseString; } - + /** + * Sets Service Proxy command parameter action. See Service Proxy documentation for details. + */ public void setAction (String action) { setParameterInState(new CommandParameter("action","=",action)); } + /** + * Gets parameter value for action + */ public String getAction () { return getParameterValue("action"); } + /** + * Sets Service Proxy command parameter username. See Service Proxy documentation for details. + */ public void setUsername(String username) { setParameterInState(new CommandParameter("username","=",username)); } + /** + * Gets parameter value for username + */ public String getUsername () { return getParameterValue("username"); } - + + /** + * Sets Service Proxy command parameter password. See Service Proxy documentation for details. + */ public void setPassword (String password) { setParameterInState(new CommandParameter("password","=",password)); } + /** + * Gets parameter value for password + */ public String getPassword () { return getParameterValue("password"); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java index b3794ec..756f85c 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java @@ -7,12 +7,13 @@ import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.data.sp.CategoriesResponse; /** - * Retrieves target categories available to the current Service Proxy user. + * Represents a Service Proxy categories command. + * + *

Retrieves target categories available to the current Service Proxy user.

+ *

Target categories can be used to limit a search to resources tagged with the given + * category. The following request in a Faces page would obtain categories for display in, say, a select list: *

- * Target categories can be used to limit a search to resources tagged with the given - * category. The following request in a Faces page would obtain categories for displaying, say, a select list: - *

- * pzreq.sp.categories.run().targetCategories + * pzreq.sp.categories.run().targetCategories *

* This would get the Service Proxy extension commands, pick the categories command, execute it, and retrieve * a list of TargetCategory objects from the returned response data object. diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitCommandSp.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitCommandSp.java index dba12b0..1c7748a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitCommandSp.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitCommandSp.java @@ -16,10 +16,12 @@ import com.indexdata.mkjsf.pazpar2.data.ResponseParser; import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject; /** - * Service Proxy extensions to the init command - specifically + * Service Proxy extensions to the Pazpar2 init command - specifically * support for POSTing to the Service Proxy an init doc containing Pazpar2 * definitions and settings. * + * This feature, however, is not supported in the publicly released Service Proxy at this point. + * * @author Niels Erik * */ @@ -36,6 +38,9 @@ public class InitCommandSp implements Serializable, ServiceProxyCommand { initDocUpload = new InitDocUpload(); } + /** + * Sets Service Proxy command parameter includeDebug. + */ public void setIncludeDebug (String includeDebug) { command.setParameterInState(new CommandParameter("includeDebug","=",includeDebug)); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java index 1d7cfc8..e1b94d8 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java @@ -6,7 +6,7 @@ import com.indexdata.mkjsf.pazpar2.commands.CommandParameter; import com.indexdata.mkjsf.pazpar2.commands.RecordCommand; /** - * Service Proxy extensions to the record command. + * Service Proxy extensions to the Papzar2 record command. * * @author Niels Erik * @@ -20,18 +20,30 @@ public class RecordCommandSp implements Serializable, ServiceProxyCommand { this.command = command; } + /** + * Sets Service Proxy command parameter recordquery. See Service Proxy documentation for details. + */ public void setRecordquery (String recordQuery) { command.setParameter(new CommandParameter("recordquery","=",recordQuery)); } + /** + * Gets parameter value for recordquery + */ public String getRecordquery() { return command.getParameterValue("recordquery"); } + /** + * Sets Service Proxy command parameter acefilter. See Service Proxy documentation for details. + */ public void setAcefilter (String aceFilter) { command.setParameter(new CommandParameter("acefilter","=",aceFilter)); } + /** + * Gets parameter value for acefilter + */ public String getAcefilter () { return command.getParameterValue("acefilter"); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommands.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommands.java index 8c34260..c874cc1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommands.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommands.java @@ -9,7 +9,7 @@ import com.indexdata.mkjsf.utils.Utils; /** * ServiceProxyCommands holds references to all commands that are - * Service Proxy-only, that is, not supported by straight Pazpar2. + * Service Proxy-only, those that are NOT supported by straight Pazpar2, that is. * * @author Niels Erik * @@ -27,10 +27,20 @@ public class ServiceProxyCommands implements Serializable { this.stateMgr = stateMgr; } + /** + * auth command - referenced from UI as pzreq.sp.auth + * + * @return auth command from current state + */ public AuthCommand getAuth() { return (AuthCommand) (stateMgr.getCommand(AUTH)); } + /** + * categories command - referenced from UI as pzreq.sp.categories + * + * @return categories command from current state + */ public CategoriesCommand getCategories() { return (CategoriesCommand) (stateMgr.getCommand(CATEGORIES)); } -- 1.7.10.4