public class Helper extends Object
Constructor and Description |
---|
Helper(omero.cmd.Request request,
omero.cmd.Status status,
SqlAction sql,
org.hibernate.Session session,
ServiceFactory sf) |
Modifier and Type | Method and Description |
---|---|
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(omero.cmd.ERR err,
Throwable t,
String name,
Map<String,String> params)
Like
fail(ERR, Throwable, String, String...) throws a
HandleI.Cancel exception. |
HandleI.Cancel |
cancel(omero.cmd.ERR err,
Throwable t,
String name,
String... paramList)
Calls
cancel(ERR, Throwable, String, Map) with
the output of params(String...) . |
void |
debug(String fmt,
Object... args) |
void |
error(String fmt,
Object... args) |
void |
error(Throwable t,
String fmt,
Object... args) |
void |
fail(omero.cmd.ERR err,
Throwable t,
String name,
Map<String,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(omero.cmd.ERR err,
Throwable t,
String name,
String... paramList)
Calls
fail(ERR, Throwable, String, Map) with the output of
params(String...) . |
EventContext |
getEventContext()
Provides an
EventContext instance without reloading the session,
via LocalAdmin.getEventContextQuiet() . |
omero.cmd.Response |
getResponse() |
ServiceFactory |
getServiceFactory() |
org.hibernate.Session |
getSession() |
SqlAction |
getSql() |
omero.cmd.Status |
getStatus() |
int |
getSteps() |
void |
info(String fmt,
Object... args) |
boolean |
isLast(int step)
Returns true if this is the last step for the given request.
|
Map<String,String> |
params(String... paramList)
Converts pairs of values from the varargs list into a map.
|
boolean |
setResponseIfNull(omero.cmd.Response rsp)
Set the response if there is not currently run, in which case true
is returned.
|
void |
setSteps(int steps) |
Helper |
subhelper(omero.cmd.Request req,
omero.cmd.Status substatus)
Run
IRequest.init(Helper) on a sub-command by creating a new
Helper instance. |
void |
warn(String fmt,
Object... args) |
public Helper(omero.cmd.Request request, omero.cmd.Status status, SqlAction sql, org.hibernate.Session session, ServiceFactory sf)
public Helper subhelper(omero.cmd.Request req, omero.cmd.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 setSteps(int steps)
public int getSteps()
public omero.cmd.Status getStatus()
public omero.cmd.Response getResponse()
public boolean setResponseIfNull(omero.cmd.Response rsp)
rsp
- the responsepublic ServiceFactory getServiceFactory()
public org.hibernate.Session getSession()
public SqlAction getSql()
public Map<String,String> params(String... paramList)
paramList
- a list of parameterspublic void fail(omero.cmd.ERR err, Throwable t, String name, String... paramList)
fail(ERR, Throwable, String, Map)
with the output of
params(String...)
.public void fail(omero.cmd.ERR err, Throwable t, String name, Map<String,String> params)
public HandleI.Cancel cancel(omero.cmd.ERR err, Throwable t, String name, String... paramList)
cancel(ERR, Throwable, String, Map)
with
the output of params(String...)
.
See the statement about the return value.public HandleI.Cancel cancel(omero.cmd.ERR err, Throwable t, String name, Map<String,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 EventContext getEventContext()
EventContext
instance without reloading the session,
via LocalAdmin.getEventContextQuiet()
.
Version: 5.3.3-ice35-b63
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.