Search in sources :

Example 1 with UserActionVO

use of com.centurylink.mdw.model.value.user.UserActionVO in project mdw-designer by CenturyLinkCloud.

the class DesignerDataAccess method auditLog.

public void auditLog(Action action, Entity entity, Long entityId, String comments) throws DataAccessException {
    if (dbSchemaVersion < DataAccess.schemaVersion61) {
        UserActionVO userAction = new UserActionVO(cuid, action, entity, entityId, comments);
        auditLog(userAction);
    }
}
Also used : UserActionVO(com.centurylink.mdw.model.value.user.UserActionVO)

Example 2 with UserActionVO

use of com.centurylink.mdw.model.value.user.UserActionVO in project mdw-designer by CenturyLinkCloud.

the class NotificationChecker method checkNotices.

private String checkNotices() {
    taskInstanceId = null;
    String msg = null;
    try {
        String urlStr = workflowProject.getServiceUrl() + "/Services/TaskActions?user=" + workflowProject.getUser().getUsername() + "&since=" + URLEncoder.encode(StringHelper.dateToString(lastResult), "utf-8") + "&max=" + MAX_NOTICES + "&format=json";
        HttpHelper httpHelper = workflowProject.getHttpHelper(urlStr);
        httpHelper.setConnectTimeout(MdwPlugin.getSettings().getHttpConnectTimeout());
        httpHelper.setReadTimeout(MdwPlugin.getSettings().getHttpReadTimeout());
        String response = new String(httpHelper.get());
        JSONArray actions = new JSONArray(response);
        // String[0]), lastResult);
        if (actions.length() > 0) {
            msg = "";
            UserActionVO firstAction = new UserActionVO(actions.getJSONObject(0));
            if (actions.length() == 1) {
                taskInstanceId = firstAction.getEntityId();
                msg += messageLine(firstAction);
            } else {
                for (int i = 0; i < actions.length(); i++) {
                    JSONObject action = actions.getJSONObject(i);
                    msg += messageLine(new UserActionVO(action));
                }
            }
            lastResult = firstAction.getRetrieveDate();
        }
        if (lastResult == null)
            // fall back to device time
            lastResult = new Date();
        String lastResultStr = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(lastResult);
        workflowProject.setPersistentProperty(NotificationChecker.NOTIF_CHECK_LAST_RESULT_KEY, lastResultStr);
    } catch (Exception ex) {
        PluginMessages.uiError(ex, "Check Notices", workflowProject);
    }
    return msg;
}
Also used : UserActionVO(com.centurylink.mdw.model.value.user.UserActionVO) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) HttpHelper(com.centurylink.mdw.common.utilities.HttpHelper) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) ParseException(java.text.ParseException)

Example 3 with UserActionVO

use of com.centurylink.mdw.model.value.user.UserActionVO in project mdw-designer by CenturyLinkCloud.

the class PluginDataAccess method auditLog.

public void auditLog(Action action, Entity entity, Long entityId, String comments) throws DataAccessException {
    if (!workflowProject.checkRequiredVersion(6, 1, 1)) {
        UserActionVO userAction = new UserActionVO(workflowProject.getUser().getUsername(), action, entity, entityId, comments);
        userAction.setSource("Eclipse/RCP Designer");
        getDesignerDataAccess().auditLog(userAction);
    }
}
Also used : UserActionVO(com.centurylink.mdw.model.value.user.UserActionVO)

Example 4 with UserActionVO

use of com.centurylink.mdw.model.value.user.UserActionVO in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method launchProcess.

public MDWStatusMessage launchProcess(WorkflowProcess processVersion, String masterRequestId, String owner, Long ownerId, List<VariableValue> variableValues, Long activityId) throws DataAccessException, XmlException, JSONException, IOException {
    Map<VariableVO, String> variables = new HashMap<>();
    for (VariableValue variableValue : variableValues) {
        variables.put(variableValue.getVariableVO(), variableValue.getValue());
    }
    MDWStatusMessageDocument statusMessageDoc = restfulServer.launchProcess(processVersion.getId(), masterRequestId, owner, ownerId, variables, activityId, project.isOldNamespaces());
    if (statusMessageDoc.getMDWStatusMessage().getStatusCode() != 0)
        throw new RemoteException("Error launching process: " + statusMessageDoc.getMDWStatusMessage().getStatusMessage());
    // audit log in separate dao since launch is multi-threaded
    UserActionVO userAction = new UserActionVO(project.getUser().getUsername(), Action.Run, processVersion.getActionEntity(), processVersion.getId(), processVersion.getLabel());
    userAction.setSource("Eclipse/RCP Designer");
    try {
        new DesignerDataAccess(dataAccess.getDesignerDataAccess()).auditLog(userAction);
    } catch (Exception ex) {
        throw new DataAccessException(-1, ex.getMessage(), ex);
    }
    return statusMessageDoc.getMDWStatusMessage();
}
Also used : UserActionVO(com.centurylink.mdw.model.value.user.UserActionVO) HashMap(java.util.HashMap) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) RemoteException(java.rmi.RemoteException) JSONException(org.json.JSONException) TranslationException(com.centurylink.mdw.common.exception.TranslationException) AuthenticationException(com.centurylink.mdw.auth.AuthenticationException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) ZipException(java.util.zip.ZipException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Aggregations

UserActionVO (com.centurylink.mdw.model.value.user.UserActionVO)4 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)1 MDWStatusMessageDocument (com.centurylink.mdw.bpm.MDWStatusMessageDocument)1 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 TranslationException (com.centurylink.mdw.common.exception.TranslationException)1 HttpHelper (com.centurylink.mdw.common.utilities.HttpHelper)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)1 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)1 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)1 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 RemoteException (java.rmi.RemoteException)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ZipException (java.util.zip.ZipException)1 XmlException (org.apache.xmlbeans.XmlException)1