use of com.centurylink.mdw.service.ActionRequestDocument.ActionRequest in project mdw-designer by CenturyLinkCloud.
the class TestCaseRun method performNotify.
public void performNotify(String eventName, String message, String procName, String actLogicalId) throws TestException {
try {
TestDataFilter filter = new TestDataFilter(message, log, true);
Map<String, String> map = new HashMap<String, String>();
map.put(TestDataFilter.MasterRequestId, this.masterRequestId);
map.put(TestDataFilter.RunNumber, Integer.toString(runNumber));
// FIXME: placeholders for non-legacy
if (testcase.isLegacy()) {
File mapfile = new File(testcase.getCaseDirectory().getPath() + "/" + TestCase.PLACEHOLDER_MAP_FILENAME);
TestDataFilter.loadPlaceHolderMap(mapfile, map, runNumber);
message = filter.applyFilters(map, null);
}
ActionRequestDocument msgdoc = ActionRequestDocument.Factory.newInstance();
ActionRequest actionRequest = msgdoc.addNewActionRequest();
com.centurylink.mdw.service.Action act = actionRequest.addNewAction();
act.setName("RegressionTest");
addActionParameter(act, "SubAction", "NotifyProcess");
addActionParameter(act, "EventName", eventName);
addActionParameter(act, "Message", message);
addActionParameter(act, "MasterRequestId", masterRequestId);
if (procName != null)
addActionParameter(act, "ProcessName", procName);
if (actLogicalId != null)
addActionParameter(act, "ActivityLogicalId", actLogicalId);
String request;
if (oldNamespaces)
request = DesignerCompatibility.getInstance().getOldActionRequest(msgdoc);
else
request = msgdoc.xmlText();
String server = getNextServer();
if (server == null)
response = dao.sendMessage("DefaultProtocol", request, getDefaultMessageHeaders());
else
response = dao.engineCall(dao.getPeerServerUrl(server), request);
log.println("Response: " + response);
} catch (Exception e) {
throw new TestException(e.getMessage(), e);
}
}
use of com.centurylink.mdw.service.ActionRequestDocument.ActionRequest in project mdw-designer by CenturyLinkCloud.
the class TestCaseRun method performTask.
public JSONObject performTask(String taskName, String action, Map<String, String> variables) throws TestException {
try {
ActionRequestDocument msgdoc = ActionRequestDocument.Factory.newInstance();
ActionRequest actionRequest = msgdoc.addNewActionRequest();
com.centurylink.mdw.service.Action act = actionRequest.addNewAction();
act.setName("RegressionTest");
addActionParameter(act, "SubAction", "TaskAction");
addActionParameter(act, "TaskName", taskName);
addActionParameter(act, "MasterRequestId", masterRequestId);
addActionParameter(act, "User", dao.getCuid());
if (action.startsWith("Action/")) {
addActionParameter(act, "FormAction", action.substring("Action/".length()));
} else {
addActionParameter(act, "DirectAction", action);
}
for (String dataname : variables.keySet()) {
addActionParameter(act, "formdata." + dataname, variables.get(dataname));
}
String request;
if (oldNamespaces)
request = DesignerCompatibility.getInstance().getOldActionRequest(msgdoc);
else
request = msgdoc.xmlText();
String server = getNextServer();
String response;
if (server == null)
response = dao.engineCall(request);
else
response = dao.engineCall(dao.getPeerServerUrl(server), request);
return validateEngineCallResponse(response);
} catch (Exception e) {
throw new TestException(e.getMessage(), e);
}
}
use of com.centurylink.mdw.service.ActionRequestDocument.ActionRequest 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;
}
use of com.centurylink.mdw.service.ActionRequestDocument.ActionRequest 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;
}
use of com.centurylink.mdw.service.ActionRequestDocument.ActionRequest 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);
}
}
Aggregations