Search in sources :

Example 1 with Action

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

the class DesignerDataAccess method saveRuleSet.

public Long saveRuleSet(RuleSetVO ruleset) throws DataAccessException {
    Long id = ruleset.getId();
    Action action = id <= 0 ? Action.Create : Action.Change;
    if (id <= 0)
        id = persister.createRuleSet(ruleset);
    else
        persister.updateRuleSet(ruleset);
    auditLog(action, Entity.RuleSet, id, ruleset.getDescription());
    return id;
}
Also used : Action(com.centurylink.mdw.model.value.user.UserActionVO.Action)

Example 2 with Action

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

the class DesignerDataAccess method savePackage.

public Long savePackage(PackageVO pPackageVO, PersistType persistType) throws DataAccessException {
    Long id = persister.persistPackage(pPackageVO, persistType);
    Action action = pPackageVO.getVersion() == 0 ? Action.Create : Action.Change;
    auditLog(action, Entity.Package, id, pPackageVO.getLabel());
    return id;
}
Also used : Action(com.centurylink.mdw.model.value.user.UserActionVO.Action)

Example 3 with Action

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

the class DesignerDataAccess method setAttribute.

public void setAttribute(String ownerType, Long ownerId, String attrname, String attrvalue) throws DataAccessException {
    Long existingId = persister.setAttribute(ownerType, ownerId, attrname, attrvalue);
    Action action = existingId == null ? Action.Create : Action.Change;
    auditLog(action, Entity.Attribute, existingId == null ? Long.valueOf(0) : existingId, attrname);
}
Also used : Action(com.centurylink.mdw.model.value.user.UserActionVO.Action)

Example 4 with Action

use of com.centurylink.mdw.model.value.user.UserActionVO.Action 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)

Example 5 with Action

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

the class PreferencesSection method createNoticesTable.

private void createNoticesTable() {
    noticesEditor = new TableEditor(null, TableEditor.TYPE_TABLE);
    noticesEditor.setLabel("Desktop Notices");
    // colspecs
    List<ColumnSpec> colSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec selectionColSpec = new ColumnSpec(PropertyEditor.TYPE_CHECKBOX, "", "selected");
    selectionColSpec.width = 50;
    colSpecs.add(selectionColSpec);
    ColumnSpec extensionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Task Outcome", "outcome");
    extensionColSpec.width = 150;
    extensionColSpec.readOnly = true;
    colSpecs.add(extensionColSpec);
    noticesEditor.setColumnSpecs(colSpecs);
    noticesEditor.setHorizontalSpan(3);
    noticesEditor.setWidth(300);
    noticesEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            return null;
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            List<String> selectedNotices = new ArrayList<String>();
            for (Action outcome : UserActionVO.NOTIFIABLE_TASK_ACTIONS) {
                for (Object rowObj : tableValue) {
                    DefaultRowImpl row = (DefaultRowImpl) rowObj;
                    if (outcome.toString().equals(row.getColumnValue(1))) {
                        if (((Boolean) row.getColumnValue(0)).booleanValue())
                            selectedNotices.add(outcome.toString());
                        else
                            selectedNotices.remove(outcome.toString());
                    }
                }
            }
            project.setNoticeChecks(selectedNotices);
        }
    });
}
Also used : Action(com.centurylink.mdw.model.value.user.UserActionVO.Action) DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) TableModelUpdater(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Aggregations

Action (com.centurylink.mdw.model.value.user.UserActionVO.Action)7 DefaultRowImpl (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl)2 ArrayList (java.util.ArrayList)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 ActionRequestMessage (com.centurylink.mdw.common.service.types.ActionRequestMessage)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 Entity (com.centurylink.mdw.model.value.user.UserActionVO.Entity)1 ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)1 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)1 TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 List (java.util.List)1 JSONObject (org.json.JSONObject)1