Search in sources :

Example 1 with Instances_type0

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.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);
}
Also used : InstanceFilter(org.apache.ode.bpel.common.InstanceFilter) Instances_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Instances_type0) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) XMLStreamException(javax.xml.stream.XMLStreamException) ParseException(java.text.ParseException) ProcessManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Example 2 with Instances_type0

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.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;
}
Also used : JSONObject(org.json.simple.JSONObject) Instances_type0(org.wso2.carbon.bpel.stub.mgt.types.Instances_type0)

Example 3 with Instances_type0

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.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;
}
Also used : Instances_type0(org.wso2.carbon.bpel.stub.mgt.types.Instances_type0)

Aggregations

Instances_type0 (org.wso2.carbon.bpel.stub.mgt.types.Instances_type0)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)1 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)1 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)1 JSONObject (org.json.simple.JSONObject)1 ProcessManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException)1 Instances_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Instances_type0)1