Search in sources :

Example 6 with ActionRequestDocument

use of com.centurylink.mdw.service.ActionRequestDocument 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 7 with ActionRequestDocument

use of com.centurylink.mdw.service.ActionRequestDocument 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 8 with ActionRequestDocument

use of com.centurylink.mdw.service.ActionRequestDocument 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)

Example 9 with ActionRequestDocument

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

the class RestfulServer method launchProcess.

public MDWStatusMessageDocument launchProcess(Long processId, String masterRequestId, String owner, Long ownerId, Map<VariableVO, String> variables, Long activityId, boolean oldFormat) throws DataAccessException, XmlException, JSONException, IOException {
    if (isSchemaVersion61()) {
        String response = launchProcess(processId, masterRequestId, owner, ownerId, variables);
        StatusMessage statusMessage = new StatusMessage(new JSONObject(response));
        return statusMessage.getStatusDocument();
    } else {
        ActionRequestDocument actionRequestDoc = getLaunchProcessBaseDoc(processId, masterRequestId, owner, ownerId);
        for (VariableVO variableVO : variables.keySet()) {
            Parameter parameter = actionRequestDoc.getActionRequest().getAction().addNewParameter();
            parameter.setName(variableVO.getVariableName());
            parameter.setType(variableVO.getVariableType());
            String stringValue = variables.get(variableVO);
            parameter.setStringValue(stringValue);
        }
        if (activityId != null) {
            Parameter parameter = actionRequestDoc.getActionRequest().getAction().addNewParameter();
            parameter.setName("mdw.ActivityId");
            parameter.setStringValue(activityId.toString());
        }
        String request;
        if (oldFormat)
            request = DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
        else
            request = actionRequestDoc.xmlText(getXmlOptions());
        return invokeService(request);
    }
}
Also used : JSONObject(org.json.JSONObject) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) Parameter(com.centurylink.mdw.service.Parameter) MDWStatusMessage(com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage) StatusMessage(com.centurylink.mdw.common.service.types.StatusMessage) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 10 with ActionRequestDocument

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

the class LogSubscriberSocket method notifyServer.

private void notifyServer(boolean on) throws Exception {
    ActionRequestDocument msgdoc = ActionRequestDocument.Factory.newInstance();
    ActionRequest actionRequest = msgdoc.addNewActionRequest();
    Action action = actionRequest.addNewAction();
    action.setName("RegressionTest");
    Parameter param = action.addNewParameter();
    param.setName("Maintenance");
    param.setStringValue("Watching");
    param = action.addNewParameter();
    param.setName("Server");
    InetAddress ownIP = InetAddress.getLocalHost();
    param.setStringValue(ownIP.getHostAddress() + ":" + LoggerUtil.getStandardLogger().getDefaultPort());
    param = action.addNewParameter();
    param.setName("Mode");
    param.setStringValue(on ? "on" : "off");
    String request;
    if (oldNamespaces)
        request = DesignerCompatibility.getInstance().getOldActionRequest(msgdoc);
    else
        request = msgdoc.xmlText();
    dao.engineCall(request);
}
Also used : Action(com.centurylink.mdw.service.Action) ActionRequest(com.centurylink.mdw.service.ActionRequestDocument.ActionRequest) Parameter(com.centurylink.mdw.service.Parameter) InetAddress(java.net.InetAddress) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Aggregations

ActionRequestDocument (com.centurylink.mdw.service.ActionRequestDocument)11 Parameter (com.centurylink.mdw.service.Parameter)9 ActionRequest (com.centurylink.mdw.service.ActionRequestDocument.ActionRequest)8 Action (com.centurylink.mdw.service.Action)6 IOException (java.io.IOException)4 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)2 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)2 MbengException (com.qwest.mbeng.MbengException)2 ParseException (java.text.ParseException)2 XmlException (org.apache.xmlbeans.XmlException)2 JSONException (org.json.JSONException)2 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1 StatusMessage (com.centurylink.mdw.common.service.types.StatusMessage)1 HttpHelper (com.centurylink.mdw.common.utilities.HttpHelper)1 File (java.io.File)1 InetAddress (java.net.InetAddress)1 SocketTimeoutException (java.net.SocketTimeoutException)1 RemoteException (java.rmi.RemoteException)1 Date (java.util.Date)1