Search in sources :

Example 1 with DocxTable

use of com.centurylink.mdw.designer.utils.DocxBuilder.DocxTable 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)

Aggregations

DocxCodebox (com.centurylink.mdw.designer.utils.DocxBuilder.DocxCodebox)1 DocxTable (com.centurylink.mdw.designer.utils.DocxBuilder.DocxTable)1 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)1 TreeMap (java.util.TreeMap)1