Commit 1db04982 authored by rbioteau's avatar rbioteau
Browse files

Comment append instruction in contract/data mapping generated scripts.

parent d8e0243b
......@@ -50,8 +50,8 @@ public class MultipleAggregationReferencePropertyInitializerTest {
assertThat(initialValue).isEqualTo("{" + System.lineSeparator()
+ "def employeeList = []" + System.lineSeparator()
+ "//Append existing emp" + System.lineSeparator()
+ "employeeList.addAll(emp)" + System.lineSeparator()
+ "//Uncomment line below to append existing emp" + System.lineSeparator()
+ "//employeeList.addAll(emp)" + System.lineSeparator()
+ "//For each item collected in multiple input" + System.lineSeparator()
+ "employees.each{" + System.lineSeparator()
+ "//Add aggregated Employee instance" + System.lineSeparator()
......
......@@ -38,8 +38,8 @@ public class MultipleCompositionReferencePropertyInitializerTest {
assertThat(initializer.getInitialValue()).isEqualTo("{" + System.lineSeparator()
+ "def addressList = []" + System.lineSeparator()
+ "//Append existing employee" + System.lineSeparator()
+ "addressList.addAll(employee)" + System.lineSeparator()
+ "//Uncomment line below to append existing employee" + System.lineSeparator()
+ "//addressList.addAll(employee)" + System.lineSeparator()
+ "//For each item collected in multiple input" + System.lineSeparator()
+ "employeeInput.addresses.each{" + System.lineSeparator()
+ "//Add a new composed Address instance" + System.lineSeparator()
......
......@@ -43,8 +43,8 @@ public class NewBusinessObjectListInitializerTest {
.in(aContractInput().withName("address").withType(ContractInputType.COMPLEX).multiple()
.in(aContractInput().withName("employee").withType(ContractInputType.COMPLEX))).build()));
assertThat(propertyInitializer.getInitialValue()).isEqualTo("def addressList = []" + System.lineSeparator()
+ "//Append existing myAddresses" + System.lineSeparator()
+ "addressList.addAll(myAddresses)" + System.lineSeparator()
+ "//Uncomment line below to append existing myAddresses" + System.lineSeparator()
+ "//addressList.addAll(myAddresses)" + System.lineSeparator()
+ "//For each item collected in multiple input" + System.lineSeparator()
+ "employee.address.each{" + System.lineSeparator()
+ "//Add a new composed Address instance" + System.lineSeparator()
......
......@@ -47,7 +47,7 @@ public class MultipleAggregationReferencePropertyInitializer extends MultipleBus
}
@Override
protected boolean shouldAppendExistingObjects() {
protected boolean canAppendExistingObjects() {
return multipleParentBusinessObject == null && !isOnPool;
}
......
......@@ -47,7 +47,7 @@ public class MultipleCompositionReferencePropertyInitializer extends NewBusiness
}
@Override
protected boolean shouldAppendExistingObjects() {
protected boolean canAppendExistingObjects() {
return parentBusinessObject == null && !isOnPool;
}
......
......@@ -47,7 +47,7 @@ public class NewBusinessObjectListInitializer extends AbstractBusinessObjectInit
scriptBuilder.append(" = ");
listConstructor(scriptBuilder, businessObject);
if (shouldAppendExistingObjects()) {
if (canAppendExistingObjects()) {
appendExistingBusinessObjects(scriptBuilder, businessObject);
}
......@@ -61,7 +61,7 @@ public class NewBusinessObjectListInitializer extends AbstractBusinessObjectInit
scriptBuilder.append(System.lineSeparator());
}
protected boolean shouldAppendExistingObjects() {
protected boolean canAppendExistingObjects() {
return contractInput.eContainer() != null && !isOnPool;
}
......@@ -122,7 +122,8 @@ public class NewBusinessObjectListInitializer extends AbstractBusinessObjectInit
}
protected void appendExistingBusinessObjects(final StringBuilder scriptBuilder, final BusinessObject businessObject) {
addCommentLine(scriptBuilder, String.format("Append existing %s", getLast(Splitter.on(".").split(refName))));
addCommentLine(scriptBuilder, String.format("Uncomment line below to append existing %s", getLast(Splitter.on(".").split(refName))));
scriptBuilder.append("//");
scriptBuilder.append(listVarName(businessObject));
scriptBuilder.append(".addAll(");
scriptBuilder.append(refName);
......
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