Search in sources :

Example 26 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class PackageInstanceFilter method getVariableCriteria.

public Map<String, String> getVariableCriteria(WorkflowProcess processVersion) {
    Map<String, String> criteria = new HashMap<String, String>();
    for (String varName : variableValues.keySet()) {
        String varValue = variableValues.get(varName);
        if (varValue != null && varValue.trim().length() > 0) {
            VariableVO varVO = processVersion.getVariable(varName);
            if (varVO != null && varVO.getVariableType().equals("java.util.Date")) {
                String mon = varValue.substring(4, 7).toUpperCase();
                String dd = varValue.substring(8, 10);
                String yyyy = varValue.substring(24);
                String dateVarVal = "to_date('" + mon + " " + dd + " " + yyyy + "', 'MON DD YYYY')";
                criteria.put("DATE:" + varName, " = " + dateVarVal);
            } else {
                criteria.put(varName, " = '" + varValue + "'");
            }
        }
    }
    return criteria;
}
Also used : HashMap(java.util.HashMap) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 27 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class ProcessInstanceFilter method getVariableCriteria.

public Map<String, String> getVariableCriteria(WorkflowProcess processVersion) {
    Map<String, String> criteria = new HashMap<>();
    for (Map.Entry<String, String> varName : variableValues.entrySet()) {
        String varValue = varName.getValue();
        if (varValue != null && varValue.trim().length() > 0) {
            VariableVO varVO = processVersion.getVariable(varName.getKey());
            if (varVO != null && varVO.getVariableType().equals("java.util.Date")) {
                String mon = varValue.substring(4, 7).toUpperCase();
                String dd = varValue.substring(8, 10);
                String yyyy = varValue.substring(24);
                String dateVarVal = null;
                if (processVersion.getProject().getMdwMajorVersion() >= 6) {
                    dateVarVal = mon + " " + dd + " " + yyyy;
                    criteria.put("DATE:" + varName.getKey(), dateVarVal);
                } else {
                    dateVarVal = "to_date('" + mon + " " + dd + " " + yyyy + "', 'MON DD YYYY')";
                    criteria.put("DATE:" + varName, " = " + dateVarVal);
                }
            } else {
                if (processVersion.getProject().getMdwMajorVersion() >= 6)
                    criteria.put(varName.getKey(), varValue);
                else
                    criteria.put(varName.getKey(), " = '" + varValue + "'");
            }
        }
    }
    return criteria;
}
Also used : HashMap(java.util.HashMap) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) Map(java.util.Map) HashMap(java.util.HashMap)

Example 28 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printProcessDocx.

private DocxBuilder printProcessDocx(Graph process, DesignerCanvas canvas) throws Exception {
    DocxBuilder builder = new DocxBuilder();
    // title
    String title = "Workflow: \"" + process.getName() + "\"";
    builder.addParagraph("Heading1", title);
    // process image
    int zoomSave = process.zoom;
    process.zoom = 100;
    byte[] imgBytes = printImage(-1f, canvas, process.getGraphSize(), "png");
    process.zoom = zoomSave;
    builder.addImage(imgBytes);
    printProcessBodyDocx(builder, process);
    // embedded subprocesses
    for (SubGraph subprocess : process.getSubgraphs(nodeIdType)) {
        String id = subprocess.getDisplayId(nodeIdType);
        String spTitle = "Embedded Subprocess " + id + ": \"" + subprocess.getName() + "\"";
        builder.addParagraph("Heading1", spTitle);
        printProcessBodyDocx(builder, subprocess);
    }
    // process variables
    if (options.contains(VARIABLES)) {
        List<VariableVO> variables = process.getProcessVO().getVariables();
        if (variables != null && !variables.isEmpty()) {
            builder.addParagraph("Heading2", "Process Variables");
            String[] headers = new String[] { "Name", "Type", "Mode", "Description" };
            String[][] values = new String[4][variables.size()];
            for (int i = 0; i < variables.size(); i++) {
                VariableVO var = variables.get(i);
                values[0][i] = var.getName();
                values[1][i] = var.getVariableType();
                values[2][i] = VariableVO.VariableCategories[var.getVariableCategory()];
                values[3][i] = var.getVariableReferredAs();
            }
            builder.addTable(headers, values, 11, 120);
        }
    }
    return builder;
}
Also used : DocxBuilder(com.centurylink.mdw.designer.utils.DocxBuilder) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

Example 29 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printProcessHtml.

private void printProcessHtml(StringBuilder sb, DesignerCanvas canvas, int chapter, Graph process, String filename) throws Exception {
    sb.append("<h1>");
    if (chapter > 0)
        sb.append(Integer.toString(chapter)).append(". ");
    sb.append("Workflow: \"").append(process.getName()).append("\"</h1>\n");
    // print image
    printGraphHtml(sb, canvas, process, filename, chapter);
    // print documentation text
    sb.append(BR);
    printProcessBodyHtml(sb, process);
    for (Node node : process.getNodes(nodeIdType)) {
        printActivityHtml(sb, node);
    }
    for (SubGraph subgraph : process.getSubgraphs(nodeIdType)) {
        printProcessBodyHtml(sb, subgraph);
        for (Node node : subgraph.getNodes(nodeIdType)) {
            printActivityHtml(sb, node);
        }
    }
    if (options.contains(VARIABLES)) {
        List<VariableVO> variables = process.getProcessVO().getVariables();
        if (variables != null && !variables.isEmpty()) {
            sb.append("<h2>Process Variables</h2>\n");
            String[] headers = new String[] { "Name", "Type", "Mode", "Description" };
            String[][] values = new String[4][variables.size()];
            for (int i = 0; i < variables.size(); i++) {
                VariableVO var = variables.get(i);
                values[0][i] = var.getName();
                values[1][i] = var.getVariableType();
                values[2][i] = VariableVO.VariableCategories[var.getVariableCategory()];
                values[3][i] = var.getVariableReferredAs();
            }
            printTableHtml(sb, headers, values);
        }
    }
}
Also used : Node(com.centurylink.mdw.designer.display.Node) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

Example 30 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class Graph method addVariable.

public VariableVO addVariable(String name, VariableTypeVO vt) {
    VariableVO doc = new VariableVO();
    doc.setVariableName(name);
    doc.setVariableId(null);
    doc.setVariableType(vt.getVariableType());
    processVO.getVariables().add(doc);
    updateTaskVariableMapping(null, name);
    return doc;
}
Also used : VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

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