Search in sources :

Example 6 with ActivityVO

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
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) HashSet(java.util.HashSet)

Example 7 with ActivityVO

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
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) HashMap(java.util.HashMap) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) HashSet(java.util.HashSet)

Example 8 with ActivityVO

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);
            }
        }
    }
}
Also used : ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 9 with ActivityVO

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;
}
Also used : ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 10 with ActivityVO

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);
    }
}
Also used : PackageVO(com.centurylink.mdw.model.value.process.PackageVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ArrayList(java.util.ArrayList) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Aggregations

ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)17 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)11 ArrayList (java.util.ArrayList)8 WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)6 MbengNode (com.qwest.mbeng.MbengNode)6 HashMap (java.util.HashMap)5 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)4 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)4 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 HashSet (java.util.HashSet)2 TextNoteVO (com.centurylink.mdw.model.value.activity.TextNoteVO)1 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)1 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)1 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)1 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)1 DomDocument (com.qwest.mbeng.DomDocument)1 FormatDom (com.qwest.mbeng.FormatDom)1 MbengException (com.qwest.mbeng.MbengException)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1