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());
}
}
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());
}
}
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>");
}
}
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();
}
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();
}
Aggregations