use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue in project kie-wb-common by kiegroup.
the class ScriptTypeListTypeSerializerTest method testParse.
@Test
public void testParse() {
String serializedValue = buildExpectedSerialization(currentScripts);
ScriptTypeListValue result = serializer.parse(serializedValue);
assertEquals(scriptTypeList, result);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue in project kie-wb-common by kiegroup.
the class ScriptTypeListTypeSerializerTest method testParseWithNoValues.
@Test
public void testParseWithNoValues() {
ScriptTypeListValue result = serializer.parse("[]");
assertEquals(new ScriptTypeListValue(), result);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue in project kie-wb-common by kiegroup.
the class ScriptTypeListFieldEditorPresenterTest method testSetValueWhenNotEmpty.
@Test
public void testSetValueWhenNotEmpty() {
ScriptTypeValue value = mock(ScriptTypeValue.class);
editor.setValue(new ScriptTypeListValue().addValue(value));
verify(scriptTypePresenter, times(1)).setValue(value);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method applyOnExitActions.
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);
}
}
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue in project kie-wb-common by kiegroup.
the class Scripts method setOnEntryAction.
public static void setOnEntryAction(FlowElement flowElement, OnEntryAction onEntryAction) {
ScriptTypeListValue value = onEntryAction.getValue();
for (ScriptTypeValue scriptTypeValue : value.getValues()) {
if (scriptTypeValue.getScript() == null && scriptTypeValue.getScript().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);
}
}
Aggregations