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);
}
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);
}
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));
}
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);
}
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;
}
Aggregations