use of com.centurylink.mdw.model.value.process.ProcessVO 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.process.ProcessVO 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.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class WorkflowImageHelper method getProcessImage.
/**
* Generate a process instance image.
*/
public BufferedImage getProcessImage() throws Exception {
VersionControl vc = DataAccess.getAssetVersionControl(ApplicationContext.getAssetRoot());
String serviceUrl = ApplicationContext.getServicesUrl();
RestfulServer restfulServer = new RestfulServer("jdbc://dummy", "mdwapp", serviceUrl);
restfulServer.setVersionControl(vc);
restfulServer.setRootDirectory(ApplicationContext.getAssetRoot());
DesignerDataAccess dao = new DesignerDataAccess(restfulServer, null, "mdwapp");
// clone the process since it'll be converted to Designer
Long processId = process.getId();
process = new ProcessVO(process);
process.setId(processId);
return generateImage(dao);
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class DesignerPage method loadProcess.
/**
* Loads a process for use by Designer.
*/
public ProcessVO loadProcess(ProcessVO procdef) throws RemoteException, DataAccessException {
ProcessVO process = new ProcessVO(frame.dao.getProcess(procdef.getProcessId(), procdef));
// these don't get set by the clone
process.setId(procdef.getId());
process.setNextVersion(procdef.getNextVersion());
process.setPrevVersion(procdef.getPrevVersion());
new ProcessWorker().convert_to_designer(process);
return process;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class DesignerPage method findProcessDefinition.
public ProcessVO findProcessDefinition(Long procid, String server) {
ProcessVO procdef = model.findProcessDefinition(procid, server);
if (procdef != null)
return procdef;
try {
procdef = frame.dao.getProcessDefinition(procid);
model.addPrivateProcess(procdef);
} catch (Exception e) {
procdef = null;
}
return procdef;
}
Aggregations