Search in sources :

Example 1 with VariableVO

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;
}
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 2 with VariableVO

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;
}
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 3 with VariableVO

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);
}
Also used : VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) List(java.util.List) ArrayList(java.util.ArrayList) Phrase(com.lowagie.text.Phrase) ListItem(com.lowagie.text.ListItem) Chunk(com.lowagie.text.Chunk) Section(com.lowagie.text.Section) Paragraph(com.lowagie.text.Paragraph)

Example 4 with VariableVO

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);
        }
    }
}
Also used : SocketTimeoutException(java.net.SocketTimeoutException) Parameter(com.centurylink.mdw.service.Parameter) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) HttpHelper(com.centurylink.mdw.common.utilities.HttpHelper) ActionRequestDocument(com.centurylink.mdw.service.ActionRequestDocument)

Example 5 with VariableVO

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;
}
Also used : ArrayList(java.util.ArrayList) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) VariableBinding(com.centurylink.mdw.plugin.designer.model.VariableBinding)

Aggregations

VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)34 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)9 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)7 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)5 IOException (java.io.IOException)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)3 VariableTypeVO (com.centurylink.mdw.model.value.variable.VariableTypeVO)3 VariableBinding (com.centurylink.mdw.plugin.designer.model.VariableBinding)3 ActionRequestDocument (com.centurylink.mdw.service.ActionRequestDocument)3 Parameter (com.centurylink.mdw.service.Parameter)3 XmlException (org.apache.xmlbeans.XmlException)3 JSONException (org.json.JSONException)3 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)2 SubGraph (com.centurylink.mdw.designer.display.SubGraph)2 RestfulServer (com.centurylink.mdw.designer.utils.RestfulServer)2