use of com.centurylink.mdw.plugin.designer.model.Report 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;
}
Aggregations