use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.
the class ImportTaskTemplatesWizard method performImportExport.
void performImportExport(ProgressMonitor progressMonitor) throws IOException, XmlException, DataAccessException, ValidationException, ActionCancelledException {
Importer importer = new Importer(getProject().getDataAccess(), getShell());
progressMonitor.progress(10);
progressMonitor.subTask("Reading XML file");
byte[] bytes = readFile(getPage().getFilePath());
if (progressMonitor.isCanceled())
throw new ActionCancelledException();
progressMonitor.subTask("Performing Import");
WorkflowPackage pkg = getPackage();
if (pkg == null)
throw new ValidationException("No package found.");
importer.importTaskTemplates(pkg, new String(bytes), progressMonitor);
progressMonitor.progress(30);
}
use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method saveProcessAs.
public void saveProcessAs(final WorkflowProcess processVersion, final WorkflowPackage targetPackage, final String newName) {
String progressMsg = SAVING + newName + "'";
String errorMsg = "Save Process";
designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {
public void perform() throws ValidationException, DataAccessException, RemoteException {
ProcessVO origProcVO = processVersion.getProcessVO();
ProcessVO newProcVO = new ProcessVO(-1L, newName, origProcVO.getProcessDescription(), null);
newProcVO.set(origProcVO.getAttributes(), origProcVO.getVariables(), origProcVO.getTransitions(), origProcVO.getSubProcesses(), origProcVO.getActivities());
newProcVO.setVersion(1);
newProcVO.setInRuleSet(origProcVO.isInRuleSet());
WorkflowProcess newProcess = new WorkflowProcess(targetPackage.getProject(), newProcVO);
newProcess.setPackage(targetPackage);
Graph process = new Graph(newProcVO, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
process.dirtyLevel = Graph.NEW;
FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
flowchartPage.setProcess(process);
saveProcess(newProcess, flowchartPage, PersistType.CREATE, 0, false, false);
toggleProcessLock(newProcess, true);
// why?
newProcess.getProcessVO().setVersion(1);
dataAccess.getProcesses(false).add(newProcess.getProcessVO());
targetPackage.addProcess(newProcess);
newProcess.setPackage(targetPackage);
if (!newProcess.isInDefaultPackage())
savePackage(newProcess.getPackage());
}
};
designerRunner.run();
}
use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method copyProcess.
public void copyProcess(final String originalName, final String originalVersion, final String newName, final WorkflowPackage targetPackage) {
String progressMsg = "Creating process '" + newName + "'\nin package '" + targetPackage.getName() + "'";
String errorMsg = "Create Process";
designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {
public void perform() throws ValidationException, DataAccessException, RemoteException {
int dotIdx = originalVersion.indexOf('.');
int major = Integer.parseInt(originalVersion.substring(0, dotIdx));
int minor = Integer.parseInt(originalVersion.substring(dotIdx + 1));
ProcessVO origProcVO = dataAccess.getDesignerDataAccess().getProcessDefinition(originalName, major * 1000 + minor);
origProcVO = dataAccess.getDesignerDataAccess().getProcess(origProcVO.getProcessId(), origProcVO);
new ProcessWorker().convert_to_designer(origProcVO);
ProcessVO newProcVO = new ProcessVO(-1L, newName, origProcVO.getProcessDescription(), null);
newProcVO.set(origProcVO.getAttributes(), origProcVO.getVariables(), origProcVO.getTransitions(), origProcVO.getSubProcesses(), origProcVO.getActivities());
newProcVO.setVersion(1);
newProcVO.setInRuleSet(origProcVO.isInRuleSet());
WorkflowProcess newProcess = new WorkflowProcess(targetPackage.getProject(), newProcVO);
newProcess.setPackage(targetPackage);
Graph process = new Graph(newProcVO, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
process.dirtyLevel = Graph.NEW;
FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
flowchartPage.setProcess(process);
saveProcess(newProcess, flowchartPage, PersistType.CREATE, 0, false, false);
toggleProcessLock(newProcess, true);
// why?
newProcess.getProcessVO().setVersion(1);
dataAccess.getProcesses(false).add(newProcess.getProcessVO());
targetPackage.addProcess(newProcess);
newProcess.setPackage(targetPackage);
if (!newProcess.isInDefaultPackage())
savePackage(newProcess.getPackage());
}
};
designerRunner.run();
}
use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method saveProcessWithProgress.
public void saveProcessWithProgress(final WorkflowProcess process, final FlowchartPage flowchartPage, final PersistType persistType, final int version, final boolean validate, final boolean keepLocked) {
String progressMsg = SAVING + process.getName() + "'";
String errorMsg = "Save Process";
designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {
public void perform() throws ValidationException, DataAccessException, RemoteException {
WorkflowProcess oldProcess = null;
if (persistType == PersistType.NEW_VERSION) {
RuleSetVO existing = null;
if (process.isInRuleSet())
existing = dataAccess.getDesignerDataAccess().getRuleSet(process.getName(), RuleSetVO.PROCESS, version);
if (existing != null)
throw new DataAccessException("\n" + process.getLabel() + ALREADY_EXISTS);
process.getProcessVO().setProcessId(-1L);
// preserve the old version for the process tree
ProcessVO oldProcessVoStub = new ProcessVO();
oldProcessVoStub.setProcessId(process.getId());
oldProcessVoStub.setProcessName(process.getName());
oldProcessVoStub.setVersion(process.getProcessVO().getVersion());
oldProcess = new WorkflowProcess(process.getProject(), oldProcessVoStub);
oldProcess.setPackage(process.getPackage());
oldProcess.setTopLevelVersion(process.getTopLevelVersion());
if (// temp attribute to avoid API
project.isFilePersist())
// change
process.setAttribute("previousProcessVersion", oldProcess.getVersionString());
}
saveProcess(process, flowchartPage, persistType, version, validate, keepLocked);
if (process.getTopLevelVersion() != null)
process.getTopLevelVersion().setProcessVO(process.getProcessVO());
if (persistType == PersistType.NEW_VERSION && process.isInRuleSet()) {
RuleSetVO procRs = dataAccess.getRuleSet(process.getId());
if (procRs == null)
dataAccess.getAllRuleSets(false).add(process.getProcessVO());
}
}
};
designerRunner.run();
}
use of com.centurylink.mdw.designer.utils.ValidationException 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();
}
Aggregations