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;
}
});
}
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);
}
}
Aggregations