Search in sources :

Example 1 with Action

use of com.centurylink.mdw.service.Action in project mdw-designer by CenturyLinkCloud.

the class Server method buildActionOnActivityInstanceRequest.

private String buildActionOnActivityInstanceRequest(Long activityId, Long activityInstanceId, String actionType, String completionCode, boolean oldFormat) throws XmlException {
    ActionRequestDocument actionRequestDoc = ActionRequestDocument.Factory.newInstance();
    ActionRequest actionRequest = actionRequestDoc.addNewActionRequest();
    Action action = actionRequest.addNewAction();
    action.setName("PerformInstanceLevelAction");
    Parameter parameter = action.addNewParameter();
    parameter.setName("mdw.WorkType");
    parameter.setStringValue(WorkType.ACTIVITY.toString());
    parameter = action.addNewParameter();
    parameter.setName("mdw.Action");
    parameter.setStringValue(actionType);
    parameter = action.addNewParameter();
    parameter.setName("mdw.DefinitionId");
    parameter.setStringValue(activityId.toString());
    parameter = action.addNewParameter();
    parameter.setName("mdw.InstanceId");
    parameter.setStringValue(activityInstanceId.toString());
    if (completionCode != null) {
        parameter = action.addNewParameter();
        parameter.setName("mdw.CompletionCode");
        parameter.setStringValue(completionCode);
    }
    String request;
    if (oldFormat)
        request = DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
    else
        request = actionRequestDoc.xmlText(getXmlOptions());
    return request;
}
Also used : Action(com.centurylink.mdw.service.Action) ActionRequest(com.centurylink.mdw.service.ActionRequestDocument.ActionRequest) Parameter(com.centurylink.mdw.service.Parameter) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 2 with Action

use of com.centurylink.mdw.service.Action in project mdw-designer by CenturyLinkCloud.

the class Server method getLaunchProcessBaseDoc.

protected ActionRequestDocument getLaunchProcessBaseDoc(Long processId, String masterRequestId, String owner, Long ownerId) {
    ActionRequestDocument actionRequestDoc = ActionRequestDocument.Factory.newInstance();
    ActionRequest actionRequest = actionRequestDoc.addNewActionRequest();
    Action action = actionRequest.addNewAction();
    action.setName("PerformInstanceLevelAction");
    Parameter parameter = action.addNewParameter();
    parameter.setName("mdw.WorkType");
    parameter.setStringValue(WorkType.PROCESS.toString());
    parameter = action.addNewParameter();
    parameter.setName("mdw.Action");
    parameter.setStringValue("Launch");
    parameter = action.addNewParameter();
    parameter.setName("mdw.DefinitionId");
    parameter.setStringValue(processId.toString());
    parameter = action.addNewParameter();
    parameter.setName("mdw.MasterRequestId");
    parameter.setStringValue(masterRequestId);
    parameter = action.addNewParameter();
    parameter.setName("mdw.Owner");
    parameter.setStringValue(owner);
    parameter = action.addNewParameter();
    parameter.setName("mdw.OwnerId");
    if (ownerId == null)
        ownerId = new Date().getTime();
    parameter.setStringValue(ownerId.toString());
    return actionRequestDoc;
}
Also used : Action(com.centurylink.mdw.service.Action) ActionRequest(com.centurylink.mdw.service.ActionRequestDocument.ActionRequest) Parameter(com.centurylink.mdw.service.Parameter) Date(java.util.Date) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 3 with Action

use of com.centurylink.mdw.service.Action in project mdw-designer by CenturyLinkCloud.

the class RestfulServer method refreshCache.

public MDWStatusMessageDocument refreshCache(String type, String cacheName, boolean global, boolean oldFormat, boolean includeDynamicJava) throws DataAccessException, XmlException, IOException {
    if (isSchemaVersion61())
        return refreshCache("WorkflowCache", cacheName, global, includeDynamicJava);
    else {
        ActionRequestDocument actionRequestDoc = ActionRequestDocument.Factory.newInstance();
        ActionRequest actionRequest = actionRequestDoc.addNewActionRequest();
        Action action = actionRequest.addNewAction();
        action.setName("RefreshCache");
        if (type != null) {
            Parameter typeParam = action.addNewParameter();
            typeParam.setName("RefreshType");
            typeParam.setStringValue(type);
        }
        if (cacheName != null) {
            Parameter cacheNameParam = action.addNewParameter();
            cacheNameParam.setName("CacheName");
            cacheNameParam.setStringValue(cacheName);
        }
        if (global) {
            Parameter parameter = action.addNewParameter();
            parameter.setName("GlobalRefresh");
            parameter.setStringValue("true");
        }
        if (!includeDynamicJava) {
            Parameter parameter = action.addNewParameter();
            parameter.setName("ExcludedFormats");
            parameter.setStringValue(RuleSetVO.JAVA);
        }
        String request;
        if (oldFormat)
            request = DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
        else
            request = actionRequestDoc.xmlText(getXmlOptions());
        return invokeService(request);
    }
}
Also used : Action(com.centurylink.mdw.service.Action) ActionRequest(com.centurylink.mdw.service.ActionRequestDocument.ActionRequest) Parameter(com.centurylink.mdw.service.Parameter) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 4 with Action

use of com.centurylink.mdw.service.Action in project mdw-designer by CenturyLinkCloud.

the class RestfulServer method stubServer.

public MDWStatusMessageDocument stubServer(String host, int port, boolean on, boolean oldFormat) throws DataAccessException, RemoteException, XmlException {
    ActionRequestDocument actionRequestDoc = ActionRequestDocument.Factory.newInstance();
    ActionRequest actionRequest = actionRequestDoc.addNewActionRequest();
    Action action = actionRequest.addNewAction();
    action.setName("RegressionTest");
    Parameter param = action.addNewParameter();
    param.setName("Maintenance");
    param.setStringValue("Stubbing");
    param = action.addNewParameter();
    param.setName("Server");
    param.setStringValue(host + ":" + port);
    param = action.addNewParameter();
    param.setName("Mode");
    param.setStringValue(on ? "on" : "off");
    String request;
    if (oldFormat)
        request = DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
    else
        request = actionRequestDoc.xmlText(getXmlOptions());
    return invokeService(request);
}
Also used : Action(com.centurylink.mdw.service.Action) ActionRequest(com.centurylink.mdw.service.ActionRequestDocument.ActionRequest) Parameter(com.centurylink.mdw.service.Parameter) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 5 with Action

use of com.centurylink.mdw.service.Action in project mdw-designer by CenturyLinkCloud.

the class Server method buildLaunchProcessRequest.

public String buildLaunchProcessRequest(ProcessVO procdef, String masterRequestId, Long activityId, Map<String, String> parameters, boolean isServiceProcess, boolean oldFormat) throws DataAccessException, RemoteException, XmlException {
    ActionRequestDocument actionRequestDoc = getLaunchProcessBaseDoc(procdef.getProcessId(), masterRequestId, "Designer", procdef.getId());
    Action action = actionRequestDoc.getActionRequest().getAction();
    if (activityId != null) {
        Parameter parameter = action.addNewParameter();
        parameter.setName("mdw.ActivityId");
        parameter.setStringValue(activityId.toString());
    }
    if (isServiceProcess) {
        Parameter syncParam = actionRequestDoc.getActionRequest().getAction().addNewParameter();
        syncParam.setName("mdw.Synchronous");
        syncParam.setStringValue("true");
    }
    for (String processParam : parameters.keySet()) {
        Parameter parameter = action.addNewParameter();
        parameter.setName(processParam);
        VariableVO varVO = procdef.getVariable(processParam);
        if (varVO != null)
            parameter.setType(varVO.getVariableType());
        parameter.setStringValue(parameters.get(processParam));
    }
    if (oldFormat)
        return DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
    else
        return actionRequestDoc.xmlText(getXmlOptions());
}
Also used : Action(com.centurylink.mdw.service.Action) Parameter(com.centurylink.mdw.service.Parameter) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Aggregations

Action (com.centurylink.mdw.service.Action)6 ActionRequestDocument (com.centurylink.mdw.service.ActionRequestDocument)6 Parameter (com.centurylink.mdw.service.Parameter)6 ActionRequest (com.centurylink.mdw.service.ActionRequestDocument.ActionRequest)5 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)1 InetAddress (java.net.InetAddress)1 Date (java.util.Date)1