Search in sources :

Example 1 with ProcessValidator

use of com.centurylink.mdw.designer.utils.ProcessValidator in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method saveProcess.

/**
 * Relies on classic designer page to update the processVO with the reloaded
 * data.
 */
public void saveProcess(WorkflowProcess process, FlowchartPage flowchartPage, PersistType persistType, int version, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
    CodeTimer timer = new CodeTimer("saveProcess()");
    Graph graph = flowchartPage.getProcess();
    graph.save_temp_vars();
    // refresh variable type cache since Designer Classic uses a single,
    // static cache
    // calls
    dataAccess.loadVariableTypes();
    if (validate)
        new ProcessValidator(process.getProcessVO()).validate(getNodeMetaInfo());
    if (!process.getProject().checkRequiredVersion(5, 5))
        flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
        !process.getProject().checkRequiredVersion(5, 2));
    // sure
    // why
    // this
    // was
    // ever
    // needed
    Map<String, String> overrideAttributes = null;
    if (process.getProcessVO() != null && process.getProject().isFilePersist() && process.overrideAttributesApplied())
        overrideAttributes = process.getProcessVO().getOverrideAttributes();
    Graph reloaded = null;
    try {
        reloaded = flowchartPage.saveProcess(graph, mainFrame, persistType, version, lock);
    } catch (ValidationException ex) {
        graph.setDirtyLevel(Graph.DIRTY);
        if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
            throw new ValidationException("There are instances associated with this process version.\n       Please increment the version when saving.");
        else
            throw ex;
    }
    process.setProcessVO(reloaded.getProcessVO());
    flowchartPage.setProcess(reloaded);
    WorkflowPackage pkg = process.getPackage();
    if (pkg != null && !pkg.isDefaultPackage() && persistType == PersistType.NEW_VERSION) {
        if (project.isFilePersist()) {
            pkg.setVersion(pkg.getVersion() + 1);
            // exported not relevant for vcs
            pkg.setExported(false);
            // processes since pkg will be archived
            // anyway
            savePackage(pkg, true);
        } else {
            savePackage(pkg);
        }
    }
    if (process.getProject().isFilePersist() && version != 0 && persistType == PersistType.NEW_VERSION && overrideAttributes != null && !overrideAttributes.isEmpty() && MdwPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREFS_CARRY_FORWARD_OVERRIDE_ATTRS)) {
        if (!process.overrideAttributesApplied())
            throw new DataAccessException("Override attributes not applied");
        reloaded.getProcessVO().applyOverrideAttributes(overrideAttributes);
        getDesignerDataAccess().setOverrideAttributes(reloaded.getProcessVO());
    }
    cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
    timer.stopAndLog();
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) CodeTimer(com.centurylink.mdw.plugin.CodeTimer) ProcessValidator(com.centurylink.mdw.designer.utils.ProcessValidator) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 2 with ProcessValidator

use of com.centurylink.mdw.designer.utils.ProcessValidator in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method forceUpdateProcess.

/**
 * Relies on classic designer page to update the processVO with the reloaded
 * data.
 */
public void forceUpdateProcess(WorkflowProcess processVersion, FlowchartPage flowchartPage, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
    CodeTimer timer = new CodeTimer("forceUpdateProcess()");
    Graph graph = flowchartPage.getProcess();
    graph.save_temp_vars();
    if (validate)
        new ProcessValidator(processVersion.getProcessVO()).validate(getNodeMetaInfo());
    if (!processVersion.getProject().checkRequiredVersion(5, 5))
        flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
        !processVersion.getProject().checkRequiredVersion(5, 2));
    // sure
    // why
    // this
    // was
    // ever
    // needed
    Graph reloaded = null;
    try {
        reloaded = flowchartPage.saveProcess(graph, mainFrame, PersistType.UPDATE, 0, lock);
    } catch (ValidationException ex) {
        if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
            throw new ValidationException(INCOMPATIBLE_INSTANCES);
        else
            throw ex;
    }
    flowchartPage.setProcess(reloaded);
    processVersion.setProcessVO(reloaded.getProcessVO());
    cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
    timer.stopAndLog();
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) CodeTimer(com.centurylink.mdw.plugin.CodeTimer) ProcessValidator(com.centurylink.mdw.designer.utils.ProcessValidator)

Aggregations

Graph (com.centurylink.mdw.designer.display.Graph)2 SubGraph (com.centurylink.mdw.designer.display.SubGraph)2 ProcessValidator (com.centurylink.mdw.designer.utils.ProcessValidator)2 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)2 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1