Search in sources :

Example 11 with ActivityImplementorVO

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;
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) ArrayList(java.util.ArrayList)

Example 12 with ActivityImplementorVO

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;
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl)

Example 13 with ActivityImplementorVO

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);
    }
}
Also used : PackageVO(com.centurylink.mdw.model.value.process.PackageVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ArrayList(java.util.ArrayList) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 14 with ActivityImplementorVO

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);
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) Combo(org.eclipse.swt.widgets.Combo)

Example 15 with ActivityImplementorVO

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);
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO)

Aggregations

ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)24 ArrayList (java.util.ArrayList)12 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)9 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)6 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)6 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)5 Point (java.awt.Point)5 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)4 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)4 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)3 ActionCancelledException (com.centurylink.mdw.common.utilities.timer.ActionCancelledException)2 Selectable (com.centurylink.mdw.designer.display.Selectable)2 ImportItem (com.centurylink.mdw.designer.utils.ImportItem)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)2 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)2 Combo (org.eclipse.swt.widgets.Combo)2 ProcessExporter (com.centurylink.mdw.dataaccess.ProcessExporter)1 ProcessPersister (com.centurylink.mdw.dataaccess.ProcessPersister)1 IconFactory (com.centurylink.mdw.designer.icons.IconFactory)1