Search in sources :

Example 1 with InstanceInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method fillFaultAndFailure.

/**
 * Use fillFaultAndFailure(ProcessInstanceDAO, InstanceInfoType) to fill the
 * instanceInfoWithEvents
 *
 * @param instance               Process Instance DAO
 * @param instanceInfoWithEvents Instance info with events
 */
private void fillFaultAndFailure(ProcessInstanceDAO instance, InstanceInfoWithEventsType instanceInfoWithEvents) {
    InstanceInfoType instanceInfo = new InstanceInfoType();
    fillFaultAndFailure(instance, instanceInfo);
    if (instance.getFault() != null) {
        instanceInfoWithEvents.setFaultInfo(instanceInfo.getFaultInfo());
    }
    if (instance.getActivityFailureCount() > 0) {
        instanceInfoWithEvents.setFailuresInfo(instanceInfo.getFailuresInfo());
    }
}
Also used : InstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType) LimitedInstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType)

Example 2 with InstanceInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getInstanceInformation.

private InstanceInfoType getInstanceInformation(final long iid) throws InstanceManagementException {
    final InstanceInfoType instanceInfo = new InstanceInfoType();
    instanceInfo.setIid(Long.toString(iid));
    dbexec(new BpelDatabase.Callable<Object>() {

        public Object run(BpelDAOConnection conn) throws InstanceManagementException {
            ProcessInstanceDAO instance = conn.getInstanceEagerly(iid, false);
            if (instance == null) {
                String errMsg = "Instance " + iid + " not found.";
                log.error(errMsg);
                throw new InstanceManagementException(errMsg);
            }
            fillInstanceInfo(instanceInfo, instance);
            return null;
        }
    });
    return instanceInfo;
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) ProcessInstanceDAO(org.apache.ode.bpel.dao.ProcessInstanceDAO) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) InstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType) LimitedInstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType)

Example 3 with InstanceInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method fillFaultAndFailure.

private void fillFaultAndFailure(ProcessInstanceDAO instance, InstanceInfoType instanceInfo) {
    if (instance.getFault() != null) {
        FaultDAO fault = instance.getFault();
        FaultInfoType faultInfo = new FaultInfoType();
        faultInfo.setName(fault.getName());
        faultInfo.setExplanation(fault.getExplanation());
        faultInfo.setLineNumber(fault.getLineNo());
        faultInfo.setAiid(fault.getActivityId());
        Data_type0 data = new Data_type0();
        if (fault.getData() == null) {
            OMFactory omFac = OMAbstractFactory.getOMFactory();
            OMElement faultDataEle = omFac.createOMElement("no-data", null);
            faultDataEle.setText("No data available.");
            data.addExtraElement(faultDataEle);
        } else {
            data.addExtraElement(OMUtils.toOM(fault.getData(), OMAbstractFactory.getOMFactory()));
        }
        faultInfo.setData(data);
        instanceInfo.setFaultInfo(faultInfo);
    }
    if (instance.getActivityFailureCount() > 0) {
        FailuresInfoType failuresInfo = new FailuresInfoType();
        failuresInfo.setCount(instance.getActivityFailureCount());
        failuresInfo.setDateFailure(toCalendar(instance.getActivityFailureDateTime()));
        instanceInfo.setFailuresInfo(failuresInfo);
    }
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) FaultInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FaultInfoType) FailuresInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailuresInfoType) OMElement(org.apache.axiom.om.OMElement) FaultDAO(org.apache.ode.bpel.dao.FaultDAO) Data_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Data_type0)

Aggregations

InstanceInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType)2 LimitedInstanceInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType)2 OMElement (org.apache.axiom.om.OMElement)1 OMFactory (org.apache.axiom.om.OMFactory)1 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)1 FaultDAO (org.apache.ode.bpel.dao.FaultDAO)1 ProcessInstanceDAO (org.apache.ode.bpel.dao.ProcessInstanceDAO)1 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)1 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)1 Data_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Data_type0)1 FailuresInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailuresInfoType)1 FaultInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FaultInfoType)1