Search in sources :

Example 6 with Parameter

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

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

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

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

Example 10 with Parameter

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

the class TestCaseRun method addActionParameter.

private void addActionParameter(com.centurylink.mdw.service.Action action, String name, String value) {
    Parameter param = action.addNewParameter();
    param.setName(name);
    param.setStringValue(value);
}
Also used : Parameter(com.centurylink.mdw.service.Parameter)

Aggregations

Parameter (com.centurylink.mdw.service.Parameter)11 ActionRequestDocument (com.centurylink.mdw.service.ActionRequestDocument)9 Action (com.centurylink.mdw.service.Action)6 ActionRequest (com.centurylink.mdw.service.ActionRequestDocument.ActionRequest)6 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 IOException (java.io.IOException)3 RemoteException (java.rmi.RemoteException)2 JSONObject (org.json.JSONObject)2 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)1 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 TranslationException (com.centurylink.mdw.common.exception.TranslationException)1 StatusMessage (com.centurylink.mdw.common.service.types.StatusMessage)1 SelfSerializable (com.centurylink.mdw.common.translator.SelfSerializable)1 VariableTranslator (com.centurylink.mdw.common.translator.VariableTranslator)1 JavaObjectTranslator (com.centurylink.mdw.common.translator.impl.JavaObjectTranslator)1 HttpHelper (com.centurylink.mdw.common.utilities.HttpHelper)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)1 DocumentReference (com.centurylink.mdw.model.value.variable.DocumentReference)1