if (logger.isDebugEnabled()) {
logger.debug("creating new process instance (" + name + ", "
+ subject + ", " + startImmediately + ")");
}
Process proc;
try {
proc = (Process) procMgr.createProcess(new DefaultRequester(
getWorkflowService()));
if (name != null) {
proc.setName(name);
}
if (subject != null) {
proc.setDescription(subject);
}
if (contextData != null) {
ProcessDefinition procdef = proc.processDefinition();
ProcessData procData = getProcessData(procdef, contextData);
proc.setProcessContext(procData);
}
if (startImmediately) {
proc.start();
// proc.setDebugEnabled(debug);
}
} catch (NotEnabledException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (InvalidRequesterException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (RequesterRequiredException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (CannotStartException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (AlreadyRunningException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (InvalidDataException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (UpdateNotAllowedException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED, e
.getMessage());
return;
} catch (ParseException e) {
FaultUtils.setFault(respMsg, ASAPException.ASAP_PARSING_ERROR, e
.getMessage());
return;
}
String observer = getChildsTextContent(action, "ObserverKey");
if (observer != null) {
try {
ProcessDefinition procdef = proc.processDefinition();
ObserverRegistry obs = getObserverRegistry();
obs.subscribe(observer, procdef.packageId(), procdef
.processId(), proc.key(), getResourceReference()
.getBaseUrl());
} catch (SQLException e) {
FaultUtils.setFault(respMsg, e);
return;