Loading src/main/java/es/redmic/api/privatedata/dto/ObservationSeriesDTO.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import es.redmic.models.es.common.deserializer.CustomDateTimeDeserializer; import es.redmic.models.es.common.dto.DTOImplementWithMeta; import es.redmic.models.es.common.serializer.CustomDateTimeSerializer; @JsonIgnoreProperties(value = {"_meta"}, ignoreUnknown = true) public class ObservationSeriesDTO extends DTOImplementWithMeta { @NotNull Loading src/main/java/es/redmic/api/privatedata/mapper/ObservationESMapper.java 0 → 100644 +45 −0 Original line number Diff line number Diff line package es.redmic.api.privatedata.mapper; /*- * #%L * API * %% * Copyright (C) 2024 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import org.springframework.stereotype.Component; import es.redmic.api.privatedata.dto.ObservationDTO; import es.redmic.api.privatedata.model.Observation; import es.redmic.models.es.administrative.taxonomy.dto.AnimalTaxonomyCompactDTO; import es.redmic.models.es.administrative.taxonomy.dto.TaxonomyCompactDTO; import es.redmic.models.es.common.dto.DomainDTO; import es.redmic.models.es.maintenance.device.dto.DeviceCompactDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @Component public class ObservationESMapper extends CustomMapper<Observation, ObservationDTO> { @Override public void mapAtoB(Observation a, ObservationDTO b, MappingContext context) { b.setTaxonomy(mapperFacade.map(a.getTaxonomy(), TaxonomyCompactDTO.class); b.setAnimal(mapperFacade.map(a.getAnimal(), AnimalTaxonomyCompactDTO.class)); b.setDevice(mapperFacade.map(a.getDevice(), DeviceCompactDTO.class)); b.setObservationType(mapperFacade.map(a.getObservationType(), DomainDTO.class)); } } src/main/java/es/redmic/api/privatedata/mapper/ObservationSeriesESMapper.java 0 → 100644 +40 −0 Original line number Diff line number Diff line package es.redmic.api.privatedata.mapper; /*- * #%L * API * %% * Copyright (C) 2024 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import org.springframework.stereotype.Component; import es.redmic.api.privatedata.dto.ObservationDTO; import es.redmic.api.privatedata.dto.ObservationSeriesDTO; import es.redmic.api.privatedata.model.ObservationSeries; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @Component public class ObservationSeriesESMapper extends CustomMapper<ObservationSeries, ObservationSeriesDTO> { @Override public void mapAtoB(ObservationSeries a, ObservationSeriesDTO b, MappingContext context) { b.setObservationDTO(mapperFacade.map(a.getObservation(), ObservationDTO.class)); } } src/main/java/es/redmic/api/privatedata/repository/ObservationSeriesESRepository.java +4 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,10 @@ public class ObservationSeriesESRepository extends RDataESRepository<Observation @Override public QueryBuilder getTermQuery(Map<String, Object> terms, BoolQueryBuilder query) { if (terms.containsKey("dataDefinition")) { Long dataDefinitionId = (Long) terms.get("dataDefinition"); query.must(QueryBuilders.termQuery("dataDefinition", dataDefinitionId)); } return super.getTermQuery(terms, query); } Loading src/main/java/es/redmic/api/privatedata/service/ObservationSeriesESService.java +0 −3 Original line number Diff line number Diff line Loading @@ -33,11 +33,8 @@ import es.redmic.es.data.common.service.RDataESService; @Service public class ObservationSeriesESService extends RDataESService<ObservationSeries, ObservationSeriesDTO> { ObservationSeriesESRepository repository; @Autowired public ObservationSeriesESService(ObservationSeriesESRepository repository) { super(repository); this.repository = repository; } } Loading
src/main/java/es/redmic/api/privatedata/dto/ObservationSeriesDTO.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import es.redmic.models.es.common.deserializer.CustomDateTimeDeserializer; import es.redmic.models.es.common.dto.DTOImplementWithMeta; import es.redmic.models.es.common.serializer.CustomDateTimeSerializer; @JsonIgnoreProperties(value = {"_meta"}, ignoreUnknown = true) public class ObservationSeriesDTO extends DTOImplementWithMeta { @NotNull Loading
src/main/java/es/redmic/api/privatedata/mapper/ObservationESMapper.java 0 → 100644 +45 −0 Original line number Diff line number Diff line package es.redmic.api.privatedata.mapper; /*- * #%L * API * %% * Copyright (C) 2024 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import org.springframework.stereotype.Component; import es.redmic.api.privatedata.dto.ObservationDTO; import es.redmic.api.privatedata.model.Observation; import es.redmic.models.es.administrative.taxonomy.dto.AnimalTaxonomyCompactDTO; import es.redmic.models.es.administrative.taxonomy.dto.TaxonomyCompactDTO; import es.redmic.models.es.common.dto.DomainDTO; import es.redmic.models.es.maintenance.device.dto.DeviceCompactDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @Component public class ObservationESMapper extends CustomMapper<Observation, ObservationDTO> { @Override public void mapAtoB(Observation a, ObservationDTO b, MappingContext context) { b.setTaxonomy(mapperFacade.map(a.getTaxonomy(), TaxonomyCompactDTO.class); b.setAnimal(mapperFacade.map(a.getAnimal(), AnimalTaxonomyCompactDTO.class)); b.setDevice(mapperFacade.map(a.getDevice(), DeviceCompactDTO.class)); b.setObservationType(mapperFacade.map(a.getObservationType(), DomainDTO.class)); } }
src/main/java/es/redmic/api/privatedata/mapper/ObservationSeriesESMapper.java 0 → 100644 +40 −0 Original line number Diff line number Diff line package es.redmic.api.privatedata.mapper; /*- * #%L * API * %% * Copyright (C) 2024 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import org.springframework.stereotype.Component; import es.redmic.api.privatedata.dto.ObservationDTO; import es.redmic.api.privatedata.dto.ObservationSeriesDTO; import es.redmic.api.privatedata.model.ObservationSeries; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @Component public class ObservationSeriesESMapper extends CustomMapper<ObservationSeries, ObservationSeriesDTO> { @Override public void mapAtoB(ObservationSeries a, ObservationSeriesDTO b, MappingContext context) { b.setObservationDTO(mapperFacade.map(a.getObservation(), ObservationDTO.class)); } }
src/main/java/es/redmic/api/privatedata/repository/ObservationSeriesESRepository.java +4 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,10 @@ public class ObservationSeriesESRepository extends RDataESRepository<Observation @Override public QueryBuilder getTermQuery(Map<String, Object> terms, BoolQueryBuilder query) { if (terms.containsKey("dataDefinition")) { Long dataDefinitionId = (Long) terms.get("dataDefinition"); query.must(QueryBuilders.termQuery("dataDefinition", dataDefinitionId)); } return super.getTermQuery(terms, query); } Loading
src/main/java/es/redmic/api/privatedata/service/ObservationSeriesESService.java +0 −3 Original line number Diff line number Diff line Loading @@ -33,11 +33,8 @@ import es.redmic.es.data.common.service.RDataESService; @Service public class ObservationSeriesESService extends RDataESService<ObservationSeries, ObservationSeriesDTO> { ObservationSeriesESRepository repository; @Autowired public ObservationSeriesESService(ObservationSeriesESRepository repository) { super(repository); this.repository = repository; } }