use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getExternalMessage.
// used by designer for displaying adapter raw message content
public ExternalMessageVO getExternalMessage(Long activityId, Long activityInstId, Long eventInstId) throws DataAccessException {
try {
String pathWithArgs = "Requests";
if (eventInstId != null)
pathWithArgs += "/" + eventInstId;
else
pathWithArgs += "?ownerId=" + activityInstId + "&type=outboundRequests";
if (!getServer().isSchemaVersion61()) {
pathWithArgs = "ExternalMessageInstance?format=json&activityId=" + activityId + "&activityInstId=" + activityInstId;
if (eventInstId != null)
pathWithArgs += "&eventInstId=" + eventInstId;
}
String response = invokeResourceService(pathWithArgs);
return new ExternalMessageVO(response);
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.dataaccess.DataAccessOfflineException 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);
}
}
use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method deleteProcessInstancesForProcess.
public int deleteProcessInstancesForProcess(Long processId) throws DataAccessException {
try {
if (getServer().getSchemaVersion() >= 6000) {
try {
getServer().delete("Processes?processId=" + processId, null);
} 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");
actionRequest.addParameter("processId", String.valueOf(processId));
invokeActionService(actionRequest.getJson().toString(2));
}
// not used
return 0;
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method hasProcessInstances.
public boolean hasProcessInstances(Long processId) throws DataAccessException {
try {
String pathWithArgs = "Processes?processId=" + processId + "&pageSize=1";
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstances?format=json&pageSize=1&processId=" + processId;
String response = invokeResourceService(pathWithArgs);
return new ProcessList(ProcessList.PROCESS_INSTANCES, response).getCount() > 0;
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of com.centurylink.mdw.dataaccess.DataAccessOfflineException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getProcessInstanceBase.
public ProcessInstanceVO getProcessInstanceBase(Long processInstanceId) throws DataAccessException {
try {
String pathWithArgs = "Processes/" + processInstanceId + "?shallow=true";
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstance?format=json&shallow=true&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);
}
}
Aggregations