use of eu.bcvsolutions.idm.core.api.repository.filter.DisabledFilterBuilder in project CzechIdMng by bcvsolutions.
the class DefaultFilterManager method getBuilder.
@SuppressWarnings("unchecked")
private <E extends BaseEntity> FilterBuilder<E, DataFilter> getBuilder(FilterKey key) {
if (!builders.hasPluginFor(key)) {
return null;
}
//
// default plugin by ordered definition
FilterBuilder<E, DataFilter> builder = (FilterBuilder<E, DataFilter>) builders.getPluginFor(key);
if (builder.isDisabled()) {
return new DisabledFilterBuilder<E>(builder);
}
String implName = builder.getConfigurationValue(ConfigurationService.PROPERTY_IMPLEMENTATION);
if (StringUtils.isEmpty(implName)) {
// return default builder - configuration is empty
return builder;
}
//
try {
// returns bean by name from filter configuration
return (FilterBuilder<E, DataFilter>) context.getBean(implName);
} catch (Exception ex) {
throw new ResultCodeException(CoreResultCode.FILTER_IMPLEMENTATION_NOT_FOUND, ImmutableMap.of("implementation", implName, "propertyName", key.getName(), "configurationProperty", builder.getConfigurationPropertyName(ConfigurationService.PROPERTY_IMPLEMENTATION)), ex);
}
}
Aggregations