use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class BamEventComposer method setElement.
public void setElement(WorkflowElement element) {
this.element = element;
WorkflowAsset bamPageletAsset = getElement().getPackage().getAsset(WorkflowProject.BAM_PAGELET);
if (bamPageletAsset == null) {
// try baseline package
WorkflowPackage baselinePackage = element.getProject().getPackage(PackageVO.BASELINE_PACKAGE_NAME);
if (baselinePackage != null)
bamPageletAsset = baselinePackage.getAsset(WorkflowProject.BAM_PAGELET);
}
bamPagelet = null;
try {
if (bamPageletAsset == null) {
bamPagelet = PAGELETDocument.Factory.parse(BamEventComposer.DEFAULT_BAM_PAGELET).getPAGELET();
} else {
if (!bamPageletAsset.isLoaded())
bamPageletAsset.load();
bamPagelet = PAGELETDocument.Factory.parse(bamPageletAsset.getContent()).getPAGELET();
}
} catch (XmlException ex) {
PluginMessages.uiError(ex, "BAM Pagelet", element.getProject());
}
createBamDataTable();
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerContentProvider method handleElementChange.
private void handleElementChange(ElementChangeEvent ece) {
if (ece.getChangeType().equals(ChangeType.ELEMENT_CREATE)) {
Object parent = getParent(ece.getElement());
if (parent == null) {
treeViewer.refresh(true);
ece.getElement().addElementChangeListener(this);
} else {
if (parent instanceof WorkflowPackage) {
try {
((WorkflowPackage) parent).getFolder().refreshLocal(IResource.DEPTH_ONE, null);
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
treeViewer.refresh(parent, true);
}
treeViewer.expandToLevel(ece.getElement(), 0);
treeViewer.setSelection(ece.getElement());
} else if (ece.getChangeType().equals(ChangeType.ELEMENT_DELETE)) {
Object parent = getParent(ece.getElement());
if (parent != null) {
if (ece.getElement() instanceof ActivityImpl)
// impl can be associated with
treeViewer.refresh();
else
// multiple packages
treeViewer.refresh(parent, true);
} else {
// must be a workflowProject
ece.getElement().removeElementChangeListener(this);
treeViewer.refresh();
}
} else if (ece.getChangeType().equals(ChangeType.RENAME)) {
treeViewer.refresh(ece.getElement(), true);
treeViewer.getControl().forceFocus();
} else if (ece.getChangeType().equals(ChangeType.VERSION_CHANGE)) {
treeViewer.refresh(ece.getElement(), true);
if (ece.getElement() instanceof WorkflowPackage)
treeViewer.refresh(ece.getElement().getProject().getArchivedUserVisiblePackagesFolder(), true);
} else if (ece.getChangeType().equals(ChangeType.LABEL_CHANGE)) {
treeViewer.update(ece.getElement(), null);
} else if (ece.getChangeType().equals(ChangeType.SETTINGS_CHANGE)) {
// only applies for workflow projects
if (ece.getElement() instanceof WorkflowProject) {
WorkflowProject workflowProject = (WorkflowProject) ece.getElement();
if (ece.getNewValue() instanceof JdbcDataSource) {
treeViewer.collapseToLevel(workflowProject, TreeViewer.ALL_LEVELS);
treeViewer.refresh(workflowProject, true);
} else if (ece.getNewValue() == null) {
// general refresh
treeViewer.refresh(workflowProject, true);
}
} else {
treeViewer.refresh(ece.getElement(), true);
}
} else if (ece.getChangeType().equals(ChangeType.STATUS_CHANGE)) {
treeViewer.update(ece.getElement(), null);
if (ece.getElement() instanceof AutomatedTestCase) {
AutomatedTestCase testCase = (AutomatedTestCase) ece.getElement();
Object testResults;
if (testCase.isLegacy())
testResults = testCase.getLegacyExpectedResults();
else
testResults = testCase.getExpectedResults();
if (testResults != null)
treeViewer.refresh(testResults, true);
}
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerDropTarget method drop.
public boolean drop(String data, Object target, int operation) {
String elementInfo = data;
String[] elements = elementInfo.split("#");
if (target instanceof WorkflowElement && ((WorkflowElement) target).getPackage() != null) {
WorkflowPackage targetPackage = ((WorkflowElement) target).getPackage();
if (checkForDuplicates(targetPackage, elements))
return false;
for (String element : elements) {
if (element.startsWith("Process~")) {
if (!handleDropProcess(element.substring(8), targetPackage, operation))
return false;
} else if (element.startsWith("ExternalEvent~")) {
if (!handleDropExternalEvent(element.substring(14), targetPackage, operation))
return false;
} else if (element.startsWith("ActivityImpl~")) {
if (!handleDropActivityImpl(element.substring(14), targetPackage, operation))
return false;
} else if (element.startsWith("WorkflowAsset~")) {
if (!handleDropWorkflowAsset(element.substring(14), targetPackage, operation))
return false;
} else {
return false;
}
}
return true;
} else {
return false;
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerDropTarget method handleDropActivityImpl.
private boolean handleDropActivityImpl(String activityImplInfo, WorkflowPackage targetPackage, int operation) {
Long activityImplId = getActivityImplId(activityImplInfo);
WorkflowProject workflowProject = targetPackage.getProject();
WorkflowPackage sourcePackage = workflowProject.getPackage(getPackageName(activityImplInfo));
DesignerProxy designerProxy = workflowProject.getDesignerProxy();
if (operation == DND.DROP_COPY) {
if (!targetPackage.isDefaultPackage()) {
designerProxy.addActivityImplToPackage(activityImplId, targetPackage);
((TreeViewer) getViewer()).refresh(targetPackage, true);
return true;
}
return false;
} else if (operation == DND.DROP_MOVE) {
if (targetPackage.isDefaultPackage()) {
designerProxy.removeActivityImplFromPackage(activityImplId, sourcePackage);
} else {
designerProxy.addActivityImplToPackage(activityImplId, targetPackage);
if (RunnerStatus.SUCCESS.equals(designerProxy.getRunnerStatus()))
designerProxy.removeActivityImplFromPackage(activityImplId, sourcePackage);
}
((TreeViewer) getViewer()).refresh(targetPackage.getProject(), true);
return true;
} else {
return false;
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class SearchPage method determineScope.
protected void determineScope() {
if (searchPattern == null)
searchPattern = "";
if (scopedProjects == null) {
// determine scoped projects from selection
scopedProjects = new ArrayList<WorkflowProject>();
if (searchPageContainer.getSelectedScope() == ISearchPageContainer.SELECTED_PROJECTS_SCOPE) {
for (String projectName : searchPageContainer.getSelectedProjectNames()) {
IProject project = MdwPlugin.getWorkspaceRoot().getProject(projectName);
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
if (workflowProject != null && !scopedProjects.contains(workflowProject))
scopedProjects.add(workflowProject);
}
} else if (searchPageContainer.getSelectedScope() == ISearchPageContainer.SELECTION_SCOPE) {
if (searchPageContainer.getSelection() instanceof WorkflowProject)
scopedProjects.add((WorkflowProject) searchPageContainer.getSelection());
if (searchPageContainer.getSelection() instanceof WorkflowPackage)
selectedPackage = (WorkflowPackage) searchPageContainer.getSelection();
} else if (searchPageContainer.getSelectedScope() == ISearchPageContainer.WORKING_SET_SCOPE) {
for (IWorkingSet workingSet : searchPageContainer.getSelectedWorkingSets()) {
for (IAdaptable element : workingSet.getElements()) {
if (element instanceof IProject || element instanceof IJavaProject) {
IProject project = element instanceof IJavaProject ? ((IJavaProject) element).getProject() : (IProject) element;
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
if (workflowProject != null && !scopedProjects.contains(workflowProject))
scopedProjects.add(workflowProject);
}
}
}
} else {
scopedProjects.addAll(WorkflowProjectManager.getInstance().getWorkflowProjects());
}
}
}
Aggregations