Search in sources :

Example 16 with ScriptTypeValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue in project kie-wb-common by kiegroup.

the class ScriptTypeTypeSerializerTest method setUp.

@Before
public void setUp() {
    serializer = new ScriptTypeTypeSerializer();
    scriptType = new ScriptTypeValue(LANGUAGE, SCRIPT);
}
Also used : ScriptTypeTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue) Before(org.junit.Before)

Example 17 with ScriptTypeValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue in project kie-wb-common by kiegroup.

the class ScriptTypeFieldEditorPresenter method onChange.

protected void onChange() {
    ScriptTypeValue oldValue = value;
    value = copy(oldValue, true);
    value.setScript(view.getScript());
    value.setLanguage(view.getLanguage());
    notifyChange(oldValue, value);
}
Also used : ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 18 with ScriptTypeValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue in project kie-wb-common by kiegroup.

the class ScriptTypeFieldEditorPresenterTest method testOnScriptChange.

@Test
public void testOnScriptChange() {
    ScriptTypeValue oldValue = new ScriptTypeValue();
    editor.setValue(oldValue);
    when(view.getLanguage()).thenReturn(LANGUAGE);
    when(view.getScript()).thenReturn(SCRIPT);
    editor.onScriptChange();
    verifyValueChange(oldValue, new ScriptTypeValue(LANGUAGE, SCRIPT));
}
Also used : ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue) Test(org.junit.Test) FieldEditorPresenterBaseTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.FieldEditorPresenterBaseTest)

Example 19 with ScriptTypeValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue in project kie-wb-common by kiegroup.

the class ScriptTypeListFieldEditorPresenterTest method testOnChange.

@Test
public void testOnChange() {
    ScriptTypeListValue oldValue = mock(ScriptTypeListValue.class);
    ScriptTypeValue oldScriptTypeValue = mock(ScriptTypeValue.class);
    ScriptTypeValue newScriptTypeValue = mock(ScriptTypeValue.class);
    editor.setValue(oldValue);
    editor.addChangeHandler(changeHandler);
    editor.onValueChange(oldScriptTypeValue, newScriptTypeValue);
    changeHandler.onValueChange(oldValue, new ScriptTypeListValue().addValue(newScriptTypeValue));
}
Also used : ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue) Test(org.junit.Test)

Example 20 with ScriptTypeValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method getOnExitActions.

public ScriptTypeListValue getOnExitActions(final List<ExtensionAttributeValue> extensionValues) {
    final ScriptTypeListValue onExitActions = new ScriptTypeListValue();
    ScriptTypeValue onExitAction;
    if (extensionValues != null && !extensionValues.isEmpty()) {
        for (ExtensionAttributeValue extattrval : extensionValues) {
            FeatureMap extensionElements = extattrval.getValue();
            @SuppressWarnings("unchecked") List<OnExitScriptType> onExitExtensions = (List<OnExitScriptType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, true);
            for (OnExitScriptType onExitScript : onExitExtensions) {
                onExitAction = getOnExitAction(onExitScript);
                if (onExitAction.getScript() != null && !onExitAction.getScript().isEmpty()) {
                    onExitActions.addValue(onExitAction);
                }
            }
        }
    }
    return onExitActions;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) OnExitScriptType(org.jboss.drools.OnExitScriptType) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Aggregations

ScriptTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)23 ScriptTypeListValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue)9 Test (org.junit.Test)7 FormalExpression (org.eclipse.bpmn2.FormalExpression)6 ScriptTypeTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer)6 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)4 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)4 OnEntryScriptType (org.jboss.drools.OnEntryScriptType)3 OnExitScriptType (org.jboss.drools.OnExitScriptType)3 FieldEditorPresenterBaseTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.FieldEditorPresenterBaseTest)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)2 ScriptTypeListTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer)2 Before (org.junit.Before)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 BasePropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.BasePropertyWriter)1 SequenceFlowPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SequenceFlowPropertyWriter)1 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)1