WfProcessIterator pi = sc.get_iterator_process();
ProcessFilterBuilder pfb = shark.getProcessFilterBuilder();
XPDLBrowser xpdl = shark.getXPDLBrowser();
WMFilter filter = new WMFilter();
if (processInstanceId != null && processInstanceId.trim().length() > 0) {
filter = pfb.addIdEquals(sessionHandle, processInstanceId);
}
pi.set_query_expression(pfb.toIteratorExpression(sessionHandle, filter));
WfProcess[] wfProcessArray = pi.get_next_n_sequence(0);
WorkflowProcess wfProcess = new WorkflowProcess();
double limit = -1;
//get process limit
AdminMisc admin = shark.getAdminMisc();
WMEntity processLimitEnt = admin.getProcessDefinitionInfo(sessionHandle, processInstanceId);
filter = new WMFilter();
filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
filter.setAttributeName("Type");
filter.setFilterString("ProcessHeader");
WMEntityIterator processLimitEntityIterator = xpdl.listEntities(sessionHandle, processLimitEnt, filter, true);
WMEntity[] processLimitEntityList = null;
if (processLimitEntityIterator != null) {
processLimitEntityList = processLimitEntityIterator.getArray();
}
if (processLimitEntityList != null) {
WMEntity processLimitEntity = processLimitEntityList[0];
filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
filter.setAttributeName("Name");
filter.setFilterString("Limit");
WMAttributeIterator procAttributeIterator = xpdl.listAttributes(sessionHandle, processLimitEntity, filter, true);
WMAttribute[] procAttributeList = null;
if (procAttributeIterator != null) {
procAttributeList = procAttributeIterator.getArray();
}
if (procAttributeList[0].getValue() != null && !procAttributeList[0].getValue().equals("")) {
try {
limit = Double.parseDouble((String) procAttributeList[0].getValue());
} catch (Exception e) {}
}
}
String durationUnit = "";
if (limit != -1) {
//get duration unit
filter = new WMFilter();
filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
filter.setAttributeName("Type");
filter.setFilterString("ProcessHeader");
WMEntity processDurationEnt = admin.getProcessDefinitionInfo(sessionHandle, processInstanceId);
WMEntityIterator processDurationEntityIterator = xpdl.listEntities(sessionHandle, processDurationEnt, filter, true);
WMEntity[] processDurationEntityList = null;
if (processDurationEntityIterator != null) {
processDurationEntityList = processDurationEntityIterator.getArray();
}
if (processDurationEntityList != null) {
WMEntity entity = processDurationEntityList[0];
filter = new WMFilter();
filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
filter.setAttributeName("Name");
filter.setFilterString("DurationUnit");
WMAttributeIterator procAttributeIterator = xpdl.listAttributes(sessionHandle, entity, filter, true);
WMAttribute[] procAttributeList = null;
if (procAttributeIterator != null) {
procAttributeList = procAttributeIterator.getArray();