* Update data if not already updated in this lifecycle.
* @throws RemoteException
*/
protected void update() throws RemoteException {
MethodInvocationBatch mib = new MethodInvocationBatch ();
WorkflowService wfs = WorkflowServiceConnection
.instance("workflowServiceConnection").getWorkflowService();
if (processCache == null) {
ProcessDirectory pd = wfs.processDirectory();
mib.addInvocation
(pd, "lookupProcess",
new String[] {"java.lang.String", "java.lang.String"},
new Object[] {mgrName, processKey});
mib.addInvocation(-1, "processDefinition", null, null, false);
mib.addInvocation(-1, "packageId", null, null, false);
mib.addInvocation(-2, "packageName", null, null, false);
mib.addInvocation(-3, "processId", null, null, false);
mib.addInvocation(-4, "processName", null, null, true);
mib.addInvocation(-5, "name", null, null, false);
mib.addInvocation(-6, "priority", null, null, false);
mib.addInvocation(-7, "state", null, null, false);
mib.addInvocation(-8, "createTime", null, null, false);
mib.addInvocation(-9, "lastStateTime", null, null, false);
mib.addInvocation(-10, "requester", null, null, false);
} else {
mib.addInvocation(processCache, "key", null, null);
mib.addInvocation
(processCache, "processDefinition", null, null);
mib.addInvocation(-1, "mgrName", null, null, false);
mib.addInvocation(-2, "packageId", null, null, false);
mib.addInvocation(-3, "packageName", null, null, false);
mib.addInvocation(-4, "processId", null, null, false);
mib.addInvocation(-5, "processName", null, null, true);
mib.addInvocation(processCache, "name", null, null);
mib.addInvocation(processCache, "priority", null, null);
mib.addInvocation(processCache, "state", null, null);
mib.addInvocation(processCache, "createTime", null, null);
mib.addInvocation(processCache, "lastStateTime", null, null);
mib.addInvocation(processCache, "requester", null, null);
}
MethodInvocationBatch.Result mir = null;
try {
mir = (MethodInvocationBatch.Result)wfs.executeBatch(mib);
} catch (InvocationTargetException e) {
throw (IllegalStateException)
(new IllegalStateException (e.getMessage())).initCause(e);
}
if (mir.hasExceptions ()) {
Exception e = mir.firstException ();
if (e instanceof RemoteException) {
throw (RemoteException)e;
}
throw (IllegalStateException)
(new IllegalStateException(e.getMessage())).initCause(e);
}
int resPos = 0;
if (processCache == null) {
processCache = (Process)mir.result(resPos++);
} else {
processKey = mir.resultAsString(resPos++);
mgrName = mir.resultAsString(resPos++);
}
packageId = mir.resultAsString(resPos++);
packageName = mir.resultAsString(resPos++);
processId = mir.resultAsString(resPos++);
processName = mir.resultAsString(resPos++);
name = mir.resultAsString(resPos++);
priority = mir.resultAsInt(resPos++);
state = mir.resultAsString(resPos++);
createTime = mir.resultAsDate(resPos++);
lastStateTime = mir.resultAsDate(resPos++);
WfRequester requester = (WfRequester)mir.result(resPos++);
if (requester instanceof WfActivity) {
mib = new MethodInvocationBatch ();
mib.addInvocation(requester, "name", null, null);
mib.addInvocation(requester, "key", null, null);
mib.addInvocation(requester, "container", null, null);
mib.addInvocation(-1, "manager", null, null, false);
mib.addInvocation(-1, "name", null, null, true);
mib.addInvocation(-2, "key", null, null, true);
mir = null;
try {
mir = (MethodInvocationBatch.Result)wfs.executeBatch(mib);
} catch (InvocationTargetException e) {
throw (IllegalStateException)
(new IllegalStateException (e.getMessage())).initCause(e);
}
if (mir.hasExceptions ()) {