use of io.syndesis.connector.odata.ODataCreateEntityComponent in project syndesis by syndesisio.
the class ODataCreateEntityConnectorAutoConfiguration method postConstructODataCreateEntityComponent.
@PostConstruct
public void postConstructODataCreateEntityComponent() {
Map<String, Object> parameters = new HashMap<>();
for (Map.Entry<String, ODataCreateEntityConnectorConfigurationCommon> entry : configuration.getConfigurations().entrySet()) {
parameters.clear();
ODataCreateEntityComponent connector = new ODataCreateEntityComponent(entry.getKey());
connector.setCamelContext(camelContext);
try {
IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false);
CamelPropertiesHelper.setCamelProperties(camelContext, connector, parameters, false);
connector.setOptions(parameters);
if (ObjectHelper.isNotEmpty(customizers)) {
for (ConnectorCustomizer<ODataCreateEntityComponent> customizer : customizers) {
boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.odata-create-entity." + entry.getKey() + ".customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.odata-create-entity." + entry.getKey() + ".customizer");
if (useCustomizer) {
LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer);
customizer.customize(connector);
}
}
}
camelContext.addComponent(entry.getKey(), connector);
} catch (Exception e) {
throw new BeanCreationException(entry.getKey(), e.getMessage(), e);
}
}
}
use of io.syndesis.connector.odata.ODataCreateEntityComponent in project syndesis by syndesisio.
the class ODataCreateEntityConnectorAutoConfiguration method configureODataCreateEntityComponent.
@Lazy
@Bean(name = "odata-create-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataCreateEntityComponent configureODataCreateEntityComponent() throws Exception {
ODataCreateEntityComponent connector = new ODataCreateEntityComponent();
connector.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
CamelPropertiesHelper.setCamelProperties(camelContext, connector, parameters, false);
connector.setOptions(parameters);
if (ObjectHelper.isNotEmpty(customizers)) {
for (ConnectorCustomizer<ODataCreateEntityComponent> customizer : customizers) {
boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.odata-create-entity.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.odata-create-entity.customizer");
if (useCustomizer) {
LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer);
customizer.customize(connector);
}
}
}
return connector;
}
Aggregations