Search in sources :

Example 11 with ScriptTypeListValue

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

the class ScriptTypeListTypeSerializerTest method testSerializeWithNoValues.

@Test
public void testSerializeWithNoValues() {
    String serializedValue = serializer.serialize(new ScriptTypeListValue());
    assertEquals("[]", serializedValue);
}
Also used : ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) Test(org.junit.Test)

Example 12 with ScriptTypeListValue

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

the class ScriptTypeListFieldEditorPresenterTest method testSetValueWhenEmpty.

@Test
public void testSetValueWhenEmpty() {
    editor.setValue(new ScriptTypeListValue());
    verify(scriptTypePresenter, times(1)).setValue(null);
}
Also used : ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) Test(org.junit.Test)

Example 13 with ScriptTypeListValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue 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 14 with ScriptTypeListValue

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

the class Bpmn2JsonMarshaller method marshallCallActivity.

protected void marshallCallActivity(CallActivity callActivity, BPMNPlane plane, JsonGenerator generator, float xOffset, float yOffset, Map<String, Object> flowElementProperties) throws JsonGenerationException, IOException {
    Map<String, Object> properties = new LinkedHashMap<String, Object>(flowElementProperties);
    Iterator<FeatureMap.Entry> iter = callActivity.getAnyAttribute().iterator();
    while (iter.hasNext()) {
        FeatureMap.Entry entry = iter.next();
        if (entry.getEStructuralFeature().getName().equals("independent")) {
            properties.put(INDEPENDENT, entry.getValue());
        }
        if (entry.getEStructuralFeature().getName().equals("waitForCompletion")) {
            properties.put(WAITFORCOMPLETION, entry.getValue());
        }
    }
    if (callActivity.getCalledElement() != null && callActivity.getCalledElement().length() > 0) {
        properties.put(CALLEDELEMENT, callActivity.getCalledElement());
    }
    // custom async
    String customAsyncMetaData = Utils.getMetaDataValue(callActivity.getExtensionValues(), "customAsync");
    String customAsync = (customAsyncMetaData != null && customAsyncMetaData.length() > 0) ? customAsyncMetaData : "false";
    properties.put(ISASYNC, customAsync);
    // data inputs
    String datainputset = marshallDataInputSet(callActivity, properties);
    // data outputs
    String dataoutputset = marshallDataOutputSet(callActivity, properties);
    // assignments
    StringBuilder associationBuff = new StringBuilder();
    List<DataInputAssociation> inputAssociations = callActivity.getDataInputAssociations();
    List<DataOutputAssociation> outputAssociations = callActivity.getDataOutputAssociations();
    marshallDataInputAssociations(associationBuff, inputAssociations);
    marshallDataOutputAssociations(associationBuff, outputAssociations);
    String assignmentString = associationBuff.toString();
    if (assignmentString.endsWith(",")) {
        assignmentString = assignmentString.substring(0, assignmentString.length() - 1);
    }
    properties.put("assignments", assignmentString);
    setAssignmentsInfoProperty(null, datainputset, null, dataoutputset, assignmentString, properties);
    // on-entry and on-exit actions
    ScriptTypeListValue onEntryActions = getOnEntryActions(callActivity.getExtensionValues());
    ScriptTypeListValue onExitActions = getOnExitActions(callActivity.getExtensionValues());
    if (!onEntryActions.isEmpty()) {
        properties.put(ONENTRYACTIONS, new ScriptTypeListTypeSerializer().serialize(onEntryActions));
    }
    if (!onExitActions.isEmpty()) {
        properties.put(ONEXITACTIONS, new ScriptTypeListTypeSerializer().serialize(onExitActions));
    }
    // simulation properties
    setSimulationProperties(callActivity.getId(), properties);
    marshallNode(callActivity, properties, "ReusableSubprocess", plane, generator, xOffset, yOffset);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Entry(java.util.Map.Entry) DataObject(org.eclipse.bpmn2.DataObject) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) ScriptTypeListTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue)

Example 15 with ScriptTypeListValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue 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

ScriptTypeListValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue)18 ScriptTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)9 Test (org.junit.Test)7 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)6 ScriptTypeListTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer)6 ArrayList (java.util.ArrayList)4 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)4 LinkedHashMap (java.util.LinkedHashMap)3 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)3 DataObject (org.eclipse.bpmn2.DataObject)3 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)3 OnEntryScriptType (org.jboss.drools.OnEntryScriptType)3 OnExitScriptType (org.jboss.drools.OnExitScriptType)3 List (java.util.List)2 Entry (java.util.Map.Entry)2 DataInput (org.eclipse.bpmn2.DataInput)2 DataOutput (org.eclipse.bpmn2.DataOutput)2 FormalExpression (org.eclipse.bpmn2.FormalExpression)2 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)2 MultiInstanceLoopCharacteristics (org.eclipse.bpmn2.MultiInstanceLoopCharacteristics)2