use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class WorkflowAccessRest method getProcess.
public ProcessVO getProcess(long processId, boolean json) throws DataAccessException {
try {
if (json) {
String processJson = getServer().invokeResourceService("Workflow?id=" + processId);
JSONObject jsonObj = new JSONObject(processJson);
ProcessVO process = new ProcessVO(jsonObj);
process.setPackageName(jsonObj.getString("package"));
process.setPackageVersion(jsonObj.getString("packageVersion"));
process.setId(jsonObj.getLong("id"));
return process;
} else {
String pkgXml = getServer().invokeResourceService("Processes?id=" + processId);
ProcessImporter importer = DataAccess.getProcessImporter(DataAccess.currentSchemaVersion);
PackageVO pkg = importer.importPackage(pkgXml);
ProcessVO process = pkg.getProcesses().get(0);
process.setPackageName(pkg.getName());
process.setPackageVersion(pkg.getVersionString());
process.setId(processId);
return process;
}
} catch (Exception ex) {
throw new DataAccessException("Error retrieving process: " + processId, ex);
}
}
use of com.centurylink.mdw.common.exception.DataAccessException 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.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getProcessInstanceAll.
public ProcessInstanceVO getProcessInstanceAll(Long processInstanceId) throws DataAccessException {
try {
String pathWithArgs = "Processes/" + processInstanceId;
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstance?format=json&instanceId=" + processInstanceId;
String response = invokeResourceService(pathWithArgs);
return new ProcessInstanceVO(new JSONObject(response));
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getTaskInstancesForProcessInstance.
public List<TaskInstanceVO> getTaskInstancesForProcessInstance(Long processInstanceId) throws DataAccessException {
try {
if (getServer().getSchemaVersion() >= 6000) {
String path = "Tasks?processInstanceId=" + processInstanceId;
String response = invokeResourceService(path);
return new TaskList(TaskList.TASKS, response).getItems();
} else {
String path = "ProcessTasks?format=json&processInstanceId=" + processInstanceId;
String response = invokeResourceService(path);
return new TaskList(TaskList.PROCESS_TASKS, response).getItems();
}
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getProcessInstanceCallHierarchy.
public LinkedProcessInstance getProcessInstanceCallHierarchy(Long processInstanceId) throws DataAccessException {
try {
String pathWithArgs = "Processes?mdw-app=designer&callHierarchyFor=" + processInstanceId;
String response;
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstances?format=json&callHierarchyFor=" + processInstanceId;
response = invokeResourceService(pathWithArgs);
return new LinkedProcessInstance(response);
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
Aggregations