Search in sources :

Example 11 with ProcessVO

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;
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) MbengNode(com.qwest.mbeng.MbengNode) ArrayList(java.util.ArrayList) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 12 with ProcessVO

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;
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) HashMap(java.util.HashMap) MbengNode(com.qwest.mbeng.MbengNode) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 13 with ProcessVO

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);
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RestfulServer(com.centurylink.mdw.designer.utils.RestfulServer) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) VersionControl(com.centurylink.mdw.dataaccess.VersionControl)

Example 14 with ProcessVO

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;
}
Also used : ProcessWorker(com.centurylink.mdw.designer.utils.ProcessWorker) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 15 with ProcessVO

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;
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException)

Aggregations

ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)92 ArrayList (java.util.ArrayList)29 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)28 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)25 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)17 IOException (java.io.IOException)17 HashMap (java.util.HashMap)15 RemoteException (java.rmi.RemoteException)14 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)12 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)11 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)11 JSONException (org.json.JSONException)11 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)10 XmlException (org.apache.xmlbeans.XmlException)10 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)9 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)9 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)8 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)8 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)7 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)5