use of com.centurylink.mdw.common.service.types.ActionRequestMessage in project mdw-designer by CenturyLinkCloud.
the class UserDataAccessRest method auditLogUserAction.
public void auditLogUserAction(final UserActionVO userAction) throws DataAccessException {
// certain actions need to be logged on the server
// TODO: this should actually be done on the server side, but currently many services don't require username
Action action = userAction.getAction();
Entity entity = userAction.getEntity();
if (action == Action.Run || action == Action.Send || action == Action.Retry || action == Action.Proceed || action == Action.Import || entity == Entity.ProcessInstance || entity == Entity.ActivityInstance || entity == Entity.VariableInstance) {
if (isOnline()) {
// run in background thread
new Thread(new Runnable() {
public void run() {
try {
ActionRequestMessage actionRequest = new ActionRequestMessage();
actionRequest.setAction("AuditLog");
actionRequest.addParameter("appName", "MDW Designer");
JSONObject msgJson = actionRequest.getJson();
msgJson.put(userAction.getJsonName(), userAction.getJson());
invokeActionService(msgJson.toString(2));
} catch (Exception ex) {
// silent
ex.printStackTrace();
}
}
}).start();
}
}
}
use of com.centurylink.mdw.common.service.types.ActionRequestMessage 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.common.service.types.ActionRequestMessage 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);
}
}
Aggregations