public EmbeddedSubprocessExecutionSet() { this(new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new IsAsync()); }
public String serialize(final ScriptTypeListValue value) { final StringBuilder serializedValue = new StringBuilder(); ScriptTypeTypeSerializer scriptTypeSerializer = new ScriptTypeTypeSerializer(); if (value.isEmpty()) { serializedValue.append("[]"); } else { value.getValues().forEach(scriptTypeValue -> { if (serializedValue.length() > 0) { serializedValue.append(DELIMITER); } serializedValue.append(scriptTypeSerializer.serialize(scriptTypeValue)); }); } return serializedValue.toString(); }
protected void onValueChange(ScriptTypeValue oldScriptValue, ScriptTypeValue newScriptValue) { ScriptTypeListValue oldValue = value; value = new ScriptTypeListValue(); value.getValues().add(newScriptValue); notifyChange(oldValue, value); }
public ScriptTypeListValue parse(final String value) { return new ScriptTypeListValue(parseScriptTokens(value)); }
private ScriptTypeListValue mockList(int count) { ArrayList<ScriptTypeValue> values = new ArrayList<>(); for (int i = 0; i < count; i++) { values.add(new ScriptTypeValue(LANGUAGE + i, SCRIPT + i)); } return new ScriptTypeListValue(values); } }
public ServiceTaskExecutionSet() { this(new TaskName("Service Task"), new IsAsync(), new AdHocAutostart(), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", "")))); }
@Test public void testOnEntryActionEqualsAndHashCode() { TestCaseBuilder.newTestCase() .addTrueCase(new OnEntryAction(), new OnEntryAction()) .addTrueCase(new OnEntryAction(new ScriptTypeListValue()), new OnEntryAction(new ScriptTypeListValue())) .test(); }
public static void setOnExitAction(FlowElement flowElement, OnExitAction onExitAction) { ScriptTypeListValue value = onExitAction.getValue(); for (ScriptTypeValue scriptTypeValue : value.getValues()) { String scriptText = scriptTypeValue.getScript(); if (scriptText == null || scriptText.isEmpty()) { continue; } OnExitScriptType script = droolsFactory.createOnExitScriptType(); script.setScript(asCData(scriptText)); String scriptLanguage = Scripts.scriptLanguageToUri(scriptTypeValue.getLanguage()); script.setScriptFormat(scriptLanguage); addExtensionValue(flowElement, DOCUMENT_ROOT__ON_EXIT_SCRIPT, script); } }
protected void applyOnExitActions(BaseElement element, Map<String, String> properties) { if (properties.get("onexitactions") != null && properties.get("onexitactions").length() > 0) { ScriptTypeListValue onExitActions = new ScriptTypeListTypeSerializer().parse(properties.get("onexitactions")); if (!onExitActions.isEmpty()) { ScriptTypeValue onExitAction = onExitActions.getValues().get(0); if (onExitAction.getScript() != null && !onExitAction.getScript().isEmpty()) { OnExitScriptType onExitScript = DroolsFactory.eINSTANCE.createOnExitScriptType(); onExitScript.setScript(wrapInCDATABlock(onExitAction.getScript())); String scriptLanguage = Utils.getScriptLanguageFormat(onExitAction.getLanguage()); if (scriptLanguage == null) { //default to java scriptLanguage = "http://www.java.com/java"; } onExitScript.setScriptFormat(scriptLanguage); if (element.getExtensionValues() == null || element.getExtensionValues().size() < 1) { ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue(); element.getExtensionValues().add(extensionElement); } FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry( (Internal) DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, onExitScript); element.getExtensionValues().get(0).getValue().add(extensionElementEntry); } } } }
public ReusableSubprocessTaskExecutionSet() { this(new CalledElement(), new Independent(), new WaitForCompletion(), new IsAsync(), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", "")))); }
@Test public void testOnExitActionEqualsAndHashCode() { TestCaseBuilder.newTestCase() .addTrueCase(new OnExitAction(), new OnExitAction()) .addTrueCase(new OnExitAction(new ScriptTypeListValue()), new OnExitAction(new ScriptTypeListValue())) .test(); }
public static void setOnEntryAction(FlowElement flowElement, OnEntryAction onEntryAction) { ScriptTypeListValue value = onEntryAction.getValue(); for (ScriptTypeValue scriptTypeValue : value.getValues()) { String scriptText = scriptTypeValue.getScript(); if (scriptText == null || scriptText.isEmpty()) { continue; } OnEntryScriptType script = droolsFactory.createOnEntryScriptType(); script.setScript(asCData(scriptTypeValue.getScript())); String scriptLanguage = Scripts.scriptLanguageToUri(scriptTypeValue.getLanguage()); script.setScriptFormat(scriptLanguage); addExtensionValue(flowElement, DOCUMENT_ROOT__ON_ENTRY_SCRIPT, script); } }
protected void applyOnEntryActions(BaseElement element, Map<String, String> properties) { if (properties.get("onentryactions") != null && properties.get("onentryactions").length() > 0) { ScriptTypeListValue onEntryActions = new ScriptTypeListTypeSerializer().parse(properties.get("onentryactions")); if (!onEntryActions.isEmpty()) { ScriptTypeValue onEntryAction = onEntryActions.getValues().get(0); if (onEntryAction.getScript() != null && !onEntryAction.getScript().isEmpty()) { OnEntryScriptType onEntryScript = DroolsFactory.eINSTANCE.createOnEntryScriptType(); onEntryScript.setScript(wrapInCDATABlock(onEntryAction.getScript())); String scriptLanguage = Utils.getScriptLanguageFormat(onEntryAction.getLanguage()); if (scriptLanguage == null) { //default to java scriptLanguage = "http://www.java.com/java"; } onEntryScript.setScriptFormat(scriptLanguage); if (element.getExtensionValues() == null || element.getExtensionValues().size() < 1) { ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue(); element.getExtensionValues().add(extensionElement); } FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry( (Internal) DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, onEntryScript); element.getExtensionValues().get(0).getValue().add(extensionElementEntry); } } } }
public AdHocSubprocessTaskExecutionSet() { this(new AdHocCompletionCondition(new ScriptTypeValue("mvel", "autocomplete")), new AdHocOrdering("Sequential"), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", "")))); }
@Test public void testSerializeWithNoValues() { String serializedValue = serializer.serialize(new ScriptTypeListValue()); assertEquals("[]", serializedValue); }