Loading src/main/java/es/redmic/viewlib/common/mapper/es2dto/FeatureCollectionMapper.java 0 → 100644 +30 −0 Original line number Diff line number Diff line package es.redmic.viewlib.common.mapper.es2dto; import org.springframework.stereotype.Component; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; import es.redmic.models.es.geojson.common.dto.GeoJSONFeatureCollectionDTO; import es.redmic.models.es.geojson.wrapper.GeoHitsWrapper; import es.redmic.viewlib.geodata.dto.GeoMetaDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @SuppressWarnings("rawtypes") @Component public class FeatureCollectionMapper extends CustomMapper<GeoHitsWrapper, GeoJSONFeatureCollectionDTO> { @SuppressWarnings("unchecked") @Override public void mapAtoB(GeoHitsWrapper a, GeoJSONFeatureCollectionDTO b, MappingContext context) { Class<?> targetTypeDto = (Class<?>) context.getProperty("targetTypeDto"); if (targetTypeDto == null) throw new InternalException(ExceptionType.INTERNAL_EXCEPTION); b.setFeatures(mapperFacade.mapAsList(a.getHits(), GeoMetaDTO.class, context)); b.get_meta().setMax_score(a.getMax_score()); b.setTotal(a.getTotal()); } } No newline at end of file src/main/java/es/redmic/viewlib/common/mapper/es2dto/FeatureMapper.java 0 → 100644 +33 −0 Original line number Diff line number Diff line package es.redmic.viewlib.common.mapper.es2dto; import org.springframework.stereotype.Component; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; import es.redmic.models.es.common.dto.MetaDataDTO; import es.redmic.models.es.geojson.wrapper.GeoHitWrapper; import es.redmic.viewlib.geodata.dto.GeoMetaDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @SuppressWarnings("rawtypes") @Component public class FeatureMapper extends CustomMapper<GeoHitWrapper, GeoMetaDTO> { @Override public void mapAtoB(GeoHitWrapper a, GeoMetaDTO b, MappingContext context) { Class<?> targetTypeDto = (Class<?>) context.getProperty("targetTypeDto"); if (targetTypeDto == null) throw new InternalException(ExceptionType.INTERNAL_EXCEPTION); MetaDataDTO _meta = new MetaDataDTO(); _meta.setScore(a.get_score()); _meta.setVersion(a.get_version()); _meta.setHighlight(a.getHighlight()); b.set_meta(_meta); } } No newline at end of file Loading
src/main/java/es/redmic/viewlib/common/mapper/es2dto/FeatureCollectionMapper.java 0 → 100644 +30 −0 Original line number Diff line number Diff line package es.redmic.viewlib.common.mapper.es2dto; import org.springframework.stereotype.Component; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; import es.redmic.models.es.geojson.common.dto.GeoJSONFeatureCollectionDTO; import es.redmic.models.es.geojson.wrapper.GeoHitsWrapper; import es.redmic.viewlib.geodata.dto.GeoMetaDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @SuppressWarnings("rawtypes") @Component public class FeatureCollectionMapper extends CustomMapper<GeoHitsWrapper, GeoJSONFeatureCollectionDTO> { @SuppressWarnings("unchecked") @Override public void mapAtoB(GeoHitsWrapper a, GeoJSONFeatureCollectionDTO b, MappingContext context) { Class<?> targetTypeDto = (Class<?>) context.getProperty("targetTypeDto"); if (targetTypeDto == null) throw new InternalException(ExceptionType.INTERNAL_EXCEPTION); b.setFeatures(mapperFacade.mapAsList(a.getHits(), GeoMetaDTO.class, context)); b.get_meta().setMax_score(a.getMax_score()); b.setTotal(a.getTotal()); } } No newline at end of file
src/main/java/es/redmic/viewlib/common/mapper/es2dto/FeatureMapper.java 0 → 100644 +33 −0 Original line number Diff line number Diff line package es.redmic.viewlib.common.mapper.es2dto; import org.springframework.stereotype.Component; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; import es.redmic.models.es.common.dto.MetaDataDTO; import es.redmic.models.es.geojson.wrapper.GeoHitWrapper; import es.redmic.viewlib.geodata.dto.GeoMetaDTO; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MappingContext; @SuppressWarnings("rawtypes") @Component public class FeatureMapper extends CustomMapper<GeoHitWrapper, GeoMetaDTO> { @Override public void mapAtoB(GeoHitWrapper a, GeoMetaDTO b, MappingContext context) { Class<?> targetTypeDto = (Class<?>) context.getProperty("targetTypeDto"); if (targetTypeDto == null) throw new InternalException(ExceptionType.INTERNAL_EXCEPTION); MetaDataDTO _meta = new MetaDataDTO(); _meta.setScore(a.get_score()); _meta.setVersion(a.get_version()); _meta.setHighlight(a.getHighlight()); b.set_meta(_meta); } } No newline at end of file