X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FPazpar2Commands.java;h=b847e1776080ba7d09d5047027125428d0787b5d;hb=86f289cd42ba95846c80d22129ed565e4e9d6dde;hp=67213e3cdd88cd93765fd65335e125148e75bc8e;hpb=9cd922c29f423b69da6f52eabf0c7fdb0b0b6ca5;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java index 67213e3..b847e17 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java @@ -11,6 +11,25 @@ import com.indexdata.mkjsf.pazpar2.Pz2Service; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommands; import com.indexdata.mkjsf.utils.Utils; +/** + * Pazpar2Commands holds references to all Pazpar2 commands. + *

+ * The Pazpar2Commands object itself is exposed to the UI as pzreq. + *

+ *

+ * When the UI request a command it will be retrieved from the current state + * through the state manager, so that the command can trigger a mutation of + * the state if the user/UI modifies its parameters. + *

+ *

Examples:

+ * + * + * @author Niels Erik + * + */ @SessionScoped @Named public class Pazpar2Commands implements Serializable { @@ -31,52 +50,96 @@ public class Pazpar2Commands implements Serializable { public Pazpar2Commands() { logger.info("Initializing Pazpar2Commands [" + Utils.objectId(this) + "]"); } - - // public void setService(Pz2Service service) { - // this.pz2 = service; - // logger.info("Post construct Pazpar2Command: Service is " + pz2); - // } - + + /** + * init command - referenced from UI as pzreq.init + * + * @return init command from current state + */ public InitCommand getInit() { return (InitCommand) (Pz2Service.get().getStateMgr().getCommand(INIT)); } + /** + * ping command - referenced from UI as pzreq.ping + * + * @return ping command from current state + */ public PingCommand getPing() { return (PingCommand) (Pz2Service.get().getStateMgr().getCommand(PING)); } + /** + * settings command - referenced from UI as pzreq.settings + * + * @return settings command from current state + */ public SettingsCommand getSettings() { return (SettingsCommand) (Pz2Service.get().getStateMgr().getCommand(SETTINGS)); } + /** + * + * @return search command from current state + */ public SearchCommand getSearch() { return (SearchCommand) (Pz2Service.get().getStateMgr().getCommand(SEARCH)); } + /** + * + * @return stat command from current state + */ public StatCommand getStat() { return (StatCommand) (Pz2Service.get().getStateMgr().getCommand(STAT)); } + /** + * + * @return show command from current state + */ public ShowCommand getShow() { return (ShowCommand) (Pz2Service.get().getStateMgr().getCommand(SHOW)); } + /** + * + * @return record command from current state + */ public RecordCommand getRecord() { return (RecordCommand) (Pz2Service.get().getStateMgr().getCommand(RECORD)); } + /** + * + * @return termlist command from current state + */ public TermlistCommand getTermlist() { return (TermlistCommand) (Pz2Service.get().getStateMgr().getCommand(TERMLIST)); } + /** + * + * @return bytarget command from current state + */ public BytargetCommand getBytarget() { return (BytargetCommand) (Pz2Service.get().getStateMgr().getCommand(BYTARGET)); } + /** + * Generically retrieves any command + * + * @param name name of command to retrieve + * @return command of the given type + */ public Pazpar2Command getCommand(String name) { return Pz2Service.get().getStateMgr().getCommand(name); } + /** + * Gets the object holding references to Service Proxy-only commands. + * @return + */ public ServiceProxyCommands getSp() { if (sp == null) { sp = new ServiceProxyCommands(Pz2Service.get().getStateMgr());