use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataModel method copyPackage.
public PackageVO copyPackage(PackageVO curPkg, String newname, int newversion) {
PackageVO newPkg = new PackageVO();
newPkg.setPackageName(newname != null ? newname : curPkg.getPackageName());
newPkg.setPackageDescription(curPkg.getPackageDescription());
newPkg.setExported(false);
// newPkg.setPools(pools)
// newPkg.setVariables(variables)
newPkg.setSchemaVersion(DataAccess.currentSchemaVersion);
newPkg.setPackageId(getNewId());
newPkg.setVersion(newversion);
newPkg.setMetaContent(curPkg.getMetaContent());
List<ProcessVO> processes = new ArrayList<ProcessVO>();
newPkg.setProcesses(processes);
if (curPkg.getProcesses() != null) {
for (ProcessVO p : curPkg.getProcesses()) {
processes.add(p);
}
}
if (curPkg.getImplementors() != null) {
List<ActivityImplementorVO> impls = new ArrayList<ActivityImplementorVO>();
newPkg.setImplementors(impls);
for (ActivityImplementorVO a : curPkg.getImplementors()) {
impls.add(a);
}
}
if (curPkg.getExternalEvents() != null) {
List<ExternalEventVO> handlers = new ArrayList<ExternalEventVO>();
newPkg.setExternalEvents(handlers);
for (ExternalEventVO a : curPkg.getExternalEvents()) {
handlers.add(a);
}
}
if (curPkg.getParticipants() != null) {
List<LaneVO> participants = new ArrayList<LaneVO>();
newPkg.setParticipants(participants);
for (LaneVO a : curPkg.getParticipants()) {
participants.add(a);
}
}
if (curPkg.getRuleSets() != null) {
List<RuleSetVO> rulesets = new ArrayList<RuleSetVO>();
newPkg.setRuleSets(rulesets);
for (RuleSetVO a : curPkg.getRuleSets()) {
rulesets.add(a);
}
}
if (curPkg.getAttributes() != null) {
List<AttributeVO> attrs = new ArrayList<AttributeVO>();
newPkg.setAttributes(attrs);
for (AttributeVO a : curPkg.getAttributes()) {
attrs.add(a);
}
}
addPackage(newPkg);
return newPkg;
}
use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.
the class Graph method addLink.
/**
* this is for pasting
* @param trans
* @param fromId
* @param toId
* @return
*/
public Link addLink(GraphCommon owner, WorkTransitionVO trans, Long fromId, Long toId, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
WorkTransitionVO conn = new WorkTransitionVO();
conn.setFromWorkId(fromId);
conn.setToWorkId(toId);
conn.setEventType(trans.getEventType());
conn.setWorkTransitionId(new Long(0));
conn.setCompletionCode(trans.getCompletionCode());
ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
for (AttributeVO attr : trans.getAttributes()) {
AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
attributes.add(nattr);
}
conn.setAttributes(attributes);
owner.getProcessVO().getTransitions().add(conn);
if (newLogicalId) {
String lid;
if (owner instanceof SubGraph) {
lid = ((SubGraph) owner).getGraph().generateLogicalId("T");
} else {
lid = ((Graph) owner).generateLogicalId("T");
}
conn.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
}
Link link = new Link(owner.findNode(fromId), owner.findNode(toId), conn, arrowstyle);
if (xoff != 0 || yoff != 0)
link.shift(xoff, yoff, arrowstyle);
owner.links.add(link);
setDirtyLevel(DIRTY);
if (recordchange)
link.getChanges().setChangeType(Changes.NEW);
return link;
}
use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.
the class Graph method addNode.
/**
* This is for pasting
* @param actvo
* @return
*/
public Node addNode(GraphCommon owner, ActivityVO sourceact, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
Long pActId = genNodeId();
ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
for (AttributeVO attr : sourceact.getAttributes()) {
AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
attributes.add(nattr);
}
ActivityVO nodet = new ActivityVO(pActId, sourceact.getActivityName(), sourceact.getActivityDescription(), sourceact.getImplementorClassName(), attributes);
owner.getProcessVO().getActivities().add(nodet);
if (newLogicalId) {
String lid;
if (owner instanceof SubGraph) {
lid = ((SubGraph) owner).getGraph().generateLogicalId("A");
} else {
lid = ((Graph) owner).generateLogicalId("A");
}
nodet.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
}
Node node = new Node(nodet, owner, metainfo);
if (newLogicalId && node.isTaskActivity()) {
node.setAttribute(TaskActivity.ATTRIBUTE_TASK_LOGICAL_ID, null);
}
node.x += xoff;
node.y += yoff;
owner.nodes.add(node);
if (recordchange)
node.getChanges().setChangeType(Changes.NEW);
setDirtyLevel(DIRTY);
return node;
}
use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.
the class PluginDataAccess method setAttributes.
public void setAttributes(String owner, Long ownerId, List<AttributeVO> attrs) {
try {
Map<String, String> attributes = null;
if (attrs != null) {
attributes = new HashMap<>();
for (AttributeVO attr : attrs) attributes.put(attr.getAttributeName(), attr.getAttributeValue());
}
getDesignerDataAccess().setAttributes(owner, ownerId, attributes);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Set Attributes", workflowProject);
}
}
Aggregations