Loading src/main/java/es/redmic/viewlib/common/controller/RController.java +9 −8 Original line number Diff line number Diff line Loading @@ -33,8 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.SendResult; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; import es.redmic.brokerlib.avro.common.CommonDTO; Loading @@ -56,18 +55,18 @@ public abstract class RController<TModel extends BaseES<?>, TDTO extends CommonD protected Class<TQueryDTO> typeOfTQueryDTO; protected Set<String> fieldsExcludedOnQuery = new HashSet<String>(); protected Set<String> fieldsExcludedOnQuery = new HashSet<>(); protected Map<String, Object> fixedQuery = new HashMap<String, Object>(); protected Map<String, Object> fixedQuery = new HashMap<>(); IBaseService<TModel, TDTO, TQueryDTO> service; public RController(IBaseService<TModel, TDTO, TQueryDTO> service) { protected RController(IBaseService<TModel, TDTO, TQueryDTO> service) { this.service = service; defineTypeOfArguments(); } @RequestMapping(value = { "${controller.mapping.FILTER_SCHEMA}" }, method = RequestMethod.GET) @GetMapping(value = { "${controller.mapping.FILTER_SCHEMA}" }) @ResponseBody public ElasticSearchDTO getFilterSchema() { Loading @@ -89,6 +88,8 @@ public abstract class RController<TModel extends BaseES<?>, TDTO extends CommonD this.typeOfTDTO = (Class<TDTO>) (arguments[1]); this.typeOfTQueryDTO = (Class<TQueryDTO>) (arguments[2]); break; default: logger.error("Número de argumentos no válido."); } } Loading src/main/java/es/redmic/viewlib/common/mapper/es2dto/BaseESMapper.java +12 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import es.redmic.models.es.common.dto.MetaDataDTO; import es.redmic.models.es.common.model.BaseES; import es.redmic.models.es.common.model.HitWrapper; import es.redmic.models.es.common.model.SearchWrapper; import es.redmic.models.es.geojson.common.model.Aggregations; public abstract class BaseESMapper<TDTO extends CommonDTO, TModel extends BaseES<?>> { Loading @@ -43,20 +44,25 @@ public abstract class BaseESMapper<TDTO extends CommonDTO, TModel extends BaseES return _meta; } AggregationsDTO getAggs(SearchWrapper wrapper) { protected AggregationsDTO getAggs(SearchWrapper wrapper) { return getAggs(wrapper.getAggregations()); } protected AggregationsDTO getAggs(Aggregations aggregations) { AggregationsDTO aggs = new AggregationsDTO(); if (wrapper.getAggregations() == null || wrapper.getAggregations().getAttributes().isEmpty()) if (aggregations == null || aggregations.getAttributes().isEmpty()) return aggs; aggs.setAttributes(getCleanAttributes(wrapper.getAggregations().getAttributes())); aggs.setAttributes(getCleanAttributes(aggregations.getAttributes())); return aggs; } @SuppressWarnings("unchecked") private Map<String, Object> getCleanAttributes(Map<String, Object> source) { protected Map<String, Object> getCleanAttributes(Map<String, Object> source) { Map<String, Object> attrs = new HashMap<>(); Loading src/main/java/es/redmic/viewlib/common/service/RBaseService.java +4 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public abstract class RBaseService<TModel extends BaseES<?>, TDTO extends Common protected Class<TQueryDTO> typeOfTQueryDTO; protected Map<Object, Object> globalProperties = new HashMap<Object, Object>(); protected Map<Object, Object> globalProperties = new HashMap<>(); @Autowired protected ObjectMapper objectMapper; Loading @@ -64,7 +64,7 @@ public abstract class RBaseService<TModel extends BaseES<?>, TDTO extends Common UserService userService; @SuppressWarnings("unchecked") public RBaseService() { protected RBaseService() { this.typeOfTModel = (Class<TModel>) (((ParameterizedType) getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); Loading Loading
src/main/java/es/redmic/viewlib/common/controller/RController.java +9 −8 Original line number Diff line number Diff line Loading @@ -33,8 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.SendResult; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; import es.redmic.brokerlib.avro.common.CommonDTO; Loading @@ -56,18 +55,18 @@ public abstract class RController<TModel extends BaseES<?>, TDTO extends CommonD protected Class<TQueryDTO> typeOfTQueryDTO; protected Set<String> fieldsExcludedOnQuery = new HashSet<String>(); protected Set<String> fieldsExcludedOnQuery = new HashSet<>(); protected Map<String, Object> fixedQuery = new HashMap<String, Object>(); protected Map<String, Object> fixedQuery = new HashMap<>(); IBaseService<TModel, TDTO, TQueryDTO> service; public RController(IBaseService<TModel, TDTO, TQueryDTO> service) { protected RController(IBaseService<TModel, TDTO, TQueryDTO> service) { this.service = service; defineTypeOfArguments(); } @RequestMapping(value = { "${controller.mapping.FILTER_SCHEMA}" }, method = RequestMethod.GET) @GetMapping(value = { "${controller.mapping.FILTER_SCHEMA}" }) @ResponseBody public ElasticSearchDTO getFilterSchema() { Loading @@ -89,6 +88,8 @@ public abstract class RController<TModel extends BaseES<?>, TDTO extends CommonD this.typeOfTDTO = (Class<TDTO>) (arguments[1]); this.typeOfTQueryDTO = (Class<TQueryDTO>) (arguments[2]); break; default: logger.error("Número de argumentos no válido."); } } Loading
src/main/java/es/redmic/viewlib/common/mapper/es2dto/BaseESMapper.java +12 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import es.redmic.models.es.common.dto.MetaDataDTO; import es.redmic.models.es.common.model.BaseES; import es.redmic.models.es.common.model.HitWrapper; import es.redmic.models.es.common.model.SearchWrapper; import es.redmic.models.es.geojson.common.model.Aggregations; public abstract class BaseESMapper<TDTO extends CommonDTO, TModel extends BaseES<?>> { Loading @@ -43,20 +44,25 @@ public abstract class BaseESMapper<TDTO extends CommonDTO, TModel extends BaseES return _meta; } AggregationsDTO getAggs(SearchWrapper wrapper) { protected AggregationsDTO getAggs(SearchWrapper wrapper) { return getAggs(wrapper.getAggregations()); } protected AggregationsDTO getAggs(Aggregations aggregations) { AggregationsDTO aggs = new AggregationsDTO(); if (wrapper.getAggregations() == null || wrapper.getAggregations().getAttributes().isEmpty()) if (aggregations == null || aggregations.getAttributes().isEmpty()) return aggs; aggs.setAttributes(getCleanAttributes(wrapper.getAggregations().getAttributes())); aggs.setAttributes(getCleanAttributes(aggregations.getAttributes())); return aggs; } @SuppressWarnings("unchecked") private Map<String, Object> getCleanAttributes(Map<String, Object> source) { protected Map<String, Object> getCleanAttributes(Map<String, Object> source) { Map<String, Object> attrs = new HashMap<>(); Loading
src/main/java/es/redmic/viewlib/common/service/RBaseService.java +4 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public abstract class RBaseService<TModel extends BaseES<?>, TDTO extends Common protected Class<TQueryDTO> typeOfTQueryDTO; protected Map<Object, Object> globalProperties = new HashMap<Object, Object>(); protected Map<Object, Object> globalProperties = new HashMap<>(); @Autowired protected ObjectMapper objectMapper; Loading @@ -64,7 +64,7 @@ public abstract class RBaseService<TModel extends BaseES<?>, TDTO extends Common UserService userService; @SuppressWarnings("unchecked") public RBaseService() { protected RBaseService() { this.typeOfTModel = (Class<TModel>) (((ParameterizedType) getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); Loading