use of com.centurylink.mdw.model.value.process.ProcessList in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getProcessInstanceList.
public ProcessList getProcessInstanceList(Map<String, String> criteria, Map<String, String> variables, int pageIndex, int pageSize, String orderBy) throws DataAccessException {
try {
String pathWithArgs = "Processes?mdw-app=designer";
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstances?format=json";
String criteriaParams = queryParams(criteria);
if (criteriaParams.length() > 0)
pathWithArgs += "&" + criteriaParams;
String varParams = queryParams(variables);
if (varParams.length() > 0)
pathWithArgs += "&" + varParams;
if (pageIndex > 0)
pathWithArgs += "&pageIndex=" + pageIndex;
if (pageSize != 0)
pathWithArgs += "&pageSize=" + pageSize;
if (orderBy != null) {
pathWithArgs += "&orderBy=" + URLEncoder.encode(orderBy.trim(), "UTF-8");
}
String response = invokeResourceService(pathWithArgs);
return new ProcessList(ProcessList.PROCESS_INSTANCES, response);
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.model.value.process.ProcessList in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceContentProvider method getElements.
public Object[] getElements(Object inputElement) {
WorkflowProcess processVersion = (WorkflowProcess) inputElement;
if (instanceInfo == null) {
DesignerProxy designerProxy = processVersion.getProject().getDesignerProxy();
ProcessList instanceList = designerProxy.getProcessInstanceList(processVersion, filter.getProcessCriteria(), filter.getVariableCriteria(processVersion), pageIndex, filter.getPageSize(), sort.getOrderBy());
instanceCount = instanceList.getTotal();
instanceInfo = instanceList.getItems();
}
return instanceInfo.toArray(new ProcessInstanceVO[0]);
}
use of com.centurylink.mdw.model.value.process.ProcessList in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getProcessInstanceList.
public ProcessList getProcessInstanceList(Map<String, String> pMap, int pageIndex, int pageSize, ProcessVO procdef, String orderBy) throws DataAccessException {
if (procdef != null && procdef.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(procdef.getRemoteServer()).getRuntimeDataAccess();
ProcessList ret = runTimeInfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
for (ProcessInstanceVO one : ret.getProcesses()) {
one.setRemoteServer(procdef.getRemoteServer());
}
return ret;
} else {
return rtinfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
}
}
use of com.centurylink.mdw.model.value.process.ProcessList in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getChildProcessInstance.
/**
* Does not work for embedded subprocs in asset processes.
*/
public List<ProcessInstanceVO> getChildProcessInstance(Long processInstanceId, ProcessVO childProcess, ProcessVO parentProcess) throws DataAccessException {
Map<String, String> pMap = new HashMap<>();
if (childProcess.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(childProcess.getRemoteServer()).getRuntimeDataAccess();
List<ProcessInstanceVO> ret;
String ownerType = OwnerType.PROCESS_INSTANCE;
if (parentProcess.isRemote()) {
if (!parentProcess.getRemoteServer().equals(childProcess.getRemoteServer()))
ownerType = parentProcess.getRemoteServer();
} else {
ownerType = currentServer.getApplicationName();
}
pMap.put("owner", ownerType);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
ProcessList procList = runTimeInfo.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, null);
ret = procList.getProcesses();
for (ProcessInstanceVO one : ret) {
one.setRemoteServer(childProcess.getRemoteServer());
}
return ret;
} else {
pMap.put("owner", OwnerType.PROCESS_INSTANCE);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
return getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, childProcess, null).getProcesses();
}
}
use of com.centurylink.mdw.model.value.process.ProcessList in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method deleteProcessInstances.
public int deleteProcessInstances(List<Long> processInstanceIds) throws DataAccessException {
try {
List<ProcessInstanceVO> instances = new ArrayList<ProcessInstanceVO>();
for (Long id : processInstanceIds) instances.add(new ProcessInstanceVO(id));
ProcessList processList = new ProcessList(ProcessList.PROCESS_INSTANCES, instances);
if (getServer().getSchemaVersion() >= 6000) {
try {
getServer().delete("Processes", processList.getJson().toString(2));
} catch (IOException ex) {
throw new DataAccessOfflineException("Unable to connect to " + getServer().getServiceUrl(), ex);
}
} else {
ActionRequestMessage actionRequest = new ActionRequestMessage();
actionRequest.setAction("DeleteProcessInstances");
actionRequest.addParameter("appName", "MDW Designer");
JSONObject msgJson = actionRequest.getJson();
msgJson.put(processList.getJsonName(), processList.getJson());
invokeActionService(msgJson.toString(2));
}
return processList.getCount();
} catch (XmlException ex) {
throw new DataAccessException(ex.getMessage(), ex);
} catch (JSONException ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
Aggregations