Search in sources :

Example 1 with DisabledFilterBuilder

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);
    }
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) DisabledFilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.DisabledFilterBuilder) FilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) DisabledFilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.DisabledFilterBuilder) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) FilterNotSupportedException(eu.bcvsolutions.idm.core.api.exception.FilterNotSupportedException) FilterSizeExceededException(eu.bcvsolutions.idm.core.api.exception.FilterSizeExceededException)

Aggregations

DataFilter (eu.bcvsolutions.idm.core.api.dto.filter.DataFilter)1 FilterNotSupportedException (eu.bcvsolutions.idm.core.api.exception.FilterNotSupportedException)1 FilterSizeExceededException (eu.bcvsolutions.idm.core.api.exception.FilterSizeExceededException)1 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)1 DisabledFilterBuilder (eu.bcvsolutions.idm.core.api.repository.filter.DisabledFilterBuilder)1 FilterBuilder (eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder)1