use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findArchivedPackages.
/**
* Returns all top-level archived (non-latest) packages, populated with
* their descendants which include the appropriate process versions. Uses
* 10% of progressMonitor.
*/
private Folder findArchivedPackages(ProgressMonitor progressMonitor, boolean visiblePkgsOnly) {
CodeTimer timer = new CodeTimer("findAuthorizedArchivedPackages()");
if (progressMonitor != null)
progressMonitor.subTask("Organizing packages");
Folder archivedPkgFolder = new Folder("Archive", this);
archivedPkgFolder.setIcon("archive.gif");
List<WorkflowPackage> topLevelArchivedPackageList = new ArrayList<>();
List<WorkflowPackage> allArchivedPackages = new ArrayList<>();
for (PackageVO packageVO : getDataAccess().getPackages(false)) {
if (isShowDefaultPackage() || !packageVO.isDefaultPackage()) {
WorkflowPackage potentialArchived = new WorkflowPackage(this, packageVO);
if (!getTopLevelPackages().contains(potentialArchived)) {
potentialArchived.setArchived(true);
potentialArchived.setProcesses(findProcesses(potentialArchived));
potentialArchived.setAssets(findWorkflowAssets(potentialArchived));
potentialArchived.setActivityImpls(findActivityImplementors(potentialArchived));
potentialArchived.setExternalEvents(findExternalEvents(potentialArchived));
potentialArchived.setTaskTemplates(findTaskTemplates(potentialArchived));
allArchivedPackages.add(potentialArchived);
}
}
}
// organize the package version hierarchy
Map<String, WorkflowPackage> topLevelArchivedPackages = new HashMap<>();
for (WorkflowPackage archivedPackage : allArchivedPackages) {
WorkflowPackage topLevel = topLevelArchivedPackages.get(archivedPackage.getName());
if ((!visiblePkgsOnly || (visiblePkgsOnly && archivedPackage.isVisible())) && (topLevel == null || archivedPackage.getPackageVO().getVersion() > topLevel.getPackageVO().getVersion()))
topLevelArchivedPackages.put(archivedPackage.getName(), archivedPackage);
}
for (WorkflowPackage topLevelArchivedPackage : topLevelArchivedPackages.values()) {
for (WorkflowPackage archivedPackage : allArchivedPackages) {
if (topLevelArchivedPackage.getName().equals(archivedPackage.getName()) && (!visiblePkgsOnly || (visiblePkgsOnly && archivedPackage.isVisible()))) {
if (topLevelArchivedPackage.equals(archivedPackage)) {
// clone top-level process for first child
WorkflowPackage firstChild = new WorkflowPackage(topLevelArchivedPackage);
firstChild.setArchived(true);
firstChild.setTopLevelVersion(topLevelArchivedPackage);
firstChild.setProcesses(topLevelArchivedPackage.getProcesses());
firstChild.setAssets(topLevelArchivedPackage.getAssets());
firstChild.setActivityImpls(topLevelArchivedPackage.getActivityImpls());
firstChild.setExternalEvents(topLevelArchivedPackage.getExternalEvents());
firstChild.setTaskTemplates(topLevelArchivedPackage.getTaskTemplates());
topLevelArchivedPackage.addDescendantPackageVersion(firstChild);
} else {
archivedPackage.setTopLevelVersion(topLevelArchivedPackage);
topLevelArchivedPackage.addDescendantPackageVersion(archivedPackage);
}
}
}
topLevelArchivedPackageList.add(topLevelArchivedPackage);
topLevelArchivedPackage.setArchivedFolder(archivedPkgFolder);
}
Collections.sort(topLevelArchivedPackageList);
if (isShowDefaultPackage()) {
// add unpackaged (default package)
PackageVO defaultPackageVO = new PackageVO();
defaultPackageVO.setPackageId(Long.valueOf(0));
defaultPackageVO.setPackageName(PackageVO.DEFAULT_PACKAGE_NAME);
archivedDefaultPackage = new WorkflowPackage(this, defaultPackageVO);
archivedDefaultPackage.setProcesses(findUnpackagedProcesses());
archivedDefaultPackage.setChildFolders(findUnpackagedAssetFolders());
archivedDefaultPackage.setArchived(true);
topLevelArchivedPackageList.add(0, archivedDefaultPackage);
}
List<WorkflowElement> children = new ArrayList<>();
children.addAll(topLevelArchivedPackageList);
archivedPkgFolder.setChildren(children);
if (progressMonitor != null)
progressMonitor.progress(10);
timer.stopAndLog();
return archivedPkgFolder;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method newPackageVersion.
public void newPackageVersion(WorkflowPackage newPkg, WorkflowPackage prevPkg) {
if (isFilePersist()) {
// refresh prevPkg since it's fast
try {
PackageVO pkg = getDesignerDataAccess().loadPackage(prevPkg.getId(), false);
if (// when incrementing by saving non-process
pkg == null)
// pkgs
return;
prevPkg.setPackageVO(pkg);
prevPkg.setProcesses(findProcesses(prevPkg));
prevPkg.setExternalEvents(findExternalEvents(prevPkg));
prevPkg.setActivityImpls(findActivityImplementors(prevPkg));
prevPkg.setAssets(findWorkflowAssets(prevPkg));
prevPkg.setTaskTemplates(findTaskTemplates(prevPkg));
// may have been called in response to vcs save new process
// version
prevPkg.syncProcesses();
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
// contents
for (WorkflowElement we : getArchivedUserVisiblePackagesFolder().getChildren()) {
WorkflowPackage pv = (WorkflowPackage) we;
if (pv.getName().equals(prevPkg.getName())) {
List<WorkflowPackage> descendants = pv.getDescendantPackageVersions();
if (descendants == null) {
descendants = new ArrayList<>();
pv.setDescendantPackageVersions(descendants);
}
descendants.add(prevPkg);
prevPkg.setTopLevelVersion(pv);
}
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method getAllExternalEvents.
/**
* Returns all external events regardless of packaging and archive status.
*/
/**
* Returns all event handlers, regardless of packaging.
*/
public List<ExternalEvent> getAllExternalEvents() {
List<ExternalEvent> allHandlers = new ArrayList<>();
for (WorkflowPackage pkg : getTopLevelPackages()) {
for (ExternalEvent handler : pkg.getExternalEvents()) {
if (!allHandlers.contains(handler))
allHandlers.add(handler);
}
}
for (WorkflowElement topLevelArchived : getArchivedPackageFolder().getChildren()) {
if (topLevelArchived instanceof WorkflowPackage) {
WorkflowPackage topLevelPkg = (WorkflowPackage) topLevelArchived;
if (topLevelPkg.hasDescendantPackageVersions()) {
for (WorkflowPackage pkg : topLevelPkg.getDescendantPackageVersions()) {
for (ExternalEvent handler : pkg.getExternalEvents()) {
if (!allHandlers.contains(handler))
allHandlers.add(handler);
}
}
}
}
}
Collections.sort(allHandlers);
return allHandlers;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class SearchResultsPage method setInput.
public void setInput(ISearchResult result, Object uiState) {
if (result == null)
return;
searchResults = (SearchResults) result;
List<WorkflowElement> elements = new ArrayList<WorkflowElement>();
for (WorkflowElement workflowElement : searchResults.getMatchingElements()) elements.add(workflowElement);
tableEditor.setValue(elements);
tableEditor.getTable().setSortColumn(tableEditor.getTable().getColumn(0));
tableEditor.getTable().setSortDirection(SWT.UP);
tableEditor.getTableViewer().setComparator(getViewerComparator(tableEditor.getColumnSpecs().get(0)));
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ImportAssetPage method createControls.
@Override
protected void createControls(Composite composite, int ncol) {
super.createControls(composite, ncol);
createCommentsControls(composite, ncol);
ImportExportWizard wizard = (ImportExportWizard) getWizard();
WorkflowElement we = wizard.getElement();
if (we != null && !we.getProject().isFilePersist())
createLockControls(composite, ncol);
}
Aggregations