Class CommandResult
java.lang.Object
org.deltava.commands.CommandResult
- All Implemented Interfaces:
Serializable
Returns the results of a web Command. All commands need to return an object of this class when completing their
execute() method, and based on the data contained within this class the controller servlet will perform further
processing.
- Since:
- 1.0
- Version:
- 2.3
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommandResult
(String resultPage) Create a new CommandResult forwarding the Controller to a new servlet. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete()
A helper method to "stop the clock" for execution and setTime().long
Return the back-end utilization time of the last command.int
Returns the HTTP status code to return.boolean
Did the command complete successfully?long
getTime()
Return the execution time of the last command.getType()
The type of action the controller should perform next.getURL()
Returns the URL the controller should forward to.void
setBackEndTime
(long time) Set the total back-end usage time for this Command.void
setHttpCode
(int code) Updates the HTTP status code to return on completion.void
setSuccess
(boolean success) Mark if the previous Command complated successfullyvoid
setTime
(long time) Set the total execution time for this Commandvoid
setType
(ResultType type) Sets the result type of this command.void
Set the URL to process next.void
Sets the URL to process next, when executing a command with parameters and a numeric ID.void
Sets the URL to process next, when executing a command with parameters.
-
Constructor Details
-
CommandResult
CommandResult(String resultPage) Create a new CommandResult forwarding the Controller to a new servlet.- Parameters:
resultPage
- the resource name to forward to
-
-
Method Details
-
getSuccess
public boolean getSuccess()Did the command complete successfully?- Returns:
- TRUE if the command completed successfully, otherwise FALSE
- See Also:
-
getTime
public long getTime()Return the execution time of the last command.- Returns:
- the time the last command took to execute, in milliseconds
- See Also:
-
getBackEndTime
public long getBackEndTime()Return the back-end utilization time of the last command.- Returns:
- the time the back-end was used, in milliseconds. This is useful for determining usage of shared back-end resources, like JDBC or JNDI connections.
- See Also:
-
getURL
Returns the URL the controller should forward to.- Returns:
- the URL/resource to forward to
-
getHttpCode
public int getHttpCode()Returns the HTTP status code to return.- Returns:
- the HTTP status code
- See Also:
-
getType
The type of action the controller should perform next.- Returns:
- the action type for the controller
-
complete
public void complete()A helper method to "stop the clock" for execution and setTime().- See Also:
-
setSuccess
public void setSuccess(boolean success) Mark if the previous Command complated successfully- Parameters:
success
- TRUE if the command completed successfully, otherwise FALSE
-
setTime
public void setTime(long time) Set the total execution time for this Command- Parameters:
time
- the time in milliseconds- See Also:
-
setBackEndTime
public void setBackEndTime(long time) Set the total back-end usage time for this Command.- Parameters:
time
- the back-end usage time in milliseconds- See Also:
-
setHttpCode
public void setHttpCode(int code) Updates the HTTP status code to return on completion.- Parameters:
code
- the HTTP status code- Throws:
IllegalStateException
- if result has not been set to RESULT_HTTPCODE- See Also:
-
setURL
-
setURL
-
setURL
-
setType
Sets the result type of this command. This tells the controller servlet what kind of action to perform next on the URL.- Parameters:
type
- the result type- Throws:
IllegalArgumentException
- if resultCode is negative or not listed in RESULT- See Also:
-