use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class Graph method addSubGraph.
public SubGraph addSubGraph(int x, int y, String subtype, boolean recordchange) {
Long pProcessId = genNodeId();
String pDesc = null;
List<ExternalEventVO> pExtEvents = null;
ProcessVO subproc = new ProcessVO(pProcessId, subtype, pDesc, pExtEvents);
if (getProcessVO() != null && getProcessVO().isInRuleSet())
subproc.setInRuleSet(true);
List<AttributeVO> attributes = new ArrayList<AttributeVO>();
AttributeVO a = new AttributeVO(null, WorkAttributeConstant.PROCESS_VISIBILITY, ProcessVisibilityConstant.EMBEDDED);
attributes.add(a);
a = new AttributeVO(null, WorkAttributeConstant.EMBEDDED_PROCESS_TYPE, subtype);
attributes.add(a);
subproc.setAttributes(attributes);
subproc.setActivities(new ArrayList<ActivityVO>());
subproc.setTransitions(new ArrayList<WorkTransitionVO>());
subproc.setVariables(new ArrayList<VariableVO>());
List<ProcessVO> subprocs = processVO.getSubProcesses();
if (subprocs == null) {
subprocs = new ArrayList<ProcessVO>();
processVO.setSubProcesses(subprocs);
}
subprocs.add(subproc);
SubGraph subgraph = new SubGraph(subproc, this, metainfo, getIconFactory());
subgraph.x = x;
subgraph.y = y;
subgraph.w = 440;
subgraph.h = 120;
// need to add it before generating first node to avoid dup id
subgraphs.add(subgraph);
Node node1 = addNode(subgraph, metainfo.getStartActivity(), x + 40, y + 40, recordchange);
node1.nodet.setActivityName("Start");
if (subtype.equals(ProcessVisibilityConstant.EMBEDDED_ERROR_PROCESS)) {
ActivityImplementorVO nmi = metainfo.getTaskActivity();
Node node2 = addNode(subgraph, nmi, x + 170, y + 30, recordchange);
Node node3 = addNode(subgraph, metainfo.getStopActivity(), x + 340, y + 40, recordchange);
node3.nodet.setActivityName("Stop");
addLink(node1, node2, EventType.FINISH, Link.ELBOW, 2, recordchange);
addLink(node2, node3, EventType.FINISH, Link.ELBOW, 2, recordchange);
} else {
Node node3 = addNode(subgraph, metainfo.getStopActivity(), x + 340, y + 40, recordchange);
node3.nodet.setActivityName("Stop");
addLink(node1, node3, EventType.FINISH, Link.ELBOW, 2, recordchange);
}
if (recordchange)
subgraph.getChanges().setChangeType(Changes.NEW);
setDirtyLevel(DIRTY);
return subgraph;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class Graph method addSubGraph.
/**
* This is for paste
* @param source
* @return
*/
public SubGraph addSubGraph(ProcessVO source, int xoff, int yoff, boolean recordchange) {
Long pProcessId = genNodeId();
String subproctype = source.getAttribute(WorkAttributeConstant.EMBEDDED_PROCESS_TYPE);
if (subproctype == null)
subproctype = ProcessVisibilityConstant.EMBEDDED_ERROR_PROCESS;
ProcessVO existing = processVO.findEmbeddedProcess(subproctype);
if (existing != null)
return null;
String subprocName = subproctype;
ProcessVO subproc = new ProcessVO(pProcessId, subprocName, source.getProcessDescription(), null);
List<AttributeVO> attributes = new ArrayList<AttributeVO>();
for (AttributeVO a : source.getAttributes()) {
if (a.getAttributeName().equals(WorkAttributeConstant.ENTRY_TRANSITION_ID))
continue;
if (a.getAttributeName().equals(WorkAttributeConstant.START_TRANSITION_ID))
continue;
AttributeVO attr = new AttributeVO(a.getAttributeName(), a.getAttributeValue());
attributes.add(attr);
}
subproc.setAttributes(attributes);
subproc.setActivities(new ArrayList<ActivityVO>());
subproc.setTransitions(new ArrayList<WorkTransitionVO>());
subproc.setVariables(new ArrayList<VariableVO>());
String lid = generateLogicalId("P");
subproc.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
List<ProcessVO> subprocs = processVO.getSubProcesses();
if (subprocs == null) {
subprocs = new ArrayList<ProcessVO>();
processVO.setSubProcesses(subprocs);
}
subprocs.add(subproc);
SubGraph subgraph = new SubGraph(subproc, this, metainfo, getIconFactory());
subgraphs.add(subgraph);
HashMap<Long, Long> map = new HashMap<Long, Long>();
for (ActivityVO a : source.getActivities()) {
Node node = this.addNode(subgraph, a, 0, 0, recordchange, true);
map.put(a.getActivityId(), node.getActivityId());
}
for (WorkTransitionVO t : source.getTransitions()) {
this.addLink(subgraph, t, map.get(t.getFromWorkId()), map.get(t.getToWorkId()), 0, 0, recordchange, true);
}
if (xoff != 0 || yoff != 0) {
subgraph.move(subgraph.x + xoff, subgraph.y + yoff, arrowstyle);
}
if (recordchange)
subgraph.getChanges().setChangeType(Changes.NEW);
setDirtyLevel(DIRTY);
return subgraph;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class ExportHelper method printVariablesPdf.
private void printVariablesPdf(Chapter chapter, List<VariableVO> variables, int parentLevel) {
Paragraph sTitle = new Paragraph("Process Variables", sectionFont);
Section section = chapter.addSection(sTitle, parentLevel == 0 ? 0 : (parentLevel + 1));
com.lowagie.text.List list = new com.lowagie.text.List(false, false, 10.0f);
for (VariableVO var : variables) {
Phrase phrase = new Phrase();
phrase.add(new Chunk(var.getVariableName(), fixedWidthFont));
String v = var.getVariableType();
if (var.getDescription() != null)
v += " (" + var.getDescription() + ")";
phrase.add(new Chunk(": " + v + "\n", normalFont));
list.add(new ListItem(phrase));
}
section.add(list);
}
use of com.centurylink.mdw.model.value.variable.VariableVO 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.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class MappingEditor method getMappedVariableBindings.
private List<VariableBinding> getMappedVariableBindings(Map<String, String> map) {
List<VariableBinding> bindings = new ArrayList<VariableBinding>();
for (String variableName : map.keySet()) {
VariableVO variableVO = getOwningProcess().getVariable(variableName);
if (variableVO != null)
bindings.add(new VariableBinding(variableVO, map.get(variableName)));
}
Collections.<VariableBinding>sort(bindings);
return bindings;
}
Aggregations