Search in sources :

Example 1 with WorkflowAssetEditor

use of com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor in project mdw-designer by CenturyLinkCloud.

the class OsgiAdapterDesignSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    activity = (Activity) selection;
    interfaceSelector = new WorkflowAssetEditor(activity, WorkAttributeConstant.SERVICE_INTERFACE, getAssetTypes());
    interfaceSelector.setLabel("Service Interface");
    interfaceSelector.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activity.setAttribute(WorkAttributeConstant.SERVICE_INTERFACE, (String) newValue);
            methodDropdown.setValueOptions(getServiceMethodOptions());
        }
    });
    interfaceSelector.render(composite);
    methodDropdown = new PropertyEditor(activity, PropertyEditor.TYPE_COMBO);
    methodDropdown.setLabel("Method");
    methodDropdown.setWidth(277);
    methodDropdown.setValueOptions(getServiceMethodOptions());
    methodDropdown.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activity.setAttribute(WorkAttributeConstant.SERVICE_METHOD, (String) newValue);
            paramsTable.setValue(getParamsTableValue());
        }
    });
    methodDropdown.render(composite);
    resultDropdown = new PropertyEditor(activity, PropertyEditor.TYPE_COMBO);
    resultDropdown.setLabel("Result Variable");
    resultDropdown.setWidth(277);
    resultDropdown.setValueOptions(getResultVariableOptions());
    resultDropdown.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activity.setAttribute(WorkAttributeConstant.SERVICE_RESULT, (String) newValue);
        }
    });
    resultDropdown.render(composite);
    paramsTable = new TableEditor(activity, TableEditor.TYPE_TABLE);
    paramsTable.setColumnSpecs(getInputTableColumns());
    paramsTable.setColumnDelimiter('=');
    paramsTable.setLabel("Parameters");
    paramsTable.setAttributeName(WorkAttributeConstant.SERVICE_PARAMETERS);
    paramsTable.setHorizontalSpan(3);
    paramsTable.render(composite, false);
    helpLink = new PropertyEditor(activity, PropertyEditor.TYPE_LINK);
    helpLink.setLabel("OSGi Service Adapter Help");
    helpLink.render(composite);
}
Also used : WorkflowAssetEditor(com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 2 with WorkflowAssetEditor

use of com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor in project mdw-designer by CenturyLinkCloud.

the class ProcessDesignSection method drawWidgets.

@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
    process = (WorkflowProcess) selection;
    // sla timer field
    slaPropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_TIMER);
    slaPropertyEditor.setLabel("SLA");
    slaPropertyEditor.setAcceptedUnits(new Units[] { Units.Minutes, Units.Hours, Units.Days });
    slaPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            TimeInterval.TimerValue timerValue = (TimeInterval.TimerValue) newValue;
            process.setAttribute(WorkAttributeConstant.SLA, timerValue.getInterval());
            process.setAttribute(WorkAttributeConstant.SLA_UNIT, timerValue.getUnits().toString());
        }
    });
    slaPropertyEditor.render(composite);
    // synchronous checkbox
    syncPropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_CHECKBOX);
    syncPropertyEditor.setLabel("Service Process");
    syncPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            Boolean value = (Boolean) newValue;
            process.setSynchronous(value.booleanValue());
        }
    });
    syncPropertyEditor.render(composite);
    // performance level dropdown
    performancePropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_COMBO);
    performancePropertyEditor.setLabel("Performance Level");
    performancePropertyEditor.setValueOptions(getPerformanceLevelOptions());
    performancePropertyEditor.setWidth(400);
    performancePropertyEditor.setReadOnly(true);
    performancePropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            String sel = (String) newValue;
            process.setPerformanceLevel(Integer.parseInt(sel.substring(0, sel.indexOf('-') - 1).trim()));
        }
    });
    performancePropertyEditor.render(composite);
    // transition outcome radio
    transitionOutcomePropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_RADIO);
    transitionOutcomePropertyEditor.setLabel("Empty Transition Outcome");
    transitionOutcomePropertyEditor.setValueOptions(getTransitionOutcomeOptions());
    transitionOutcomePropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            process.setEmptyTransitionOutcome(((String) newValue).trim());
        }
    });
    transitionOutcomePropertyEditor.render(composite);
    // transition retry
    transitionRetryPropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_RADIO);
    transitionRetryPropertyEditor.setLabel("Transition Retry Default Limit");
    transitionRetryPropertyEditor.setValueOptions(getTransitionRetryOptions());
    transitionRetryPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            String sel = (String) newValue;
            process.setDefaultTransitionRetryLimit(Integer.parseInt(sel.substring(sel.indexOf('(') + 1, sel.indexOf(')'))));
        }
    });
    transitionRetryPropertyEditor.render(composite);
    // process config help link
    processConfigHelpLinkEditor = new PropertyEditor(process, PropertyEditor.TYPE_LINK);
    processConfigHelpLinkEditor.setLabel("Process Configuration Help");
    processConfigHelpLinkEditor.render(composite);
    // start page asset field
    startPagePropertyEditor = new WorkflowAssetEditor(process, WorkAttributeConstant.PROCESS_START_PAGE, Arrays.asList(new String[] { RuleSetVO.HTML, RuleSetVO.FACELET, RuleSetVO.JSX }));
    startPagePropertyEditor.setLabel("Custom Start Page");
    startPagePropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            process.setStartPage((String) newValue);
        }
    });
    startPagePropertyEditor.render(composite);
    // custom page config help link
    customPageHelpLinkEditor = new PropertyEditor(process, PropertyEditor.TYPE_LINK);
    customPageHelpLinkEditor.setLabel("Custom Page Help");
    customPageHelpLinkEditor.render(composite);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) WorkflowAssetEditor(com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor) TimeInterval(com.centurylink.mdw.plugin.designer.properties.editor.TimeInterval) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 3 with WorkflowAssetEditor

use of com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor in project mdw-designer by CenturyLinkCloud.

the class AssetDrivenActivityCustomSection method determineCustomAttr.

private CustomAttributeVO determineCustomAttr(Activity activity) {
    PropertyEditorList propEditorList = new PropertyEditorList(activity);
    for (PropertyEditor propertyEditor : propEditorList) {
        if (propertyEditor instanceof WorkflowAssetEditor) {
            WorkflowAssetEditor assetEditor = (WorkflowAssetEditor) propertyEditor;
            propertyEditor.setValue(activity);
            AssetLocator locator = new AssetLocator(assetEditor.getElement(), assetEditor.getLocatorType());
            WorkflowAsset asset = (WorkflowAsset) locator.assetFromAttr(activity.getAttribute(assetEditor.getAttributeName()));
            if (asset != null) {
                // language definitively determined by selected asset
                return activity.getProject().getDataAccess().getAssetCustomAttribute(asset.getLanguage());
            } else {
                // guess language based on presence of custom attributes
                for (String language : assetEditor.getAssetTypes()) {
                    CustomAttributeVO customAttr = activity.getProject().getDataAccess().getAssetCustomAttribute(language);
                    if (customAttr != null && !StringHelper.isEmpty(customAttr.getDefinition()))
                        return customAttr;
                }
            }
        }
    }
    return null;
}
Also used : PropertyEditorList(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList) WorkflowAssetEditor(com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor) AssetLocator(com.centurylink.mdw.plugin.designer.properties.editor.AssetLocator) CustomAttributeVO(com.centurylink.mdw.model.value.attribute.CustomAttributeVO) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 4 with WorkflowAssetEditor

use of com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor in project mdw-designer by CenturyLinkCloud.

the class AssetDrivenActivityCustomSection method select.

@Override
public boolean select(Object toTest) {
    if (toTest == null || !(toTest instanceof Activity))
        return false;
    Activity testActivity = (Activity) toTest;
    if (// manual tasks have asset-driven widgets
    testActivity.isManualTask())
        // but no custom section
        return false;
    if (// so do subprocess launch activities
    testActivity.isSubProcessInvoke())
        return false;
    if (testActivity.isForProcessInstance())
        return false;
    PropertyEditorList propEditorList = new PropertyEditorList((Activity) toTest);
    for (PropertyEditor propertyEditor : propEditorList) {
        // return true if any widgets are considered asset-driven
        if (propertyEditor instanceof WorkflowAssetEditor)
            return true;
    }
    return false;
}
Also used : PropertyEditorList(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList) WorkflowAssetEditor(com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor) Activity(com.centurylink.mdw.plugin.designer.model.Activity) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Aggregations

PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)4 WorkflowAssetEditor (com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor)4 PropertyEditorList (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList)2 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)2 CustomAttributeVO (com.centurylink.mdw.model.value.attribute.CustomAttributeVO)1 Activity (com.centurylink.mdw.plugin.designer.model.Activity)1 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)1 AssetLocator (com.centurylink.mdw.plugin.designer.properties.editor.AssetLocator)1 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)1 TimeInterval (com.centurylink.mdw.plugin.designer.properties.editor.TimeInterval)1