use of org.mule.runtime.api.meta.model.nested.NestableElementModel in project mule by mulesoft.
the class ConfigurationBasedElementModelFactory method populateComposableElements.
private void populateComposableElements(ComposableModel model, DslElementSyntax elementDsl, DslElementModel.Builder builder, ComponentConfiguration configuration) {
configuration.getNestedComponents().forEach(nestedComponentConfig -> {
DslElementModel nestedElement = createIdentifiedElement(nestedComponentConfig);
if (nestedElement != null) {
builder.containing(nestedElement);
} else {
model.getNestedComponents().stream().filter(nestedModel -> nestedModel instanceof NestedRouteModel).filter(nestedModel -> elementDsl.getContainedElement(nestedModel.getName()).map(nestedDsl -> getIdentifier(nestedDsl).map(id -> nestedComponentConfig.getIdentifier().equals(id)).orElse(false)).orElse(false)).findFirst().ifPresent(nestedModel -> {
DslElementSyntax routeDsl = elementDsl.getContainedElement(nestedModel.getName()).get();
DslElementModel.Builder<? extends NestableElementModel> routeBuilder = DslElementModel.<NestableElementModel>builder().withModel(nestedModel).withDsl(routeDsl).withConfig(nestedComponentConfig).isExplicitInDsl(true);
populateParameterizedElements((ParameterizedModel) nestedModel, routeDsl, routeBuilder, nestedComponentConfig);
nestedComponentConfig.getNestedComponents().forEach(routeElement -> {
DslElementModel nestableElementModel = createIdentifiedElement(routeElement);
if (nestableElementModel != null) {
routeBuilder.containing(nestableElementModel);
}
});
builder.containing(routeBuilder.build());
});
}
});
}
Aggregations