Search in sources :

Example 1 with Entity

use of com.centurylink.mdw.model.value.user.UserActionVO.Entity 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();
        }
    }
}
Also used : Entity(com.centurylink.mdw.model.value.user.UserActionVO.Entity) Action(com.centurylink.mdw.model.value.user.UserActionVO.Action) JSONObject(org.json.JSONObject) ActionRequestMessage(com.centurylink.mdw.common.service.types.ActionRequestMessage) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException)

Aggregations

DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 ActionRequestMessage (com.centurylink.mdw.common.service.types.ActionRequestMessage)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 Action (com.centurylink.mdw.model.value.user.UserActionVO.Action)1 Entity (com.centurylink.mdw.model.value.user.UserActionVO.Entity)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 JSONObject (org.json.JSONObject)1