use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createMdwHubAction.
private IAction createMdwHubAction() {
IAction action = new Action() {
@Override
public void run() {
if (webLaunchApplies(getSelection())) {
if (getSelection().getFirstElement() instanceof WorkflowProject) {
WorkflowProject project = (WorkflowProject) getSelection().getFirstElement();
WebLaunchActions.getLaunchAction(project, WebApp.MdwHub).launch(project);
} else if (getSelection().getFirstElement() instanceof WorkflowPackage) {
WorkflowPackage packageVersion = (WorkflowPackage) getSelection().getFirstElement();
WebLaunchActions.getLaunchAction(packageVersion.getProject(), WebApp.MdwHub).launch(packageVersion);
}
}
}
};
WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(null, WebApp.MdwHub);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "launch.hub");
action.setText(launchAction.getLabel());
action.setImageDescriptor(launchAction.getImageDescriptor());
return action;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createUnlockAction.
private IAction createUnlockAction() {
IAction action = new Action() {
@Override
public void run() {
if (unlockApplies(getSelection())) {
WorkflowProject project = (WorkflowProject) getSelection().getFirstElement();
WorkflowProjectManager.getInstance().makeLocal(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
MessageDialog.openInformation(getViewSite().getShell(), "Remote Project Unlocked", project.getName() + " has been unlocked. Please close any open assets and refresh.");
}
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "unlock");
action.setText("Unlock");
return action;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method getExportAttributeActions.
private List<IAction> getExportAttributeActions(IStructuredSelection selection) {
List<IAction> exportAttributesActions = new ArrayList<>();
if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
// bam
IAction action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(WorkAttributeConstant.BAM_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.monitoring");
action.setText("Monitoring...");
exportAttributesActions.add(action);
// simulation
action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(WorkAttributeConstant.SIMULATION_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.simulation");
action.setText("Simulation...");
exportAttributesActions.add(action);
// pagelet-driven attributes
WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
List<PageletTab> pageletTabs = project.getPageletTabs();
if (pageletTabs != null) {
for (PageletTab pageletTab : pageletTabs) {
final String prefix = pageletTab.getOverrideAttributePrefix();
action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(prefix, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.attributes." + prefix);
action.setText(pageletTab.getLabel() + "...");
exportAttributesActions.add(action);
}
}
}
return exportAttributesActions;
}
Aggregations