use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class CodeGenWizardPage method createWorkflowProjectControls.
protected void createWorkflowProjectControls(Composite parent, int ncol, SelectionListener selectionListener) {
new Label(parent, SWT.NONE).setText("Workflow Project:");
workflowProjectCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = ncol - 1;
gd.widthHint = 250;
workflowProjectCombo.setLayoutData(gd);
workflowProjectCombo.removeAll();
for (WorkflowProject project : WorkflowProjectManager.getInstance().getWorkflowProjects()) {
workflowProjectCombo.add(project.getSourceProjectName());
}
if (selectionListener != null)
workflowProjectCombo.addSelectionListener(selectionListener);
workflowProjectCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(workflowProjectCombo.getText());
getCodeElement().setProject(workflowProject);
enableCodeGenTypes();
workflowPackageCombo.removeAll();
if (getCodeElement().getProject() != null) {
for (WorkflowPackage packageVersion : getCodeElement().getProject().getTopLevelUserVisiblePackages()) workflowPackageCombo.add(packageVersion.getName());
}
}
});
if (getCodeElement().getProject() != null)
workflowProjectCombo.setText(getCodeElement().getProject().getName());
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class EventHandler method createExternalEvent.
public ExternalEvent createExternalEvent(String handlerString) {
ExternalEventVO externalEventVO = new ExternalEventVO();
if (eventName != null && eventName.length() > 0)
externalEventVO.setEventName(eventName);
else
externalEventVO.setEventName(messagePattern);
externalEventVO.setMessagePattern(messagePattern);
externalEventVO.setEventHandler(handlerString);
WorkflowPackage workflowPackage = getPackage() == null ? getProject().getDefaultPackage() : getPackage();
return new ExternalEvent(externalEventVO, workflowPackage);
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method getAllWorkflowAssets.
/**
* Returns all assets regardless of user access, packaging and archive
* status.
*/
public List<WorkflowAsset> getAllWorkflowAssets() {
List<WorkflowAsset> allAssets = new ArrayList<>();
allAssets.addAll(getTopLevelWorkflowAssets());
if (isShowDefaultPackage())
allAssets.addAll(getUnpackagedWorkflowAssets());
Map<String, WorkflowAsset> latestPackaged = new HashMap<>();
for (WorkflowAsset asset : allAssets) {
String key = (asset.isInDefaultPackage() ? "" : asset.getPackage().getName() + "/") + asset.getName() + asset.getVersionLabel();
latestPackaged.put(key, asset);
}
// get archived def docs if they don't match any non-archived version
for (WorkflowElement child : getArchivedPackageFolder().getChildren()) {
WorkflowPackage topLevelArchivedPackage = (WorkflowPackage) child;
if (topLevelArchivedPackage.getDescendantPackageVersions() != null) {
for (WorkflowPackage archivedPackage : topLevelArchivedPackage.getDescendantPackageVersions()) {
for (WorkflowAsset archivedAsset : archivedPackage.getAssets()) {
String key = (archivedAsset.isInDefaultPackage() ? "" : archivedAsset.getPackage().getName() + "/") + archivedAsset.getName() + archivedAsset.getVersionLabel();
WorkflowAsset curPkgMax = latestPackaged.get(key);
if (curPkgMax == null || archivedAsset.getPackage().getVersion() > curPkgMax.getPackage().getVersion())
latestPackaged.put(key, archivedAsset);
}
}
}
}
// reset list to include those added above
allAssets = new ArrayList<>(latestPackaged.values());
// account for assets not visible to user (cached separately)
if (assetsNotForCurrentUser == null) {
assetsNotForCurrentUser = new ArrayList<>();
for (RuleSetVO rs : getDataAccess().getAllRuleSets(false)) {
WorkflowAsset asset = WorkflowAssetFactory.createAsset(rs, findPackage(rs));
if (asset != null && !allAssets.contains(asset))
assetsNotForCurrentUser.add(asset);
}
}
allAssets.addAll(assetsNotForCurrentUser);
return allAssets;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method reloadActivityImplementors.
public void reloadActivityImplementors() {
getDataAccess().getActivityImplementors(true);
activityImpls.clear();
for (WorkflowPackage pkg : getTopLevelUserVisiblePackages()) pkg.setActivityImpls(findActivityImplementors(pkg));
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findUnpackagedProcesses.
/**
* Gets the top-level unpackaged version for all processes. Side effect: if
* a version is later than than in any package, it's added to the default
* package. The results are populated with their unpackaged descendant
* process versions.
*/
private List<WorkflowProcess> findUnpackagedProcesses() {
List<WorkflowProcess> unpackagedProcesses = new ArrayList<>();
for (ProcessVO processVO : getDataAccess().getProcesses(false)) {
ProcessVO topUnpackaged = null;
ProcessVO toCheck = processVO;
// if process version is later than that in any package,
// it belongs in the top-level default package
boolean toCheckIsLatest = true;
for (WorkflowPackage pkg : getTopLevelPackages()) {
if (pkg.isDefaultPackage())
continue;
WorkflowProcess packaged = pkg.getProcess(processVO.getProcessName());
if (packaged != null && packaged.getVersion() >= toCheck.getVersion()) {
toCheckIsLatest = false;
break;
}
}
if (toCheckIsLatest) {
WorkflowProcess pv = new WorkflowProcess(this, toCheck);
getDefaultPackage().addProcess(pv);
pv.addElementChangeListener(this);
toCheck = toCheck.getPrevVersion();
}
// add the hierarchy of old unpackaged processes
while (toCheck != null) {
if (!isPackaged(toCheck)) {
topUnpackaged = toCheck;
break;
}
toCheck = toCheck.getPrevVersion();
}
if (topUnpackaged != null) {
WorkflowProcess processVersion = new WorkflowProcess(this, topUnpackaged);
processVersion.setDescendantProcessVersions(getUnpackagedDescendantProcesses(processVersion));
unpackagedProcesses.add(processVersion);
}
}
Collections.sort(unpackagedProcesses);
return unpackagedProcesses;
}
Aggregations