use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementActionHandler method debug.
public void debug(Object element) {
if (element instanceof WorkflowProcess) {
WorkflowProcess processVersion = (WorkflowProcess) element;
IEditorPart editorPart = findOpenEditor(processVersion);
if (editorPart != null && editorPart.isDirty()) {
if (MessageDialog.openQuestion(getShell(), "Process Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
editorPart.doSave(new NullProgressMonitor());
}
if (editorPart == null) {
// process must be open
open(processVersion);
}
ProcessLaunchShortcut launchShortcut = new ProcessLaunchShortcut();
launchShortcut.launch(new StructuredSelection(processVersion), ILaunchManager.DEBUG_MODE);
} else if (element instanceof Activity) {
Activity activity = (Activity) element;
WorkflowProcess processVersion = activity.getProcess();
IEditorPart editorPart = findOpenEditor(processVersion);
if (editorPart != null && editorPart.isDirty()) {
if (MessageDialog.openQuestion(getShell(), "Activity Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
editorPart.doSave(new NullProgressMonitor());
}
ActivityLaunchShortcut launchShortcut = new ActivityLaunchShortcut();
launchShortcut.launch(new StructuredSelection(activity), ILaunchManager.DEBUG_MODE);
} else if (element instanceof ExternalEvent) {
ExternalEvent externalEvent = (ExternalEvent) element;
ExternalEventLaunchShortcut launchShortcut = new ExternalEventLaunchShortcut();
launchShortcut.launch(new StructuredSelection(externalEvent), ILaunchManager.DEBUG_MODE);
} else if (element instanceof WorkflowProject || element instanceof ServerSettings) {
ServerSettings serverSettings;
if (element instanceof WorkflowProject) {
WorkflowProject workflowProject = (WorkflowProject) element;
serverSettings = workflowProject.getServerSettings();
} else {
serverSettings = (ServerSettings) element;
}
serverSettings.setDebug(true);
if (serverSettings.getDebugPort() == 0)
serverSettings.setDebugPort(8500);
run(serverSettings);
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method runApplies.
// top-level run action
public boolean runApplies(IStructuredSelection selection) {
if (selection.size() > 1) {
Boolean legacy = null;
WorkflowPackage testPkg = null;
for (Object o : selection.toArray()) {
if (!(o instanceof AutomatedTestCase))
return false;
// make sure they're all in the same package or legacy suite
AutomatedTestCase testCase = (AutomatedTestCase) o;
if (legacy == null)
legacy = testCase.isLegacy();
if (legacy.booleanValue() != testCase.isLegacy())
return false;
if (!testCase.isLegacy()) {
if (testPkg == null)
testPkg = testCase.getPackage();
if (!testPkg.equals(testCase.getPackage()))
return false;
}
}
WorkflowProject workflowProject = ((AutomatedTestCase) selection.getFirstElement()).getProject();
if (!workflowProject.isRemote())
return true;
return workflowProject.isUserAuthorizedInAnyGroup(UserRoleVO.PROCESS_EXECUTION);
}
if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
return false;
WorkflowElement workflowElement = (WorkflowElement) selection.getFirstElement();
if (workflowElement instanceof Report)
return true;
if (workflowElement instanceof Page)
return true;
if (workflowElement instanceof Template && ((Template) workflowElement).getLanguage().equals(RuleSetVO.VELOCITY))
return true;
if (workflowElement instanceof WorkflowProcess || workflowElement instanceof ExternalEvent) {
if (!workflowElement.getProject().isRemote())
return true;
return workflowElement.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION);
}
if (workflowElement instanceof AutomatedTestSuite || workflowElement instanceof AutomatedTestCase) {
if (workflowElement.getProject() == null)
return false;
if (workflowElement.getProject().isRemote()) {
if (!workflowElement.getProject().isUserAuthorizedInAnyGroup(UserRoleVO.PROCESS_EXECUTION))
return false;
WorkflowPackage pkg = workflowElement.getPackage();
if (pkg != null && !pkg.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION))
return false;
}
try {
AutomatedTestView testView = (AutomatedTestView) MdwPlugin.getActivePage().showView("mdw.views.launch.automatedTest");
return !testView.isLocked();
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Menu", workflowElement.getProject());
}
}
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method debugApplies.
public boolean debugApplies(IStructuredSelection selection) {
if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
return false;
WorkflowElement workflowElement = (WorkflowElement) selection.getFirstElement();
if (workflowElement instanceof AutomatedTestSuite || workflowElement instanceof AutomatedTestCase) {
WorkflowProject prj = workflowElement.getProject();
if (prj == null || !prj.checkRequiredVersion(6, 0) || !prj.isUserAuthorizedInAnyGroup(UserRoleVO.PROCESS_EXECUTION))
return false;
WorkflowPackage pkg = workflowElement.getPackage();
if (pkg != null && !pkg.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION))
return false;
try {
AutomatedTestView testView = (AutomatedTestView) MdwPlugin.getActivePage().showView("mdw.views.launch.automatedTest");
return !testView.isLocked();
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Menu", workflowElement.getProject());
}
}
if (workflowElement instanceof WorkflowProcess || workflowElement instanceof ExternalEvent)
return !MdwPlugin.isRcp() && workflowElement.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION);
else
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createImportActionGroup.
private ActionGroup createImportActionGroup() {
importMenu = new MenuManager("Import", MdwPlugin.getImageDescriptor("icons/import.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
importMenu.removeAll();
IStructuredSelection selection = getSelection();
WorkflowElement element = (WorkflowElement) selection.getFirstElement();
if (!importMenuApplies(selection))
return;
if (importProjectApplies())
importMenu.add(importProjectAction);
if (importPackageApplies(selection))
importMenu.add(importPackageAction);
if (importVcsApplies(selection))
importMenu.add(importVcsAction);
if (importProcessApplies(selection)) {
if (element instanceof WorkflowProcess) {
importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.process.version");
importProcessAction.setText("New Process Version...");
} else {
importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.process");
importProcessAction.setText(PROCESS_DOT);
}
importMenu.add(importProcessAction);
}
if (importWorkflowAssetApplies(selection)) {
if (element instanceof WorkflowAsset) {
WorkflowAsset asset = (WorkflowAsset) element;
// menu item text and icon are dynamic
importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.asset.version");
importWorkflowAssetAction.setText("New " + asset.getTitle() + " Version...");
importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICONS + asset.getIcon()));
} else {
importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.asset");
importWorkflowAssetAction.setText("Asset...");
importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICON_DOC_GIF));
}
importMenu.add(importWorkflowAssetAction);
}
if (importAttributesApplies(selection)) {
List<IAction> importAttrsActions = getImportAttributeActions(selection);
if (!importAttrsActions.isEmpty()) {
MenuManager attributesMenu = new MenuManager("Attributes", MdwPlugin.getImageDescriptor("icons/attribute.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import.attributes");
attributesMenu.removeAll();
for (IAction action : importAttrsActions) attributesMenu.add(action);
importMenu.add(attributesMenu);
}
}
if (importTaskTemplateApplies(selection))
importMenu.add(importTaskTemplateAction);
importMenu.add(new Separator(OTHER));
IWorkbenchAction otherAction = ActionFactory.IMPORT.create(getViewSite().getWorkbenchWindow());
otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.other");
otherAction.setText(OTHER_DOT);
importMenu.add(otherAction);
}
};
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createOpenInstanceAction.
private IAction createOpenInstanceAction() {
IAction action = new Action() {
@Override
public void run() {
if (openInstanceApplies(getSelection())) {
WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
try {
Long procInstId = null;
if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
java.io.File resultsFile = expectedResult.getActualResultFile();
TestFile testFile = new TestFile(null, resultsFile.getPath());
testFile.load();
TestFileLine line1 = testFile.getLines().get(0);
procInstId = new Long(line1.getWord(3));
}
if (procInstId == null) {
MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
return;
}
ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
Long processId = procInst.getProcessId();
ProcessVO procVO = project.getProcess(processId).getProcessVO();
if (procVO == null)
PluginMessages.uiError("Unable to locate process: " + processId, OPEN_PROCESS_INSTANCE, project);
WorkflowProcess instance = new WorkflowProcess(project, procVO);
instance.setProcessInstance(procInst);
actionHandler.open(instance);
} catch (Exception ex) {
PluginMessages.uiError(ex, OPEN_PROCESS_INSTANCE, project);
}
}
}
};
action.setText(OPEN_PROCESS_INSTANCE);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
action.setImageDescriptor(imageDesc);
return action;
}
Aggregations