use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.
the class ParameterizedCombo method assetFromAttr.
public WorkflowAsset assetFromAttr(String attrValue) {
if (attrValue == null || attrValue.isEmpty() || attrValue.startsWith("$")) {
return null;
}
int slashIdx = attrValue.indexOf('/');
if (slashIdx <= 0) {
// prefer asset in same package
WorkflowAsset pkgDoc = workflowElement.getPackage().getAsset(attrValue);
if (pkgDoc != null)
return pkgDoc;
else
return workflowProject.getAsset(attrValue);
} else {
String pkgName = attrValue.substring(0, slashIdx);
WorkflowPackage pkg = workflowProject.getPackage(pkgName);
if (pkg == null)
return null;
else
return pkg.getAsset(attrValue.substring(slashIdx + 1));
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method clear.
/**
* Forces refresh from the database or file system.
*/
public void clear() {
if (isLoaded()) {
List<WorkflowAsset> assets = archivedPackageFolder == null ? getTopLevelWorkflowAssets() : getAllWorkflowAssets();
for (WorkflowAsset asset : assets) WorkflowAssetFactory.deRegisterAsset(asset);
List<IFile> listenersToRemove = new ArrayList<>();
if (artifactResourceListeners != null) {
for (IFile file : artifactResourceListeners.keySet()) listenersToRemove.add(file);
for (IFile file : listenersToRemove) removeArtifactResourceListener(artifactResourceListeners.get(file));
}
}
if (designerProxy != null && designerProxy.isStubServerRunning())
designerProxy.toggleStubServer();
designerProxy = null;
topLevelPackages = null;
topLevelUserVisiblePackages = null;
archivedPackageFolder = null;
archivedUserVisiblePackagesFolder = null;
legacyTestSuite = null;
artifactResourceListeners = null;
assetsNotForCurrentUser = null;
shutdownNoticeChecks();
scriptLibrariesSaved = false;
pageletTabs = null;
warn = false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findWorkflowAssets.
/**
* Returns the workflow assets belonging to a package version.
*/
private List<WorkflowAsset> findWorkflowAssets(WorkflowPackage aPackage) {
List<WorkflowAsset> assets = new ArrayList<>();
if (!aPackage.isDefaultPackage()) {
for (RuleSetVO ruleSetVO : getDataAccess().getRuleSets(false)) {
if (aPackage.getPackageVO().containsRuleSet(ruleSetVO.getId())) {
WorkflowAsset asset = WorkflowAssetFactory.createAsset(ruleSetVO, aPackage);
if (asset != null) {
asset.addElementChangeListener(this);
if (!asset.isArchived())
WorkflowAssetFactory.registerAsset(asset);
assets.add(asset);
if (RuleSetVO.PAGELET.equals(asset.getLanguage()) && // BAM's
!BAM_PAGELET.equals(asset.getName())) // special
{
if (pageletTabs == null)
pageletTabs = new ArrayList<>();
String name = asset.getName();
if (name.indexOf('.') >= 0)
name = name.substring(0, name.lastIndexOf('.'));
PageletTab pageletTab = new PageletTab(name, designerProxy.loadWorkflowAsset(asset).getContent());
// check if already added from a later package
// version
boolean already = false;
for (PageletTab existing : pageletTabs) {
if (existing.getId().equals(pageletTab.getId())) {
already = true;
break;
}
}
if (!already)
pageletTabs.add(pageletTab);
}
}
}
}
Collections.sort(assets);
}
return assets;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method getAsset.
public WorkflowAsset getAsset(String name) {
int slash = name.indexOf('/');
if (slash > 0)
return getAsset(name.substring(0, slash), name.substring(slash + 1));
WorkflowAsset latest = null;
for (WorkflowAsset asset : getAllWorkflowAssets()) {
if (asset.getName().equals(name) && (latest == null || latest.getVersion() < asset.getVersion()))
latest = asset;
}
return latest;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method viewSource.
public void viewSource(String className) {
if (setJava()) {
// dynamic java is preferred
int lastDot = className.lastIndexOf('.');
WorkflowAsset dynamicJava = null;
if (lastDot == -1) {
dynamicJava = getAsset(className);
if (dynamicJava == null)
dynamicJava = getAsset(className + ".java");
} else {
String pkg = className.substring(0, lastDot);
String cls = className.substring(lastDot + 1);
dynamicJava = getAsset(pkg, cls);
if (dynamicJava == null)
dynamicJava = getAsset(pkg, cls + ".java");
}
if (dynamicJava != null) {
dynamicJava.openFile(new NullProgressMonitor());
return;
}
IJavaProject wfSourceJavaProject = getSourceJavaProject();
try {
Path sourcePath = new Path(className.replace('.', '/') + ".java");
IJavaElement javaElement = wfSourceJavaProject.findElement(sourcePath);
if (javaElement == null) {
PluginMessages.uiMessage("Unable to find source code for '" + className + "'.", "View Source", this, PluginMessages.INFO_MESSAGE);
return;
}
JavaUI.openInEditor(javaElement);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Open Java Source", this);
}
}
}
Aggregations