use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findActivityImplementors.
/**
* Returns the activity implementors events belonging to a package version.
*/
public List<ActivityImpl> findActivityImplementors(WorkflowPackage aPackage) {
List<ActivityImpl> impls = new ArrayList<>();
List<ActivityImplementorVO> implVOs = getDataAccess().getActivityImplementors(false);
for (ActivityImplementorVO implVO : implVOs) {
if ((aPackage.isDefaultPackage() && !isPackaged(implVO)) || (!aPackage.isDefaultPackage() && aPackage.getPackageVO().containsActivityImpl(implVO.getImplementorClassName()))) {
ActivityImpl activityImpl = activityImpls.get(implVO.getImplementorClassName());
if (activityImpl == null) {
activityImpl = new ActivityImpl(implVO, aPackage);
activityImpl.addElementChangeListener(this);
activityImpls.put(implVO.getImplementorClassName(), activityImpl);
}
if (!impls.contains(activityImpl))
impls.add(activityImpl);
}
}
Collections.sort(impls);
return impls;
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method getGenericActivityImpl.
/**
* Returns the default implementor as a generic representation.
*/
public ActivityImpl getGenericActivityImpl(String implClass) {
ActivityImplementorVO implVO = dataAccess.getDesignerDataModel().getNodeMetaInfo().getDefaultActivity();
if (implVO == null) {
// even base impl cannot be loaded
implVO = new ActivityImplementorVO();
implVO.setLabel(implClass);
implVO.setAttributeDescription("<PAGELET/>");
}
implVO.setImplementorClassName(implClass);
ActivityImpl impl = new ActivityImpl(implVO, project.getDefaultPackage());
impl.setProject(project);
return impl;
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method upgradeAssets.
/**
* Replace obsolete implementors, and other assets (see help doc
* upgradeAssetsDuringImport.html).
*/
public void upgradeAssets(WorkflowPackage packageVersion) throws DataAccessException, IOException {
boolean packageUpdated = false;
PackageVO packageVO = packageVersion.getPackageVO();
List<ProcessVO> processVOs = packageVO.getProcesses();
// update activity implementors
List<ProcessVO> newProcs = new ArrayList<>();
for (ProcessVO processVO : processVOs) {
boolean processUpdated = false;
ProcessVO newProc = dataAccess.getDesignerDataAccess().getProcess(processVO.getProcessId(), processVO);
List<ActivityVO> activities = newProc.getActivities();
if (activities != null) {
for (ActivityVO activityVO : activities) {
if (new ActivityUpgrader(activityVO).doUpgrade())
processUpdated = true;
}
if (newProc.getSubProcesses() != null) {
for (ProcessVO subproc : newProc.getSubProcesses()) {
if (subproc.getActivities() != null) {
for (ActivityVO subprocActivity : subproc.getActivities()) {
if (new ActivityUpgrader(subprocActivity).doUpgrade())
processUpdated = true;
}
}
}
}
}
// update variable types
List<VariableVO> variables = newProc.getVariables();
if (variables != null) {
for (VariableVO variableVO : variables) {
String variableType = variableVO.getVariableType();
String updatedVariableType = Compatibility.getVariableType(variableType);
if (!updatedVariableType.equals(variableType)) {
variableVO.setVariableType(updatedVariableType);
processUpdated = true;
}
}
}
if (processUpdated) {
int processVersion = newProc.getVersion();
processVersion++;
newProc.setVersion(processVersion);
packageUpdated = true;
}
newProcs.add(newProc);
}
// Set old activity implementors in the package to hidden
List<ActivityImplementorVO> activityImplementorVOs = packageVO.getImplementors();
for (ActivityImplementorVO activityImplementorVO : activityImplementorVOs) {
String activityImplClassName = activityImplementorVO.getImplementorClassName();
if (Compatibility.isOldImplementor(activityImplClassName)) {
activityImplementorVO.setHidden(true);
packageUpdated = true;
}
}
if (packageUpdated) {
// update with new assets for saving
packageVO.setProcesses(newProcs);
List<RuleSetVO> newRuleSets = new ArrayList<>();
for (RuleSetVO ruleSet : packageVO.getRuleSets()) newRuleSets.add(getDesignerDataAccess().getRuleSet(ruleSet.getId()));
packageVO.setRuleSets(newRuleSets);
int version = packageVersion.getVersion();
version++;
packageVersion.setVersion(version);
// avoid forcing version
packageVersion.setExported(false);
// increment on save
packageVersion.syncProcesses();
getDesignerDataAccess().savePackage(packageVO, ProcessPersister.PersistType.IMPORT);
}
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class ActivitySection method drawWidgets.
@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
activity = (Activity) selection;
// id text field
idPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_TEXT);
idPropertyEditor.setLabel("ID");
idPropertyEditor.setWidth(150);
idPropertyEditor.setReadOnly(true);
idPropertyEditor.render(composite);
// logical id text field
logicalIdPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_TEXT);
logicalIdPropertyEditor.setLabel("Logical ID");
logicalIdPropertyEditor.setWidth(150);
logicalIdPropertyEditor.setReadOnly(true);
logicalIdPropertyEditor.render(composite);
// name text field
namePropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_TEXT);
namePropertyEditor.setLabel("Label");
namePropertyEditor.setMultiLine(true);
namePropertyEditor.setWidth(475);
namePropertyEditor.setHeight(30);
namePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
activity.setName((String) newValue);
}
});
namePropertyEditor.render(composite);
// implementor combo
implementorPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_COMBO);
implementorPropertyEditor.setLabel("Implementor");
implementorPropertyEditor.setWidth(475);
List<String> implementorNames = new ArrayList<>();
for (ActivityImplementorVO implVo : getDataAccess().getActivityImplementors(false)) implementorNames.add(implVo.getImplementorClassName());
implementorPropertyEditor.setValueOptions(implementorNames);
implementorPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
activity.setActivityImpl(activity.getProject().getActivityImpl((String) newValue));
}
});
implementorPropertyEditor.render(composite);
((Combo) implementorPropertyEditor.getWidget()).setVisibleItemCount(10);
// implementor link
linkPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_LINK);
linkPropertyEditor.setLabel("Open Implementor Source Code");
linkPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
activity.getProject().viewSource(activity.getActivityImpl().getImplClassName());
}
});
linkPropertyEditor.render(composite);
// description text area
descriptionPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_TEXT);
descriptionPropertyEditor.setLabel("Description");
descriptionPropertyEditor.setWidth(475);
descriptionPropertyEditor.setHeight(70);
descriptionPropertyEditor.setMultiLine(true);
descriptionPropertyEditor.setTextLimit(1000);
descriptionPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
activity.setDescription((String) newValue);
}
});
descriptionPropertyEditor.render(composite);
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class ToolboxWrapper method handleSelection.
private void handleSelection(int mouseX, int mouseY) {
int idx = getFlowchartPage().nodepane.nodeAt(mouseX, mouseY);
if (idx != -1) {
Object obj = getDesignerProxy().getNodeMetaInfo().get(idx);
if (obj instanceof ActivityImplementorVO) {
ActivityImplementorVO activityImplVO = (ActivityImplementorVO) obj;
toolboxSelection = getProject().getActivityImpl(activityImplVO.getImplementorClassName());
if (!toolboxSelection.isUserAuthorized(UserRoleVO.ASSET_DESIGN))
toolboxSelection.setReadOnly(true);
}
}
toolboxSelection.addDirtyStateListener(this);
}
Aggregations