use of eu.bcvsolutions.idm.core.eav.service.impl.AbstractFormValueService in project CzechIdMng by bcvsolutions.
the class DefaultFilterManager method getRegisteredServiceFilters.
/**
* Returns filters processed directly by service predicates.
*
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private Map<FilterKey, FilterBuilderDto> getRegisteredServiceFilters() {
if (registeredServiceFilters == null) {
registeredServiceFilters = new HashMap<>();
// find field by recursion from registered services and filter dtos
Map<String, ReadDtoService> services = context.getBeansOfType(ReadDtoService.class);
services.forEach((beanName, service) -> {
Class<? extends BaseEntity> entityClass = service.getEntityClass();
Class<? extends BaseFilter> filterClass = service.getFilterClass();
if (entityClass == null || filterClass == null) {
LOG.trace("Service [{}], [{}] does not define controlled entity [{}] or filter[{}], skip to resolve available filter criteria.", beanName, service.getClass(), entityClass, filterClass);
} else {
registeredServiceFilters.putAll(getRegisteredFilters(entityClass, filterClass).entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> {
FilterBuilderDto dto = e.getValue();
// service and property is unique combination
dto.setId(String.format("%s-%s", beanName, dto.getName()));
// service - can be overriden - https://wiki.czechidm.com/tutorial/dev/override_service
dto.setModule(EntityUtils.getModule(service.getClass()));
//
if (service instanceof AbstractFormValueService<?, ?>) {
// eav value services are constructed dynamically (prevent to show cglib class)
dto.setFilterBuilderClass(AbstractFormValueService.class);
} else {
dto.setFilterBuilderClass(AutowireHelper.getTargetClass(service));
}
return dto;
})));
}
});
}
//
return registeredServiceFilters;
}
Aggregations