use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException 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;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getActivityLifeCycleEvents.
private ActivityLifeCycleEventsType getActivityLifeCycleEvents(final long iid) throws InstanceManagementException {
final ActivityLifeCycleEventsType activityLifeCycleEvents = new ActivityLifeCycleEventsType();
activityLifeCycleEvents.setIid(Long.toString(iid));
dbexec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection conn) throws InstanceManagementException {
ProcessInstanceDAO instance = conn.getInstanceEagerly(iid, true);
if (instance == null) {
String errMsg = "Instance " + iid + " not found.";
log.error(errMsg);
throw new InstanceManagementException(errMsg);
}
fillActivityLifeCycleEvents(activityLifeCycleEvents, instance);
return null;
}
});
return activityLifeCycleEvents;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getScopeInfoWithEvents.
private ScopeInfoWithEventsType getScopeInfoWithEvents(ScopeDAO scope) throws InstanceManagementException {
final ScopeInfoWithEventsType scopeInfoWithEvents = new ScopeInfoWithEventsType();
/*dbexec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection conn) throws InstanceManagementException {
ScopeDAO scope = conn.getScopeEagerly(siid);
if (scope == null) {
String errMsg = "Scope " + siid + " not found.";
log.error(errMsg);
throw new InstanceManagementException(errMsg);
}
fillScopeInfoWithEvents(scopeInfoWithEvents, scope);
return null;
}
});*/
fillScopeInfoWithEvents(scopeInfoWithEvents, scope);
return scopeInfoWithEvents;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getInstanceSummary.
public InstanceSummaryE getInstanceSummary() throws InstanceManagementException {
InstanceSummaryE instanceSummary = new InstanceSummaryE();
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
instanceSummary.setActive(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_ACTIVE).intValue());
instanceSummary.setCompleted(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_COMPLETED).intValue());
instanceSummary.setFailed(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_FAILED).intValue());
instanceSummary.setSuspended(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_SUSPENDED).intValue());
instanceSummary.setTerminated(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_TERMINATED).intValue());
return instanceSummary;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getInstanceCountByState.
private Long getInstanceCountByState(String processList, String instanceState) throws InstanceManagementException {
if (isProcessListEmpty(processList)) {
return (long) 0;
}
final List<Long> instanceCountList = new ArrayList<Long>();
StringBuilder filter = new StringBuilder();
if (!isProcessListEmpty(processList)) {
filter.append(processList);
}
filter.append("status=");
filter.append(instanceState);
final InstanceFilter instanceFilter = new InstanceFilter(filter.toString(), null, Integer.MAX_VALUE);
try {
BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
bpelDb.exec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection conn) throws AxisFault {
instanceCountList.add(conn.instanceCount(instanceFilter));
return null;
}
});
} catch (Exception e) {
String errMsg = "Error querying instances from database. Filter: " + instanceFilter.toString();
log.error(errMsg, e);
throw new InstanceManagementException(errMsg, e);
}
return instanceCountList.get(0);
}
Aggregations