return false;
}
sc = connect();
WfActivityIterator ai;
ActivityFilterBuilder aieb;
WMFilter filter;
WfActivity[] wfActivityArray;
WMSessionHandle sessionHandle = sc.getSessionHandle();
Shark shark = Shark.getInstance();
// get required activity def to start
AdminMisc admin = shark.getAdminMisc();
WMEntity procEntity = admin.getProcessDefinitionInfo(sessionHandle, processId);
XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
WMEntity[] entities = WMEntityUtilities.getOverallActivities(sessionHandle, xpdlBrowser, procEntity);
WMEntity activityDef = null;
for (WMEntity ent : entities) {
if (ent.getId().equals(activityDefId) && "Activity".equals(ent.getType())) {
activityDef = ent;
break;
}
}
LogUtil.debug(getClass().getName(), "Get required activity definition to start for " + activityDefId + ": " + activityDef);
if (activityDef == null) {
return false;
}
if (abortRunningActivities) {
LogUtil.debug(getClass().getName(), "aborting running activities for " + processId);
// get running activities for process
ai = sc.get_iterator_activity();
aieb = shark.getActivityFilterBuilder();
filter = new WMFilter();
filter = aieb.addProcessIdEquals(sessionHandle, processId);
filter = aieb.and(sessionHandle, filter, aieb.addStateStartsWith(sessionHandle, SharkConstants.STATEPREFIX_OPEN));
ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
wfActivityArray = ai.get_next_n_sequence(0);
// abort running activities
for (WfActivity wfAct : wfActivityArray) {
String actState = wfAct.state();
if (SharkConstants.STATE_OPEN_RUNNING.equals(actState) || SharkConstants.STATE_OPEN_NOT_RUNNING_NOT_STARTED.equals(actState)) {