Select Git revision
InterRelationship.editpolicy
receiveDefinition.mustache 5.32 KiB
{{#typeIsList}}
{{#IndexBasedListAccess}}
private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
for (int index = 0; index < getNum{{entityName}}(); index++) {
if (get{{entityName}}(index).get{{idTokenName}}().equals(topic)) {
return index;
}
}
return -1;
}
{{/IndexBasedListAccess}}
{{/typeIsList}}
/**
* Connects the receive endpoint {{entityName}}.
{{#typeIsList}}{{#isWithAdd}}
* New values are appended to the end of the list.
{{/isWithAdd}}{{/typeIsList}}
* @param {{connectParameterName}} string describing protocol and path as an URI
{{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}
* @param index index of node in list to connect (the list is expected to have enough elements)
{{/isWithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}
* @return true if connect was successful, false otherwise
* @throws java.io.IOException if connect failed
*/
public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterName}}{{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}, int index{{/isWithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}) throws java.io.IOException {
java.util.function.BiConsumer<String, byte[]> consumer = (topic, message) -> {
{{> mappingApplication}}
{{#loggingEnabledForReads}}
System.out.println("[Receive] " + {{connectParameterName}} + " -> {{entityName}} = " + {{lastResult}});
{{/loggingEnabledForReads}}
{{#isTypeEndpointDefinition}}
{{lastResult}}.treeResolveAll();
{{#typeIsList}}
{{^IndexBasedListAccess}}
{{#isWithAdd}}
{{getterMethod}}().addAll({{lastResult}});
{{/isWithAdd}}
{{^isWithAdd}}
set{{entityName}}({{lastResult}});
{{/isWithAdd}}
{{/IndexBasedListAccess}}
{{#IndexBasedListAccess}}
{{lastResult}}.set{{idTokenName}}(topic);
{{#isWithAdd}}
{{getterMethod}}().add({{lastResult}});
{{/isWithAdd}}
{{^isWithAdd}}
set{{entityName}}({{lastResult}}, index);
{{/isWithAdd}}
{{/IndexBasedListAccess}}
{{/typeIsList}}
{{^typeIsList}}
set{{entityName}}({{lastResult}});
{{/typeIsList}}
{{/isTypeEndpointDefinition}}
{{^isTypeEndpointDefinition}}
set{{entityName}}({{lastResult}});
{{/isTypeEndpointDefinition}}
};
return {{internalConnectMethod}}({{connectParameterName}}, consumer);
}
{{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}
/**
* Connects the receive endpoint {{entityName}} using a "wildcard" URI (if supported by the chosen protocol).
* @param {{connectParameterName}} string describing protocol and path as an URI
* @return true if connect was successful, false otherwise
* @throws java.io.IOException if connect failed
*/