Search in sources :

Example 1 with FailuresInfo

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

the class ProcessManagementServiceSkeleton method addFailuresToInstanceSummary.

private void addFailuresToInstanceSummary(final InstanceSummary instSum, ProcessConf pconf) throws ProcessManagementException {
    final FailuresInfo failureInfo = new FailuresInfo();
    String queryStatus = InstanceFilter.StatusKeys.valueOf(TInstanceStatus.ACTIVE.toString()).toString().toLowerCase();
    final InstanceFilter instanceFilter = new InstanceFilter("status=" + queryStatus + " pid=" + pconf.getProcessId());
    dbexec(new BpelDatabase.Callable<Void>() {

        public Void run(BpelDAOConnection conn) throws Exception {
            Date lastFailureDt = null;
            int failureInstances = 0;
            for (ProcessInstanceDAO instance : conn.instanceQuery(instanceFilter)) {
                int count = instance.getActivityFailureCount();
                if (count > 0) {
                    ++failureInstances;
                    Date failureDt = instance.getActivityFailureDateTime();
                    if (lastFailureDt == null || lastFailureDt.before(failureDt)) {
                        lastFailureDt = failureDt;
                    }
                }
            }
            if (failureInstances > 0) {
                failureInfo.setCount(failureInstances);
                failureInfo.setFailureDate(AdminServiceUtils.toCalendar(lastFailureDt));
                instSum.setFailures(failureInfo);
            }
            return null;
        }
    });
}
Also used : InstanceFilter(org.apache.ode.bpel.common.InstanceFilter) ProcessInstanceDAO(org.apache.ode.bpel.dao.ProcessInstanceDAO) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) FailuresInfo(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailuresInfo) 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) Date(java.util.Date)

Example 2 with FailuresInfo

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailuresInfo 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

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 Date (java.util.Date)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 OMElement (org.apache.axiom.om.OMElement)1 OMFactory (org.apache.axiom.om.OMFactory)1 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)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 ProcessManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException)1 Data_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Data_type0)1 FailuresInfo (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailuresInfo)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