use of org.mule.runtime.config.internal.model.ApplicationModel.MULE_PROPERTY_IDENTIFIER in project mule by mulesoft.
the class PropertiesMapBeanDefinitionCreator method handleRequest.
@Override
boolean handleRequest(CreateBeanDefinitionRequest createBeanDefinitionRequest) {
SpringComponentModel componentModel = createBeanDefinitionRequest.getComponentModel();
if (componentModel.getIdentifier().equals(MULE_PROPERTIES_IDENTIFIER) || componentModel.getIdentifier().equals(MULE_PROPERTY_IDENTIFIER)) {
ManagedMap<Object, Object> managedMap;
if (componentModel.getIdentifier().equals(MULE_PROPERTIES_IDENTIFIER)) {
managedMap = createManagedMapFromEntries(componentModel);
} else {
managedMap = new ManagedMap<>();
ComponentModel parentComponentModel = componentModel.getParent();
parentComponentModel.getInnerComponents().stream().filter(childComponentModel -> childComponentModel.getIdentifier().equals(MULE_PROPERTY_IDENTIFIER)).forEach(childComponentModel -> {
processAndAddMapProperty(childComponentModel, managedMap);
});
}
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.rootBeanDefinition(HashMap.class);
componentModel.setBeanDefinition(beanDefinitionBuilder.addConstructorArgValue(managedMap).getBeanDefinition());
return true;
}
return false;
}
Aggregations