Search in sources :

Example 1 with ProcessLoader

use of com.centurylink.mdw.dataaccess.ProcessLoader in project mdw-designer by CenturyLinkCloud.

the class DesignerDataAccess method getProcessDefinition.

public ProcessVO getProcessDefinition(String procname, int version) throws RemoteException, DataAccessException {
    if (procname.indexOf(RemoteAccess.REMOTE_NAME_DELIMITER) > -1) {
        int k = procname.indexOf(RemoteAccess.REMOTE_NAME_DELIMITER);
        String properProcname = procname.substring(0, k);
        String logicalServerName = procname.substring(k + 1);
        RemoteAccess rao = remoteAccess.get(logicalServerName);
        if (rao == null) {
            rao = createRemoteAccess(logicalServerName);
            remoteAccess.put(logicalServerName, rao);
        }
        ProcessLoader procLoader = rao.getLoader();
        ProcessVO procdef = procLoader.getProcessBase(properProcname, version);
        procdef.setRemoteServer(logicalServerName);
        return procdef;
    } else {
        return loader.getProcessBase(procname, version);
    }
}
Also used : RemoteAccess(com.centurylink.mdw.dataaccess.RemoteAccess) ProcessLoader(com.centurylink.mdw.dataaccess.ProcessLoader) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 2 with ProcessLoader

use of com.centurylink.mdw.dataaccess.ProcessLoader in project mdw-designer by CenturyLinkCloud.

the class DesignerDataAccess method getProcess.

public ProcessVO getProcess(Long procId, ProcessVO procdef) throws DataAccessException {
    if (procdef != null && procdef.isRemote()) {
        ProcessLoader procLoader = remoteAccess.get(procdef.getRemoteServer()).getLoader();
        return procLoader.loadProcess(procId, true);
    } else {
        ProcessVO process = loader.loadProcess(procId, true);
        if (process == null && remoteAssetRetrieve)
            process = remoteRetrieveProcess(procId);
        if (process != null) {
            if (isVcsPersist()) {
                if (remoteAssetRetrieve) {
                    try {
                        Map<String, String> overrideAttrs = workflowAccessRest.getAttributes(OwnerType.PROCESS, procId);
                        process.applyOverrideAttributes(overrideAttrs);
                    } catch (IOException ex) {
                        System.err.println("Server not running: " + ex);
                    }
                }
            } else {
                if (process.isInRuleSet())
                    process.applyOverrideAttributes(getAttributes(OwnerType.PROCESS, procId));
            }
        }
        return process;
    }
}
Also used : ProcessLoader(com.centurylink.mdw.dataaccess.ProcessLoader) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) IOException(java.io.IOException)

Aggregations

ProcessLoader (com.centurylink.mdw.dataaccess.ProcessLoader)2 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)2 RemoteAccess (com.centurylink.mdw.dataaccess.RemoteAccess)1 IOException (java.io.IOException)1