use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class ProcessValidator method checkForFloatingNodes.
/*
*
* @param graph
* @return
*/
// AK..Added 06/10/2008
private void checkForFloatingNodes() {
// boolean flag = false;
HashSet<Long> linked_node_set = new HashSet<Long>();
for (WorkTransitionVO link : process.getTransitions()) {
linked_node_set.add(link.getFromWorkId());
linked_node_set.add(link.getToWorkId());
}
// Now loop through all Nodes for each link to determine if any of the nodes from link-loop (outer) matches node from inner loop....
for (ActivityVO node : process.getActivities()) {
if (!linked_node_set.contains(node.getActivityId())) {
errors.add("Activity '" + node.getActivityName() + "' has no transitions.");
}
}
// Inner while..loop
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class ProcessValidator method checkForOverlappingLinks.
/*
*
* @param graph
* @return
*/
// AK..Added 06/10/2008
private void checkForOverlappingLinks() {
Map<Long, String> actnames = new HashMap<Long, String>();
for (ActivityVO node : process.getActivities()) {
actnames.put(node.getActivityId(), node.getActivityName());
}
HashSet<String> dispinfo_set = new HashSet<String>();
for (WorkTransitionVO link : process.getTransitions()) {
String dispinfo = AttributeVO.findAttribute(link.getAttributes(), WorkTransitionAttributeConstant.TRANSITION_DISPLAY_INFO);
if (dispinfo == null)
continue;
if (dispinfo_set.contains(dispinfo)) {
errors.add("There are overlap transitions between '" + actnames.get(link.getFromWorkId()) + "' and '" + actnames.get(link.getToWorkId()) + "'");
} else {
dispinfo_set.add(dispinfo);
}
}
// for..outer loop
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class ProcessValidator method validateProcess.
private void validateProcess(NodeMetaInfo implInfo) {
// AK..Validate Nodes, Links, etc. before saving; continue to allow Saving graph, if user still wants to Save
// Check if any "floating" Nodes exist
checkForFloatingNodes();
// Check if any links(transitions) are visually overlapping
checkForOverlappingLinks();
// check for attributes of individual activities
for (ActivityVO act : process.getActivities()) {
validateActivity(act, implInfo);
}
if (process.getSubProcesses() != null) {
for (ProcessVO subproc : process.getSubProcesses()) {
if (subproc.getActivities() == null)
continue;
for (ActivityVO act : subproc.getActivities()) {
validateActivity(act, implInfo);
}
}
}
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class Activity method getUpstreamActivityNames.
public List<String> getUpstreamActivityNames() {
List<String> upstreamActivityNames = new ArrayList<String>();
ProcessVO processVO = process.getProcessVO();
for (ActivityVO activityVO : processVO.getUpstreamActivities(getId())) {
upstreamActivityNames.add(activityVO.getActivityName());
}
Collections.sort(upstreamActivityNames);
return upstreamActivityNames;
}
use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method upgradeAssets.
/**
* Replace obsolete implementors, and other assets (see help doc
* upgradeAssetsDuringImport.html).
*/
public void upgradeAssets(WorkflowPackage packageVersion) throws DataAccessException, IOException {
boolean packageUpdated = false;
PackageVO packageVO = packageVersion.getPackageVO();
List<ProcessVO> processVOs = packageVO.getProcesses();
// update activity implementors
List<ProcessVO> newProcs = new ArrayList<>();
for (ProcessVO processVO : processVOs) {
boolean processUpdated = false;
ProcessVO newProc = dataAccess.getDesignerDataAccess().getProcess(processVO.getProcessId(), processVO);
List<ActivityVO> activities = newProc.getActivities();
if (activities != null) {
for (ActivityVO activityVO : activities) {
if (new ActivityUpgrader(activityVO).doUpgrade())
processUpdated = true;
}
if (newProc.getSubProcesses() != null) {
for (ProcessVO subproc : newProc.getSubProcesses()) {
if (subproc.getActivities() != null) {
for (ActivityVO subprocActivity : subproc.getActivities()) {
if (new ActivityUpgrader(subprocActivity).doUpgrade())
processUpdated = true;
}
}
}
}
}
// update variable types
List<VariableVO> variables = newProc.getVariables();
if (variables != null) {
for (VariableVO variableVO : variables) {
String variableType = variableVO.getVariableType();
String updatedVariableType = Compatibility.getVariableType(variableType);
if (!updatedVariableType.equals(variableType)) {
variableVO.setVariableType(updatedVariableType);
processUpdated = true;
}
}
}
if (processUpdated) {
int processVersion = newProc.getVersion();
processVersion++;
newProc.setVersion(processVersion);
packageUpdated = true;
}
newProcs.add(newProc);
}
// Set old activity implementors in the package to hidden
List<ActivityImplementorVO> activityImplementorVOs = packageVO.getImplementors();
for (ActivityImplementorVO activityImplementorVO : activityImplementorVOs) {
String activityImplClassName = activityImplementorVO.getImplementorClassName();
if (Compatibility.isOldImplementor(activityImplClassName)) {
activityImplementorVO.setHidden(true);
packageUpdated = true;
}
}
if (packageUpdated) {
// update with new assets for saving
packageVO.setProcesses(newProcs);
List<RuleSetVO> newRuleSets = new ArrayList<>();
for (RuleSetVO ruleSet : packageVO.getRuleSets()) newRuleSets.add(getDesignerDataAccess().getRuleSet(ruleSet.getId()));
packageVO.setRuleSets(newRuleSets);
int version = packageVersion.getVersion();
version++;
packageVersion.setVersion(version);
// avoid forcing version
packageVersion.setExported(false);
// increment on save
packageVersion.syncProcesses();
getDesignerDataAccess().savePackage(packageVO, ProcessPersister.PersistType.IMPORT);
}
}
Aggregations