Search in sources :

Example 21 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 getOnEntryActions.

public ScriptTypeListValue getOnEntryActions(final List<ExtensionAttributeValue> extensionValues) {
    final ScriptTypeListValue onEntryActions = new ScriptTypeListValue();
    ScriptTypeValue onEntryAction;
    if (extensionValues != null && !extensionValues.isEmpty()) {
        for (ExtensionAttributeValue extattrval : extensionValues) {
            FeatureMap extensionElements = extattrval.getValue();
            @SuppressWarnings("unchecked") List<OnEntryScriptType> onEntryExtensions = (List<OnEntryScriptType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, true);
            for (OnEntryScriptType onEntryScript : onEntryExtensions) {
                onEntryAction = getOnEntryAction(onEntryScript);
                if (onEntryAction.getScript() != null && !onEntryAction.getScript().isEmpty()) {
                    onEntryActions.addValue(onEntryAction);
                }
            }
        }
    }
    return onEntryActions;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) OnEntryScriptType(org.jboss.drools.OnEntryScriptType) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 22 with ScriptTypeValue

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

the class HashCodeAndEqualityTest method testMultipleInstanceSubprocessEquals.

@Test
public void testMultipleInstanceSubprocessEquals() {
    final String MULTIPLE_INSTANCE_COLLECTION_INPUT = "multiple Instance collection input";
    final String MULTIPLE_INSTANCE_COLLECTION_OUTPUT = "multiple Instance collection output";
    final String MULTIPLE_INSTANCE_DATA_INPUT = "multiple Instance collection input";
    final String MULTIPLE_INSTANCE_DATA_OUTPUT = "multiple Instance collection output";
    final String MULTIPLE_INSTANCE_COMPLETION_CONDITION = "multiple Instance completion condition";
    final String OTHER_VALUE = "other value";
    final ScriptTypeListValue ON_ENTRY_ACTION = new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""));
    final ScriptTypeListValue ON_EXIT_ACTION = new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""));
    final Boolean IS_ASYNC = true;
    final MultipleInstanceSubprocessTaskExecutionSet A_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet B_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet C_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(OTHER_VALUE), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet D_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(OTHER_VALUE), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet E_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(OTHER_VALUE), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet F_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(OTHER_VALUE), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet G_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(OTHER_VALUE), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet H_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("other language", ""))), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet I_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("other language", ""))), new MITrigger("true"), new IsAsync(IS_ASYNC));
    final MultipleInstanceSubprocessTaskExecutionSet J_EXECUTION_SET = new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceCollectionInput(MULTIPLE_INSTANCE_COLLECTION_INPUT), new MultipleInstanceCollectionOutput(MULTIPLE_INSTANCE_COLLECTION_OUTPUT), new MultipleInstanceDataInput(MULTIPLE_INSTANCE_DATA_INPUT), new MultipleInstanceDataOutput(MULTIPLE_INSTANCE_DATA_OUTPUT), new MultipleInstanceCompletionCondition(MULTIPLE_INSTANCE_COMPLETION_CONDITION), new OnEntryAction(ON_ENTRY_ACTION), new OnExitAction(ON_EXIT_ACTION), new MITrigger("true"), new IsAsync(false));
    final String PROCESS_DATA = "some value";
    final ProcessData A_PROCESS_DATA = new ProcessData(new ProcessVariables(PROCESS_DATA));
    final ProcessData B_PROCESS_DATA = new ProcessData(new ProcessVariables("Other value"));
    MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess a = builder.build();
    a.setExecutionSet(A_EXECUTION_SET);
    a.setProcessData(A_PROCESS_DATA);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess b = builder.build();
    b.setExecutionSet(B_EXECUTION_SET);
    b.setProcessData(A_PROCESS_DATA);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess c = builder.build();
    c.setExecutionSet(C_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess d = builder.build();
    d.setExecutionSet(D_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess e = builder.build();
    e.setExecutionSet(E_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess f = builder.build();
    f.setExecutionSet(F_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess g = builder.build();
    g.setExecutionSet(G_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess h = builder.build();
    g.setExecutionSet(H_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess i = builder.build();
    g.setExecutionSet(I_EXECUTION_SET);
    builder = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess j = builder.build();
    g.setExecutionSet(J_EXECUTION_SET);
    assertEquals(a, a);
    assertEquals(a, b);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    assertNotEquals(a, e);
    assertNotEquals(a, f);
    assertNotEquals(a, g);
    assertNotEquals(a, h);
    assertNotEquals(a, i);
    assertNotEquals(a, j);
    assertNotEquals(a, 19);
    assertNotEquals(a, null);
    a.setExecutionSet(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    a.setExecutionSet(A_EXECUTION_SET);
    assertEquals(a, b);
    a.setProcessData(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    a.setExecutionSet(A_EXECUTION_SET);
    a.setProcessData(A_PROCESS_DATA);
    assertEquals(a, b);
    a.setProcessData(B_PROCESS_DATA);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder builderMessage = new MultipleInstanceSubprocess.MultipleInstanceSubprocessBuilder();
    MultipleInstanceSubprocess k = builderMessage.build();
    assertNotEquals(a, k);
}
Also used : MultipleInstanceCollectionOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput) OnExitAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction) MITrigger(org.kie.workbench.common.stunner.bpmn.definition.property.task.MITrigger) OnEntryAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction) MultipleInstanceSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceSubprocessTaskExecutionSet) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) MultipleInstanceCompletionCondition(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCompletionCondition) MultipleInstanceCollectionInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput) MultipleInstanceDataInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataInput) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue) MultipleInstanceDataOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataOutput) Test(org.junit.Test)

Example 23 with ScriptTypeValue

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

the class AdHocSubProcessPropertyWriter method setAdHocCompletionCondition.

public void setAdHocCompletionCondition(AdHocCompletionCondition adHocCompletionCondition) {
    FormalExpression e = bpmn2.createFormalExpression();
    ScriptTypeValue s = adHocCompletionCondition.getValue();
    e.setLanguage(Scripts.scriptLanguageToUri(s.getLanguage()));
    e.setBody(asCData(s.getScript()));
    process.setCompletionCondition(e);
}
Also used : FormalExpression(org.eclipse.bpmn2.FormalExpression) 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