use of com.centurylink.mdw.service.Parameter in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method getVariableInfo.
/**
* Must be called from the UI thread.
*/
public VariableTypeVO getVariableInfo(final VariableInstanceInfo varInstInfo) {
String varType = varInstInfo.getType();
VariableTranslator varTrans = getVariableTranslator(varType);
final VariableTypeVO varTypeVO = new VariableTypeVO(0L, varType, varTrans == null ? null : varTrans.getClass().getName());
if (varInstInfo.getStringValue() != null && varTypeVO.isJavaObjectType()) {
BusyIndicator.showWhile(MdwPlugin.getShell().getDisplay(), new Runnable() {
public void run() {
DocumentReference docRef = new DocumentReference(varInstInfo.getStringValue());
try {
Object obj = new JavaObjectTranslator().realToObject(getDocument(docRef).getContent());
varTypeVO.setVariableType(obj.getClass().getName());
varTypeVO.setUpdateable(obj instanceof SelfSerializable);
} catch (TranslationException ex) {
if (MdwPlugin.getSettings().isLogConnectErrors())
PluginMessages.log(ex);
try {
if (!project.checkRequiredVersion(6, 1, 1)) {
String path = "DocumentValue?format=xml&id=" + docRef.getDocumentId() + "&type=" + varTypeVO.getVariableType();
String resp = getRestfulServer().invokeResourceService(path);
Resource res = Resource.Factory.parse(resp, Compatibility.namespaceOptions());
for (Parameter param : res.getParameterList()) {
if ("className".equals(param.getName()))
varTypeVO.setVariableType(param.getStringValue());
else if ("isUpdateable".equals(param.getName()))
varTypeVO.setUpdateable(Boolean.parseBoolean(param.getStringValue()));
}
}
} catch (Exception ex2) {
throw new RuntimeException(ex2.getMessage(), ex2);
}
}
}
});
}
return varTypeVO;
}
use of com.centurylink.mdw.service.Parameter in project mdw-designer by CenturyLinkCloud.
the class RestfulServer method launchSynchronousProcess.
public String launchSynchronousProcess(Long processId, String masterRequestId, String owner, Long ownerId, Map<VariableVO, String> variables, String responseVarName, boolean oldFormat) throws XmlException, JSONException, IOException {
if (isSchemaVersion61()) {
return launchProcess(processId, masterRequestId, owner, ownerId, variables);
} else {
ActionRequestDocument actionRequestDoc = getLaunchProcessBaseDoc(processId, masterRequestId, owner, ownerId);
Parameter syncParam = actionRequestDoc.getActionRequest().getAction().addNewParameter();
syncParam.setName("mdw.Synchronous");
syncParam.setStringValue("true");
Parameter responseVarParam = actionRequestDoc.getActionRequest().getAction().addNewParameter();
responseVarParam.setName("mdw.ResponseVariableName");
responseVarParam.setStringValue(responseVarName);
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);
}
try {
HttpHelper httpHelper = getHttpHelper(getMdwWebUrl() + "/Services/REST");
httpHelper.setConnectTimeout(getConnectTimeout());
httpHelper.setReadTimeout(getReadTimeout());
String request;
if (oldFormat)
request = DesignerCompatibility.getInstance().getOldActionRequest(actionRequestDoc);
else
request = actionRequestDoc.xmlText(getXmlOptions());
return httpHelper.post(request);
} catch (SocketTimeoutException ex) {
throw new RemoteException("Timeout after " + getReadTimeout() + " ms", ex);
} catch (IOException ex) {
throw new RemoteException("Unable to connect to " + getMdwWebUrl(), ex);
}
}
}
use of com.centurylink.mdw.service.Parameter 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.Parameter 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.Parameter 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