use of org.wso2.carbon.bpel.stub.mgt.types.Instances_type0 in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method addInstanceSummaryEntry.
private void addInstanceSummaryEntry(InstanceSummary instSum, ProcessConf pconf, InstanceStatus state) throws ProcessManagementException {
Instances_type0 instances = new Instances_type0();
instances.setState(state);
String queryStatus = InstanceFilter.StatusKeys.valueOf(state.toString()).toString().toLowerCase();
final InstanceFilter instanceFilter = new InstanceFilter("status=" + queryStatus + " pid=" + pconf.getProcessId());
int count = dbexec(new BpelDatabase.Callable<Integer>() {
public Integer run(BpelDAOConnection conn) throws Exception {
return conn.instanceCount(instanceFilter).intValue();
}
});
instances.setCount(count);
instSum.addInstances(instances);
}
use of org.wso2.carbon.bpel.stub.mgt.types.Instances_type0 in project carbon-business-process by wso2.
the class BpelUIUtil method createInstanceSummaryJSONObject.
/**
* Create instance summary JSON object from process instances array.
*
* @param processInstances process instance array
* @return instance summary object
*/
public static JSONObject createInstanceSummaryJSONObject(Instances_type0[] processInstances) {
JSONObject summary = new JSONObject();
int totalInstances = 0;
for (Instances_type0 processInstance : processInstances) {
String state = processInstance.getState().getValue();
if (state.equals(BPELUIConstant.INSTANCE_STATE_ACTIVE)) {
summary.put(BPELUIConstant.INSTANCE_STATE_ACTIVE, processInstance.getCount());
} else if (state.equals(BPELUIConstant.INSTANCE_STATE_COMPLETED)) {
summary.put(BPELUIConstant.INSTANCE_STATE_COMPLETED, processInstance.getCount());
} else if (state.equals(BPELUIConstant.INSTANCE_STATE_TERMINATED)) {
summary.put(BPELUIConstant.INSTANCE_STATE_TERMINATED, processInstance.getCount());
} else if (state.equals(BPELUIConstant.INSTANCE_STATE_FAILED)) {
summary.put(BPELUIConstant.INSTANCE_STATE_FAILED, processInstance.getCount());
} else if (state.equals(BPELUIConstant.INSTANCE_STATE_SUSPENDED)) {
summary.put(BPELUIConstant.INSTANCE_STATE_SUSPENDED, processInstance.getCount());
} else {
log.error("Invalid instance state: " + state);
}
totalInstances += processInstance.getCount();
}
summary.put(BPELUIConstant.TOTAL_INSTANCES, totalInstances);
return summary;
}
use of org.wso2.carbon.bpel.stub.mgt.types.Instances_type0 in project carbon-business-process by wso2.
the class InstanceSummary method createInstanceSummary.
/**
* Create instance summary object from process instances array.
*
* @param processInstances process instance array
* @return instance summary object
*/
public static InstanceSummary createInstanceSummary(Instances_type0[] processInstances) {
InstanceSummary summary = new InstanceSummary();
for (Instances_type0 processInstance : processInstances) {
String state = processInstance.getState().getValue();
if (state.equals("ACTIVE")) {
summary.activeInstances = processInstance.getCount();
} else if (state.equals("COMPLETED")) {
summary.completedInstances = processInstance.getCount();
} else if (state.equals("TERMINATED")) {
summary.terminatedInstances = processInstance.getCount();
} else if (state.equals("FAILED")) {
summary.failedInstances = processInstance.getCount();
} else if (state.equals("SUSPENDED")) {
summary.suspendedInstances = processInstance.getCount();
} else {
log.error("Invalid State " + state);
}
summary.totalInstances += processInstance.getCount();
}
return summary;
}
Aggregations