use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessCanvasWrapper method saveProcessAs.
public void saveProcessAs() {
ProcessSaveAsDialog newProcessDialog = new ProcessSaveAsDialog(getParent().getShell(), getProcess());
if (newProcessDialog.open() != Dialog.OK)
// cancelled
return;
String newName = newProcessDialog.getNewName();
WorkflowPackage newPkg = getProject().getDefaultPackage();
if (!StringHelper.isEmpty(newProcessDialog.getPackageName()))
newPkg = getProject().getPackage(newProcessDialog.getPackageName());
flowchartPage.getProcess().blankOutTaskLogicalId();
flowchartPage.getProcess().save_temp_vars();
getDesignerProxy().saveProcessAs(getProcess(), newPkg, newName);
WorkflowProcess newProc = getProject().getProcess(newName);
if (newProc != null) {
// update the process explorer tree
newProc.sync();
newProc.addElementChangeListener(getProject());
newProc.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, newProc);
// update the canvas editor
openProcessDefinition(newProc);
IWorkbenchPage page = MdwPlugin.getActivePage();
if (page != null) {
ProcessEditor processEditor = (ProcessEditor) page.findEditor(getProcess());
if (processEditor != null)
page.closeEditor(processEditor, false);
}
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class CopyDialog method nameAlreadyExists.
private boolean nameAlreadyExists(String name) {
WorkflowProject workflowProject = workflowElement.getProject();
PluginDataAccess dataAccess = workflowProject.getDataAccess();
if (workflowElement instanceof WorkflowProcess)
return dataAccess.processNameExists(targetPackage.getPackageVO(), name);
else if (workflowElement instanceof ExternalEvent)
return workflowProject.externalEventNameExists(name);
else if (workflowElement instanceof WorkflowAsset)
return targetPackage == null ? workflowProject.workflowAssetNameExists(name) : targetPackage.workflowAssetNameExists(name);
else
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchConfiguration method launch.
public void launch(ILaunchConfiguration launchConfig, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String wfProjectName = launchConfig.getAttribute(WORKFLOW_PROJECT, "");
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProjectName);
if (workflowProject == null) {
showError("Can't locate workflow project: '" + wfProjectName + "'.", PROCESS_LAUNCH, null);
return;
}
if (mode.equals(ILaunchManager.DEBUG_MODE) && !connectForDebug(workflowProject, launchConfig)) {
return;
}
setWriteToConsole(launchConfig.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true));
boolean viaExternalEvent = launchConfig.getAttribute(LAUNCH_VIA_EXTERNAL_EVENT, false);
if (viaExternalEvent) {
String request = launchConfig.getAttribute(EXTERNAL_EVENT_REQUEST, "");
fireExternalEvent(workflowProject, request, null);
return;
}
boolean notifyProcess = launchConfig.getAttribute(NOTIFY_PROCESS, false);
if (notifyProcess) {
String eventName = launchConfig.getAttribute(NOTIFY_PROCESS_EVENT, "");
String message = launchConfig.getAttribute(NOTIFY_PROCESS_REQUEST, "");
notifyProcess(workflowProject, eventName, message, null);
return;
}
String processName = launchConfig.getAttribute(PROCESS_NAME, "");
String processVersion = launchConfig.getAttribute(PROCESS_VERSION, "");
WorkflowProcess process = workflowProject.getProcess(processName, processVersion);
if (process == null) {
// handle condition: obsolete version no longer in project list, but
// not yet in archive
ProcessVO procVO = workflowProject.getDesignerProxy().getProcessVO(processName, processVersion);
if (procVO == null) {
showError("Can't locate process '" + processName + " v" + processVersion + "' in " + wfProjectName + ".", PROCESS_LAUNCH, workflowProject);
return;
} else {
process = new WorkflowProcess(workflowProject, procVO);
}
}
String masterRequestId = launchConfig.getAttribute(MASTER_REQUEST_ID, "");
if (masterRequestId.length() == 0) {
showError("Missing masterRequestId.", PROCESS_LAUNCH, workflowProject);
return;
}
String owner = launchConfig.getAttribute(OWNER, "");
String ownerId = launchConfig.getAttribute(OWNER_ID, "");
boolean synchronous = launchConfig.getAttribute(SYNCHRONOUS, false);
String responseVarName = launchConfig.getAttribute(RESPONSE_VAR_NAME, "");
Map<String, String> variableValues = launchConfig.getAttribute(VARIABLE_VALUES, new HashMap<String, String>());
boolean showLogs = launchConfig.getAttribute(SHOW_LOGS, false);
boolean liveView = launchConfig.getAttribute(LIVE_VIEW, false);
launchProcess(process, masterRequestId, owner, new Long(ownerId), synchronous, responseVarName, variableValues, null, showLogs, liveView);
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessVariablesTab method initializeFrom.
public void initializeFrom(ILaunchConfiguration launchConfig) {
try {
String wfProject = launchConfig.getAttribute(ProcessLaunchConfiguration.WORKFLOW_PROJECT, "");
workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProject);
if (workflowProject != null) {
String procName = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_NAME, "");
String procVer = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, "");
WorkflowProcess processVersion = workflowProject.getProcess(procName, procVer);
if (processVersion == null) {
// handle condition: obsolete version no longer in project
// list, but not yet in archive
processVersion = new WorkflowProcess(workflowProject, workflowProject.getDesignerProxy().getProcessVO(procName, procVer));
}
Map<String, String> variables = launchConfig.getAttribute(ProcessLaunchConfiguration.VARIABLE_VALUES, new HashMap<String, String>());
variableValues = new ArrayList<>();
List<VariableVO> variableVOs;
String activityId = launchConfig.getAttribute(ActivityLaunchConfiguration.ACTIVITY_ID, "");
if (activityId == null || activityId.isEmpty())
variableVOs = processVersion.getInputVariables();
else
variableVOs = processVersion.getVariables();
for (VariableVO variableVO : variableVOs) {
String varName = variableVO.getVariableName();
VariableTypeVO varType = workflowProject.getDataAccess().getVariableType(variableVO.getVariableType());
variableValues.add(new VariableValue(variableVO, varType, variables.get(varName)));
}
tableContainer.setInput(variableValues);
}
validatePage();
} catch (CoreException ex) {
PluginMessages.uiError(ex, "Launch Init", workflowProject);
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class WorkflowAssetEditor method fillTreeCombo.
private void fillTreeCombo() {
treeCombo.removeAll();
Comparator<WorkflowElement> comparator = new Comparator<WorkflowElement>() {
public int compare(WorkflowElement we1, WorkflowElement we2) {
return we1.getLabel().compareTo(we2.getLabel());
}
};
if (isProcess()) {
List<WorkflowPackage> packages = getProject().getTopLevelUserVisiblePackages();
for (WorkflowPackage pkg : packages) {
CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
packageItem.setText(pkg.getName());
packageItem.setImage(pkg.getIconImage());
for (WorkflowProcess process : pkg.getProcesses()) {
CTreeComboItem processItem = new CTreeComboItem(packageItem, SWT.NONE);
processItem.setText(process.getLabel());
processItem.setImage(process.getIconImage());
}
}
} else if (isTaskTemplate()) {
List<WorkflowPackage> packages = getProject().getTopLevelUserVisiblePackages();
for (WorkflowPackage pkg : packages) {
List<TaskTemplate> templatesForPkg = pkg.getTaskTemplates();
if (templatesForPkg != null && !templatesForPkg.isEmpty()) {
CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
packageItem.setText(pkg.getName());
packageItem.setImage(pkg.getIconImage());
for (TaskTemplate template : templatesForPkg) {
CTreeComboItem templateItem = new CTreeComboItem(packageItem, SWT.NONE);
templateItem.setText(template.getLabel());
templateItem.setImage(template.getIconImage());
}
}
}
} else {
List<WorkflowAsset> assets = getProject().getAssetList(assetTypes);
Map<WorkflowPackage, List<WorkflowAsset>> packageAssets = new TreeMap<>();
for (WorkflowAsset asset : assets) {
List<WorkflowAsset> assetsForPkg = packageAssets.get(asset.getPackage());
if (assetsForPkg == null) {
assetsForPkg = new ArrayList<>();
packageAssets.put(asset.getPackage(), assetsForPkg);
}
assetsForPkg.add(asset);
}
for (Map.Entry<WorkflowPackage, List<WorkflowAsset>> pkgAssets : packageAssets.entrySet()) {
CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
packageItem.setText(pkgAssets.getKey().getName());
packageItem.setImage(pkgAssets.getKey().getIconImage());
List<WorkflowAsset> assetsForPkg = pkgAssets.getValue();
Collections.sort(assetsForPkg, comparator);
for (WorkflowAsset assetForPkg : assetsForPkg) {
CTreeComboItem assetItem = new CTreeComboItem(packageItem, SWT.NONE);
assetItem.setText(assetForPkg.getLabel());
assetItem.setImage(assetForPkg.getIconImage());
}
}
}
}
Aggregations