public abstract class Pazpar2Command
extends java.lang.Object
implements java.io.Serializable
Being an abstract class it only has generic methods for getting and setting parameters. Implementing classes are supposed to create named getters and setters for convenient access to parameters from the UI.
Parameters can be set with or without notifying the state manager.
Note: Internally the application has to be able to set parameters without state changes - for instance to avoid eternal feedback when copying parameter from one state to the next. A setting from the UI should spawn a new search state however.
Constructor and Description |
---|
Pazpar2Command() |
Pazpar2Command(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addExpression(java.lang.String parameterName,
Expression expression)
Adds an expression to an ordered list of expressions on a given parameter
and notifies the state manager of the change
|
abstract Pazpar2Command |
copy()
Commands must implement this method to provide an completely detached, deep clone of
themselves.
|
boolean |
equals(java.lang.Object otherCommand) |
java.lang.String |
getCommandName() |
java.lang.String |
getEncodedQueryString() |
CommandParameter |
getParameter(java.lang.String name)
Retrieves a command parameter by parameter name
|
java.lang.String |
getParameterValue(java.lang.String parameterName) |
java.lang.String |
getSession() |
abstract ServiceProxyCommand |
getSp()
Implementing classes must provide their Service Proxy
extension command if any extension parameters exists,
or -- just to be polite -- 'this' if there is no
Service Proxy extension to the given command.
|
java.lang.String |
getValueWithExpressions() |
int |
hashCode() |
boolean |
hasParameters() |
boolean |
hasParameterValue(java.lang.String parameterName) |
void |
removeExpression(java.lang.String parameterName,
Expression expression) |
void |
removeExpressions(java.lang.String parameterName,
java.lang.String... expressionFields) |
void |
removeExpressionsAfter(java.lang.String parameterName,
Expression expression,
java.lang.String... expressionFields) |
void |
removeParameter(java.lang.String name)
Removes a parameter completely and notifies the state manager
about the change
|
void |
removeParameters()
Removes multiple parameters completely and notifies the state manager
-- once -- about the change
|
void |
removeParametersInState()
Removes all parameters without notifying the state manager.
|
ResponseDataObject |
run()
Executes the command with the currently selected parameters against
the currently selected Pazpar2 service
|
ResponseDataObject |
run(SearchClient client,
Responses pzresp)
Executes the command in a thread.
|
ResponseDataObject |
runWith(java.lang.String... parameters)
Executes the commands with the currently selected parameters, while adding
the parameters provided in the vararg
|
ResponseDataObject |
runWith2(java.lang.String parameters,
java.lang.String delimiter)
Executes the commands with the currently selected parameters, while adding
the parameters provided in the 'delimiter'-separated String.
|
void |
setCommandName(java.lang.String name) |
void |
setParameter(CommandParameter parameter)
Sets a parameter on this command and notifies the state manager
about the change
|
void |
setParameterInState(CommandParameter parameter)
Sets a parameter on this command without notifying the state manager.
|
void |
setParameters(CommandParameter... params)
Sets multiple parameters on the command and notifies the state
manager -- once -- about the change
|
void |
setParametersInState(CommandParameter... params)
Sets multiple parameters on this command without notifying the state manager.
|
void |
setSession(java.lang.String sessionId) |
abstract boolean |
spOnly()
Here implementing commands publish whether they only
apply to the Service Proxy or can be executed
against straight Pazpar2 as well.
|
java.lang.String |
toString() |
public Pazpar2Command()
public Pazpar2Command(java.lang.String name)
public void setCommandName(java.lang.String name)
public abstract Pazpar2Command copy()
public java.lang.String getCommandName()
public ResponseDataObject run()
public ResponseDataObject runWith(java.lang.String... parameters)
parameters
- A list of parameters on the form [key=value]public ResponseDataObject runWith2(java.lang.String parameters, java.lang.String delimiter)
parameters
- A list of parameters separated by 'delimiter'delimiter
- The separator character of the String 'parameters'public ResponseDataObject run(SearchClient client, Responses pzresp)
client
- pzresp
- public void setParameter(CommandParameter parameter)
parameter
- public void setParameters(CommandParameter... params)
params
- public void setParametersInState(CommandParameter... params)
params
- public void setParameterInState(CommandParameter parameter)
parameter
- public CommandParameter getParameter(java.lang.String name)
name
- of the parameterpublic void removeParameter(java.lang.String name)
name
- of the parameter to removepublic void removeParameters()
name
- of the parameter to removepublic void removeParametersInState()
public void addExpression(java.lang.String parameterName, Expression expression)
parameterName
- name of the parameter to add the expression toexpression
- public void removeExpression(java.lang.String parameterName, Expression expression)
public void removeExpressionsAfter(java.lang.String parameterName, Expression expression, java.lang.String... expressionFields)
public void removeExpressions(java.lang.String parameterName, java.lang.String... expressionFields)
public boolean hasParameters()
public boolean hasParameterValue(java.lang.String parameterName)
public java.lang.String getEncodedQueryString()
public java.lang.String getValueWithExpressions()
public boolean equals(java.lang.Object otherCommand)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getParameterValue(java.lang.String parameterName)
public void setSession(java.lang.String sessionId)
public java.lang.String getSession()
public abstract ServiceProxyCommand getSp()
public abstract boolean spOnly()