Search in sources :

Example 6 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class GraphFragment method exportActivity.

private void exportActivity(ActivityVO act, MDWActivity xmlact) {
    xmlact.setId(act.getActivityId().toString());
    xmlact.setName(act.getActivityName());
    xmlact.setImplementation(act.getImplementorClassName());
    for (AttributeVO attr : act.getAttributes()) {
        exportAttribute(attr, xmlact.addNewAttribute());
    }
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO)

Example 7 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class GraphFragment method exportTransition.

private void exportTransition(WorkTransitionVO trans, MDWTransition xmltrans) {
    xmltrans.setFrom(trans.getFromWorkId().toString());
    xmltrans.setTo(trans.getToWorkId().toString());
    xmltrans.setCompletionCode(trans.getCompletionCode());
    String eventName = EventType.getEventTypeName(trans.getEventType());
    xmltrans.setEvent(MDWTransitionEvent.Enum.forString(eventName));
    for (AttributeVO attr : trans.getAttributes()) {
        exportAttribute(attr, xmltrans.addNewAttribute());
    }
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO)

Example 8 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printAttributesHtml.

private void printAttributesHtml(StringBuilder sb, List<AttributeVO> attributes) {
    if (attributes != null) {
        List<AttributeVO> sortedAttrs = new ArrayList<>(attributes);
        Collections.sort(sortedAttrs);
        sb.append("<h3>Activity Attributes</h3>\n");
        sb.append("<ul>\n");
        for (AttributeVO attr : sortedAttrs) {
            String name = attr.getAttributeName();
            String val = attr.getAttributeValue();
            if (!excludeAttribute(name, val)) {
                sb.append("<li>");
                if (tabularAttributes.containsKey(name)) {
                    sb.append(name + ":");
                    List<String> cols = new ArrayList<>(tabularAttributes.get(name));
                    char colDelim = ',';
                    if ("=".equals(cols.get(0))) {
                        colDelim = '=';
                        cols.remove(0);
                    }
                    String[] headers = cols.toArray(new String[0]);
                    List<String[]> rows = StringHelper.parseTable(escapeXml(val), colDelim, ';', headers.length);
                    String[][] values = new String[headers.length][rows.size()];
                    for (int i = 0; i < headers.length; i++) {
                        for (int j = 0; j < rows.size(); j++) {
                            values[i][j] = rows.get(j)[i];
                        }
                    }
                    printTableHtml(sb, headers, values);
                } else if (textboxAttributes.containsKey(name)) {
                    sb.append(textboxAttributes.get(name) + ":");
                    printCodeBoxHtml(sb, escapeXml(val));
                } else {
                    sb.append(name + " = " + val);
                }
                sb.append("</li>");
            }
        }
        sb.append("</ul>");
    }
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ArrayList(java.util.ArrayList)

Example 9 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printActivityDocx.

private void printActivityDocx(DocxBuilder builder, Node node) throws Exception {
    String id = node.getDisplayId(nodeIdType);
    String actTitle = ACTIVITY + id + ": \"" + node.getName().replace('\n', ' ') + "\"";
    builder.addParagraph("Heading2", actTitle);
    String summary = node.getAttribute(WorkAttributeConstant.DESCRIPTION);
    if (summary != null && summary.length() > 0) {
        builder.addBoldParagraph(summary);
    }
    // documentation
    if (options.contains(DOCUMENTATION)) {
        String detail = node.getAttribute(WorkAttributeConstant.DOCUMENTATION);
        if (detail != null && detail.length() > 0) {
            if (detail.startsWith(HTMLTAG)) {
                builder.addHtml(detail);
            } else {
                byte[] docBytes = decodeBase64(detail);
                builder.addDoc(docBytes);
            }
        }
    }
    // attributes
    if (options.contains(ATTRIBUTES)) {
        Map<String, Object> attrs = new TreeMap<>();
        if (node.getAttributes() != null) {
            for (AttributeVO attr : node.getAttributes()) {
                String name = attr.getAttributeName();
                String val = attr.getAttributeValue();
                if (!excludeAttribute(name, val)) {
                    if (tabularAttributes.containsKey(name)) {
                        DocxTable docxTable = parseTableDocx(builder, tabularAttributes.get(name), val);
                        docxTable.setFontSize(9);
                        docxTable.setIndent(800);
                        attrs.put(name, docxTable);
                    } else if (textboxAttributes.containsKey(name)) {
                        DocxCodebox docxTextbox = builder.new DocxCodebox(textboxAttributes.get(name), val);
                        attrs.put(name, docxTextbox);
                    } else {
                        attrs.put(name, val);
                    }
                }
            }
        }
        if (!attrs.isEmpty()) {
            builder.addParagraph("Heading3", "Activity Attributes");
            builder.addBulletList(attrs);
        }
    }
    builder.addBreak();
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) DocxTable(com.centurylink.mdw.designer.utils.DocxBuilder.DocxTable) DocxCodebox(com.centurylink.mdw.designer.utils.DocxBuilder.DocxCodebox) TreeMap(java.util.TreeMap)

Example 10 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method savePackage.

public void savePackage(WorkflowPackage packageVersion, boolean newVersion) throws DataAccessException, RemoteException {
    if (packageVersion.isDefaultPackage())
        return;
    CodeTimer timer = new CodeTimer("savePackage()");
    packageVersion.syncProcessVos();
    if (packageVersion.getPackageVO().getImplementors() != null) {
        // remove non-existent activity impls
        List<ActivityImplementorVO> toRemove = new ArrayList<>();
        for (ActivityImplementorVO activityImpl : packageVersion.getPackageVO().getImplementors()) {
            if (dataAccess.getActivityImplementor(activityImpl.getImplementorClassName()) == null)
                toRemove.add(activityImpl);
        }
        for (ActivityImplementorVO remove : toRemove) packageVersion.getPackageVO().getImplementors().remove(remove);
    }
    WorkflowPackage prevPkg = new WorkflowPackage(packageVersion.getProject(), new PackageVO());
    prevPkg.getPackageVO().setId(packageVersion.getId());
    prevPkg.setName(packageVersion.getName());
    prevPkg.getPackageVO().setVersion(packageVersion.getVersion());
    prevPkg.setTags(packageVersion.getTags());
    prevPkg.setModifyDate(packageVersion.getModifyDate());
    if (packageVersion.getPackageVO() != null && packageVersion.getPackageVO().getAttributes() != null) {
        for (AttributeVO attr : packageVersion.getPackageVO().getAttributes()) {
            prevPkg.setAttribute(attr.getAttributeName(), attr.getAttributeValue());
        }
    }
    Long pkgId;
    if (// do not
    !packageVersion.isLatest() || packageVersion.isArchived())
        // create
        // new
        // version
        pkgId = dataAccess.getDesignerDataAccess().savePackage(packageVersion.getPackageVO(), ProcessPersister.PersistType.UPDATE);
    else
        pkgId = dataAccess.getDesignerDataAccess().savePackage(packageVersion.getPackageVO());
    if (prevPkg.getId() == null || newVersion || (pkgId.longValue() != prevPkg.getId().longValue())) {
        packageVersion.getPackageVO().setPackageId(pkgId);
        prevPkg.setArchived(true);
        dataAccess.getPackages(false).add(packageVersion.getPackageVO());
        packageVersion.getProject().newPackageVersion(packageVersion, prevPkg);
        // update the tree
        packageVersion.getProject().fireElementChangeEvent(packageVersion, ChangeType.VERSION_CHANGE, packageVersion.getVersionString());
        // update other listeners
        packageVersion.fireElementChangeEvent(ChangeType.VERSION_CHANGE, packageVersion.getVersionString());
    }
    timer.stopAndLog();
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) PackageVO(com.centurylink.mdw.model.value.process.PackageVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ArrayList(java.util.ArrayList) CodeTimer(com.centurylink.mdw.plugin.CodeTimer)

Aggregations

AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)24 ArrayList (java.util.ArrayList)15 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)5 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)4 WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)4 MbengNode (com.qwest.mbeng.MbengNode)4 List (java.util.List)4 PackageDocument (com.centurylink.mdw.bpm.PackageDocument)3 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)3 CustomAttributeVO (com.centurylink.mdw.model.value.attribute.CustomAttributeVO)3 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)3 ProcessDefinitionDocument (com.centurylink.mdw.bpm.ProcessDefinitionDocument)2 Property (com.centurylink.mdw.bpm.PropertyDocument.Property)2 PropertyGroup (com.centurylink.mdw.bpm.PropertyGroupDocument.PropertyGroup)2 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 AttributeDialog (com.centurylink.mdw.plugin.designer.dialogs.AttributeDialog)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 XmlOptions (org.apache.xmlbeans.XmlOptions)2