Commit ba1ea33e authored by Aurelien Pupier's avatar Aurelien Pupier Committed by azara
Browse files

BS-14249: support generation of script for initial value of Business

Variable of types containing composition multiple
parent 161bb5fa
...@@ -92,7 +92,7 @@ public class RelationFieldToContractInputMappingTest { ...@@ -92,7 +92,7 @@ public class RelationFieldToContractInputMappingTest {
final MappingOperationScriptBuilder scriptBuilder = fieldToContractInputMapping.getScriptBuilder(aBusinessData().withName("myEmployee").build()); final MappingOperationScriptBuilder scriptBuilder = fieldToContractInputMapping.getScriptBuilder(aBusinessData().withName("myEmployee").build());
assertThat(scriptBuilder.toScript()).isEqualTo( assertThat(scriptBuilder.toScript(false)).isEqualTo(
"def addressVar = myEmployee.address == null ? new Address() : myEmployee.address" + System.lineSeparator() "def addressVar = myEmployee.address == null ? new Address() : myEmployee.address" + System.lineSeparator()
+ "addressVar.street = employee.address.street" + System.lineSeparator() + "addressVar.street = employee.address.street" + System.lineSeparator()
+ "return addressVar"); + "return addressVar");
......
...@@ -55,15 +55,12 @@ public class RootContractInputGenerator { ...@@ -55,15 +55,12 @@ public class RootContractInputGenerator {
this.expressionBuilder = expressionBuilder; this.expressionBuilder = expressionBuilder;
} }
public void buildForInstanciation(final BusinessObjectData data) throws OperationCreationException {
build(data, true);
}
public void build(final BusinessObjectData data) throws OperationCreationException { public void build(final BusinessObjectData data) throws OperationCreationException {
build(data, false); build(data, false);
} }
private void build(final BusinessObjectData data, final boolean isOnPool) throws OperationCreationException { public void build(final BusinessObjectData data, final boolean isOnPool) throws OperationCreationException {
contractInput = ProcessFactory.eINSTANCE.createContractInput(); contractInput = ProcessFactory.eINSTANCE.createContractInput();
contractInput.setName(rootContractInputName); contractInput.setName(rootContractInputName);
contractInput.setType(ContractInputType.COMPLEX); contractInput.setType(ContractInputType.COMPLEX);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment