public class Helper
extends java.lang.Object
Constructor and Description |
---|
Helper(Request request,
Status status,
ome.util.SqlAction sql,
org.hibernate.Session session,
ome.system.ServiceFactory sf) |
Modifier and Type | Method and Description |
---|---|
void |
allowGuests()
Must be called before setSteps if access by the guest user is to be
allowed.
|
void |
assertResponse(int step)
Checks the given steps against the number of times that this method
has been called on this instance and then increments the call count.
|
void |
assertStep(int step)
Checks the given steps against the number of times that this method
has been called on this instance and then increments the call count.
|
void |
assertStep(int i,
int step)
Throws an exception if the current step is not the expected value.
|
HandleI.Cancel |
cancel(ERR err,
java.lang.Throwable t,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> params)
Like
fail(ERR, Throwable, String, String...) throws a
HandleI.Cancel exception. |
HandleI.Cancel |
cancel(ERR err,
java.lang.Throwable t,
java.lang.String name,
java.lang.String... paramList)
Calls
cancel(ERR, Throwable, String, Map) with
the output of params(String...) . |
void |
debug(java.lang.String fmt,
java.lang.Object... args) |
void |
error(java.lang.String fmt,
java.lang.Object... args) |
void |
error(java.lang.Throwable t,
java.lang.String fmt,
java.lang.Object... args) |
void |
fail(ERR err,
java.lang.Throwable t,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> params)
Sets the status.flags and the ERR properties appropriately and also
stores the message and stacktrace of the throwable in the parameters.
|
void |
fail(ERR err,
java.lang.Throwable t,
java.lang.String name,
java.lang.String... paramList)
Calls
fail(ERR, Throwable, String, Map) with the output of
params(String...) . |
ome.system.EventContext |
getEventContext()
Provides an
EventContext instance without reloading the session,
via LocalAdmin.getEventContextQuiet() . |
Response |
getResponse() |
ome.system.ServiceFactory |
getServiceFactory() |
org.hibernate.Session |
getSession() |
ome.util.SqlAction |
getSql() |
Status |
getStatus() |
int |
getSteps() |
void |
info(java.lang.String fmt,
java.lang.Object... args) |
boolean |
isLast(int step)
Returns true if this is the last step for the given request.
|
java.util.Map<java.lang.String,java.lang.String> |
params(java.lang.String... paramList)
Converts pairs of values from the varargs list into a map.
|
boolean |
setResponseIfNull(Response rsp)
Set the response if there is not currently run, in which case true
is returned.
|
void |
setSteps(int steps) |
Helper |
subhelper(Request req,
Status substatus)
Run
IRequest.init(Helper) on a sub-command by creating a new
Helper instance. |
void |
warn(java.lang.String fmt,
java.lang.Object... args) |
public Helper subhelper(Request req, Status substatus)
IRequest.init(Helper)
on a sub-command by creating a new
Helper instance.req
- the requestsubstatus
- its status for its new helperpublic void allowGuests()
public void setSteps(int steps)
public int getSteps()
public Status getStatus()
public Response getResponse()
public boolean setResponseIfNull(Response rsp)
rsp
- the responsepublic ome.system.ServiceFactory getServiceFactory()
public org.hibernate.Session getSession()
public ome.util.SqlAction getSql()
public void debug(java.lang.String fmt, java.lang.Object... args)
public void info(java.lang.String fmt, java.lang.Object... args)
public void warn(java.lang.String fmt, java.lang.Object... args)
public void error(java.lang.String fmt, java.lang.Object... args)
public void error(java.lang.Throwable t, java.lang.String fmt, java.lang.Object... args)
public java.util.Map<java.lang.String,java.lang.String> params(java.lang.String... paramList)
paramList
- a list of parameterspublic void fail(ERR err, java.lang.Throwable t, java.lang.String name, java.lang.String... paramList)
fail(ERR, Throwable, String, Map)
with the output of
params(String...)
.public void fail(ERR err, java.lang.Throwable t, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> params)
public HandleI.Cancel cancel(ERR err, java.lang.Throwable t, java.lang.String name, java.lang.String... paramList)
cancel(ERR, Throwable, String, Map)
with
the output of params(String...)
.
See the statement about the return value.public HandleI.Cancel cancel(ERR err, java.lang.Throwable t, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> params)
fail(ERR, Throwable, String, String...)
throws a
HandleI.Cancel
exception.
A HandleI.Cancel
is thrown, even though one is also specified as the
return value. This permits:
} catch (Throwable t) { throw helper.cancel(new ERR(), t); }since omitting the "throw" within the catch clauses forces one to enter a number of "return null; // Never reached" lines.
public void assertStep(int i, int step)
public boolean step(int i) { if (helper.assertStep(0, i)) { return null; }
i
- the expected step numberstep
- the actual step numberpublic void assertStep(int step)
step
- the new step numberpublic void assertResponse(int step)
step
- the step number for the new responsepublic boolean isLast(int step)
step
- the step numberpublic ome.system.EventContext getEventContext()
EventContext
instance without reloading the session,
via LocalAdmin.getEventContextQuiet()
.