use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class Importer method updateSubProcessIdAttributes.
/**
* Update processid attribute for calling processes within this package.
* TODO: Get rid of this method, which is only needed for ancient (pre-4.5)
* runtimes.
*/
private void updateSubProcessIdAttributes(ProcessVO processVO) throws DataAccessException, XmlException {
// save calling processes to update subprocess activity attributes
boolean toUpdate = false;
if (processVO.getActivities() != null) {
for (ActivityVO actVO : processVO.getActivities()) {
String procNameAttr = actVO.getAttribute(PROCESS_NAME);
String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
if (procNameAttr != null && procVerAttr != null) {
toUpdate = true;
}
}
if (processVO.getSubProcesses() != null) {
for (ProcessVO embedded : processVO.getSubProcesses()) {
for (ActivityVO actVO : embedded.getActivities()) {
String procNameAttr = actVO.getAttribute(PROCESS_NAME);
String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
if (procNameAttr != null && procVerAttr != null) {
toUpdate = true;
}
}
}
}
}
if (toUpdate) {
ProcessVO procVO = dataAccess.getDesignerDataAccess().getProcess(processVO.getProcessId(), processVO);
for (ActivityVO actVO : procVO.getActivities()) {
String procNameAttr = actVO.getAttribute(PROCESS_NAME);
String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
if (procNameAttr != null && procVerAttr != null) {
for (ProcessVO checkVO : importedPackageVO.getProcesses()) {
if (checkVO.getProcessName().equals(procNameAttr) && String.valueOf(checkVO.getVersion()).equals(procVerAttr))
actVO.setAttribute("processid", checkVO.getProcessId().toString());
}
}
}
if (procVO.getSubProcesses() != null) {
for (ProcessVO embedded : procVO.getSubProcesses()) {
for (ActivityVO actVO : embedded.getActivities()) {
String procNameAttr = actVO.getAttribute(PROCESS_NAME);
String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
if (procNameAttr != null && procVerAttr != null) {
for (ProcessVO checkVO : importedPackageVO.getProcesses()) {
if (checkVO.getProcessName().equals(procNameAttr) && String.valueOf(checkVO.getVersion()).equals(procVerAttr))
actVO.setAttribute("processid", checkVO.getProcessId().toString());
}
}
}
}
}
dataAccess.getDesignerDataAccess().updateProcess(procVO, 0, false);
}
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class DesignerPage method setSynchronizationActivity.
private void setSynchronizationActivity(Node node) {
List<ActivityVO> as = node.graph.getProcessVO().getUpstreamActivities(node.getId());
StringBuilder sb = new StringBuilder();
for (ActivityVO a : as) {
if (sb.length() > 0)
sb.append("#");
sb.append(a.getActivityName());
}
node.setAttribute(WorkAttributeConstant.SYNCED_ACTIVITIES, sb.toString());
}
use of com.centurylink.mdw.model.value.activity.ActivityVO 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.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class ProcessValidator method validate.
public void validate(boolean checkImplementors, NodeMetaInfo implInfo) throws ValidationException {
if (packageVO != null) {
// check if processes are up to date
for (ProcessVO proc : packageVO.getProcesses()) {
if (proc.getNextVersion() != null)
errors.add("Process " + proc.getProcessName() + " has newer versions");
}
// check implementors
if (checkImplementors) {
Map<String, ActivityImplementorVO> has = new HashMap<String, ActivityImplementorVO>();
Map<String, String> hasnot = new HashMap<String, String>();
for (ActivityImplementorVO ai : packageVO.getImplementors()) {
has.put(ai.getImplementorClassName(), ai);
}
for (ProcessVO proc : packageVO.getProcesses()) {
for (ActivityVO act : proc.getActivities()) {
String v = act.getImplementorClassName();
if (!has.containsKey(v))
hasnot.put(v, v);
}
if (proc.getSubProcesses() != null) {
for (ProcessVO subproc : proc.getSubProcesses()) {
for (ActivityVO act : subproc.getActivities()) {
String v = act.getImplementorClassName();
if (!has.containsKey(v))
hasnot.put(v, v);
}
}
}
}
for (String v : hasnot.keySet()) {
errors.add("Implementor " + v + " is used but not included");
}
}
// validate each process
for (ProcessVO proc : packageVO.getProcesses()) {
process = proc;
validateProcess(implInfo);
}
} else {
validateProcess(implInfo);
}
if (errors.size() > 0)
throw new ValidationException(errors);
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class ProcessWorker method moveStartActivityToFirst.
private void moveStartActivityToFirst(ProcessVO processVO, NodeMetaInfo metainfo) {
for (int i = 0; i < processVO.getActivities().size(); i++) {
ActivityVO act = processVO.getActivities().get(i);
ActivityImplementorVO nmi = metainfo.find(act.getImplementorClassName());
if (nmi == null)
continue;
if (nmi.isStart()) {
if (i > 0) {
processVO.getActivities().remove(i);
processVO.getActivities().add(0, act);
}
return;
}
}
}
Aggregations