Loading deploy/docker-compose.tmpl.yml +0 −3 Original line number Diff line number Diff line Loading @@ -38,9 +38,6 @@ services: traefik.mediastorage.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/${MICROSERVICE_NAME}/mediastorage/photobank/{animals|layers|species|platforms|organisations} traefik.mediastorage.frontend.redirect.regex: ^.*/${MICROSERVICE_NAME}/mediastorage/(photobank)/(animals|layers|species|platforms|organisations)/(.+\\.(?:gif|jpe?g|png))$$ traefik.mediastorage.frontend.redirect.replacement: https://s3-${AWS_REGION}.amazonaws.com/${S3_BUCKET}/public/$$1/$$2/$$3 traefik.grafcan.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/grafcan traefik.grafcan.frontend.redirect.regex: ^.*/grafcan(.*)$$ traefik.grafcan.frontend.redirect.replacement: https://visor.grafcan.es/busquedas/toponimoxml$$1 traefik.backend: ${MICROSERVICE_NAME} traefik.port: "${MICROSERVICE_PORT}" restart_policy: Loading pom.xml +3 −3 Original line number Diff line number Diff line Loading @@ -13,14 +13,14 @@ <modelVersion>4.0.0</modelVersion> <artifactId>api</artifactId> <packaging>jar</packaging> <version>0.8.0-feature-cleanAtlasComponents</version> <version>0.9.0</version> <name>API</name> <description>RESTful web services</description> <properties> <!-- REDMIC --> <redmic.db.version>0.7.0-feature-cleanAtlasComponents</redmic.db.version> <redmic.elasticsearch.version>0.7.0-feature-cleanAtlasComponents</redmic.elasticsearch.version> <redmic.db.version>0.6.1</redmic.db.version> <redmic.elasticsearch.version>0.6.1</redmic.elasticsearch.version> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.utils.version>0.6.0</redmic.utils.version> <redmic.models.version>0.6.1</redmic.models.version> Loading src/main/java/es/redmic/api/atlas/layer/controller/AtlasController.java 0 → 100644 +93 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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 javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RController; import es.redmic.es.atlas.service.LayerESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.atlas.dto.LayerDTO; import es.redmic.models.es.atlas.model.LayerModel; import es.redmic.models.es.common.dto.SelectionWorkDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.ATLAS}") public class AtlasController extends RController<LayerModel, LayerDTO, GeoDataQueryDTO> { LayerESService serviceES; @Autowired public AtlasController(LayerESService serviceES) { super(serviceES); this.serviceES = serviceES; } @PostConstruct private void postConstruct() { setFixedQuery("atlas", "true"); } /** * * Sobreescribe, guarda y edita selectionWork para adaptarlo a selección jerárquica * **/ @Override @RequestMapping(value = "${controller.mapping.SELECTION_WORK}", method = RequestMethod.POST) @ResponseBody public SuperDTO saveSelectionWork(@Valid @RequestBody SelectionWorkDTO dto, BindingResult bindingResult, HttpServletRequest request) { if (bindingResult.hasErrors()) throw new DTONotValidException(bindingResult); dto.setIdProperty("path"); if (dto.getIds() != null && dto.getIds().size() > 0) dto.addIds(serviceES.getDescendantsPaths(dto.getIds())); return super.saveSelectionWork(dto, bindingResult, request); } @RequestMapping(value = "${controller.mapping.SELECTION_WORK}/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateSelection(@Valid @RequestBody SelectionWorkDTO dto, BindingResult bindingResult, HttpServletRequest request) { if (bindingResult.hasErrors()) throw new DTONotValidException(bindingResult); dto.setIdProperty("path"); if (dto.getIds() != null && dto.getIds().size() > 0) dto.addIds(serviceES.getDescendantsPaths(dto.getIds())); return super.updateSelection(dto, bindingResult, request); } } src/main/java/es/redmic/api/atlas/layer/controller/RWLayerController.java 0 → 100644 +142 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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 java.util.HashMap; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.atlas.layer.service.LayerService; import es.redmic.api.common.controller.RController; import es.redmic.api.common.service.JsonSchemaService; import es.redmic.es.atlas.service.LayerESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.atlas.dto.HierarchyLayersDTO; import es.redmic.models.es.atlas.dto.LayerCategoryDTO; import es.redmic.models.es.atlas.dto.LayerCompactDTO; import es.redmic.models.es.atlas.dto.LayerDTO; import es.redmic.models.es.atlas.model.LayerModel; import es.redmic.models.es.common.dto.BodyItemDTO; import es.redmic.models.es.common.dto.BodyListDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.dto.UrlDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.LAYER}") public class RWLayerController extends RController<LayerModel, LayerDTO, GeoDataQueryDTO> { @Autowired JsonSchemaService jsonSchemaService; LayerService service; LayerESService serviceES; @Autowired public RWLayerController(LayerService service, LayerESService serviceES) { super(serviceES); this.service = service; this.serviceES = serviceES; } @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody public SuperDTO saveLayers(@Valid @RequestBody UrlDTO workSpace, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyListDTO<LayerDTO>(service.save(workSpace)); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateLayer(@Valid @RequestBody LayerCompactDTO layerCompact, BindingResult errorDto, @PathVariable("id") Long id) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.update(layerCompact, id)); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public SuperDTO delete(@PathVariable("id") Long id) { service.delete(id); return new SuperDTO(true); } @RequestMapping(value = "/refresh/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO refreshLayer(@PathVariable("id") Long id) { return new BodyItemDTO<LayerDTO>(service.refreshLayer(id)); } @RequestMapping(value = "/hierarchyUpdate/", method = RequestMethod.POST) @ResponseBody public SuperDTO updateHierarchyLayers(@Valid @RequestBody HierarchyLayersDTO dto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyListDTO<LayerDTO>(service.updateHierarchyLayers(dto)); } @RequestMapping(value = "/category/", method = RequestMethod.POST) @ResponseBody public SuperDTO addCategoryLayers(@Valid @RequestBody LayerCategoryDTO dto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.addCategoryLayers(dto)); } @RequestMapping(value = "/category/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateCategoryLayers(@Valid @RequestBody LayerCategoryDTO dto, BindingResult errorDto, @PathVariable("id") Long id) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.updateCategoryLayers(dto, id)); } @RequestMapping(value = "${controller.mapping.EDIT_SCHEMA}", method = RequestMethod.GET) @ResponseBody public HashMap<String,Object> getJsonSchema(HttpServletResponse response) { return jsonSchemaService.getJsonSchema(LayerCompactDTO.class.getName()); } } src/main/java/es/redmic/api/atlas/layer/controller/ThemeInspireController.java 0 → 100644 +43 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RWController; import es.redmic.db.atlas.layer.model.ThemeInspire; import es.redmic.db.atlas.layer.service.ThemeInspireService; import es.redmic.es.atlas.service.ThemeInspireESService; import es.redmic.models.es.atlas.dto.ThemeInspireDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.THEME_INSPIRE}") public class ThemeInspireController extends RWController<ThemeInspire, es.redmic.models.es.atlas.model.ThemeInspire, ThemeInspireDTO, SimpleQueryDTO> { @Autowired public ThemeInspireController(ThemeInspireService service, ThemeInspireESService serviceES) { super(service, serviceES); } } Loading
deploy/docker-compose.tmpl.yml +0 −3 Original line number Diff line number Diff line Loading @@ -38,9 +38,6 @@ services: traefik.mediastorage.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/${MICROSERVICE_NAME}/mediastorage/photobank/{animals|layers|species|platforms|organisations} traefik.mediastorage.frontend.redirect.regex: ^.*/${MICROSERVICE_NAME}/mediastorage/(photobank)/(animals|layers|species|platforms|organisations)/(.+\\.(?:gif|jpe?g|png))$$ traefik.mediastorage.frontend.redirect.replacement: https://s3-${AWS_REGION}.amazonaws.com/${S3_BUCKET}/public/$$1/$$2/$$3 traefik.grafcan.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/grafcan traefik.grafcan.frontend.redirect.regex: ^.*/grafcan(.*)$$ traefik.grafcan.frontend.redirect.replacement: https://visor.grafcan.es/busquedas/toponimoxml$$1 traefik.backend: ${MICROSERVICE_NAME} traefik.port: "${MICROSERVICE_PORT}" restart_policy: Loading
pom.xml +3 −3 Original line number Diff line number Diff line Loading @@ -13,14 +13,14 @@ <modelVersion>4.0.0</modelVersion> <artifactId>api</artifactId> <packaging>jar</packaging> <version>0.8.0-feature-cleanAtlasComponents</version> <version>0.9.0</version> <name>API</name> <description>RESTful web services</description> <properties> <!-- REDMIC --> <redmic.db.version>0.7.0-feature-cleanAtlasComponents</redmic.db.version> <redmic.elasticsearch.version>0.7.0-feature-cleanAtlasComponents</redmic.elasticsearch.version> <redmic.db.version>0.6.1</redmic.db.version> <redmic.elasticsearch.version>0.6.1</redmic.elasticsearch.version> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.utils.version>0.6.0</redmic.utils.version> <redmic.models.version>0.6.1</redmic.models.version> Loading
src/main/java/es/redmic/api/atlas/layer/controller/AtlasController.java 0 → 100644 +93 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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 javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RController; import es.redmic.es.atlas.service.LayerESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.atlas.dto.LayerDTO; import es.redmic.models.es.atlas.model.LayerModel; import es.redmic.models.es.common.dto.SelectionWorkDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.ATLAS}") public class AtlasController extends RController<LayerModel, LayerDTO, GeoDataQueryDTO> { LayerESService serviceES; @Autowired public AtlasController(LayerESService serviceES) { super(serviceES); this.serviceES = serviceES; } @PostConstruct private void postConstruct() { setFixedQuery("atlas", "true"); } /** * * Sobreescribe, guarda y edita selectionWork para adaptarlo a selección jerárquica * **/ @Override @RequestMapping(value = "${controller.mapping.SELECTION_WORK}", method = RequestMethod.POST) @ResponseBody public SuperDTO saveSelectionWork(@Valid @RequestBody SelectionWorkDTO dto, BindingResult bindingResult, HttpServletRequest request) { if (bindingResult.hasErrors()) throw new DTONotValidException(bindingResult); dto.setIdProperty("path"); if (dto.getIds() != null && dto.getIds().size() > 0) dto.addIds(serviceES.getDescendantsPaths(dto.getIds())); return super.saveSelectionWork(dto, bindingResult, request); } @RequestMapping(value = "${controller.mapping.SELECTION_WORK}/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateSelection(@Valid @RequestBody SelectionWorkDTO dto, BindingResult bindingResult, HttpServletRequest request) { if (bindingResult.hasErrors()) throw new DTONotValidException(bindingResult); dto.setIdProperty("path"); if (dto.getIds() != null && dto.getIds().size() > 0) dto.addIds(serviceES.getDescendantsPaths(dto.getIds())); return super.updateSelection(dto, bindingResult, request); } }
src/main/java/es/redmic/api/atlas/layer/controller/RWLayerController.java 0 → 100644 +142 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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 java.util.HashMap; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.atlas.layer.service.LayerService; import es.redmic.api.common.controller.RController; import es.redmic.api.common.service.JsonSchemaService; import es.redmic.es.atlas.service.LayerESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.atlas.dto.HierarchyLayersDTO; import es.redmic.models.es.atlas.dto.LayerCategoryDTO; import es.redmic.models.es.atlas.dto.LayerCompactDTO; import es.redmic.models.es.atlas.dto.LayerDTO; import es.redmic.models.es.atlas.model.LayerModel; import es.redmic.models.es.common.dto.BodyItemDTO; import es.redmic.models.es.common.dto.BodyListDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.dto.UrlDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.LAYER}") public class RWLayerController extends RController<LayerModel, LayerDTO, GeoDataQueryDTO> { @Autowired JsonSchemaService jsonSchemaService; LayerService service; LayerESService serviceES; @Autowired public RWLayerController(LayerService service, LayerESService serviceES) { super(serviceES); this.service = service; this.serviceES = serviceES; } @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody public SuperDTO saveLayers(@Valid @RequestBody UrlDTO workSpace, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyListDTO<LayerDTO>(service.save(workSpace)); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateLayer(@Valid @RequestBody LayerCompactDTO layerCompact, BindingResult errorDto, @PathVariable("id") Long id) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.update(layerCompact, id)); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public SuperDTO delete(@PathVariable("id") Long id) { service.delete(id); return new SuperDTO(true); } @RequestMapping(value = "/refresh/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO refreshLayer(@PathVariable("id") Long id) { return new BodyItemDTO<LayerDTO>(service.refreshLayer(id)); } @RequestMapping(value = "/hierarchyUpdate/", method = RequestMethod.POST) @ResponseBody public SuperDTO updateHierarchyLayers(@Valid @RequestBody HierarchyLayersDTO dto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyListDTO<LayerDTO>(service.updateHierarchyLayers(dto)); } @RequestMapping(value = "/category/", method = RequestMethod.POST) @ResponseBody public SuperDTO addCategoryLayers(@Valid @RequestBody LayerCategoryDTO dto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.addCategoryLayers(dto)); } @RequestMapping(value = "/category/{id}", method = RequestMethod.PUT) @ResponseBody public SuperDTO updateCategoryLayers(@Valid @RequestBody LayerCategoryDTO dto, BindingResult errorDto, @PathVariable("id") Long id) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new BodyItemDTO<LayerDTO>(service.updateCategoryLayers(dto, id)); } @RequestMapping(value = "${controller.mapping.EDIT_SCHEMA}", method = RequestMethod.GET) @ResponseBody public HashMap<String,Object> getJsonSchema(HttpServletResponse response) { return jsonSchemaService.getJsonSchema(LayerCompactDTO.class.getName()); } }
src/main/java/es/redmic/api/atlas/layer/controller/ThemeInspireController.java 0 → 100644 +43 −0 Original line number Diff line number Diff line package es.redmic.api.atlas.layer.controller; /*- * #%L * API * %% * Copyright (C) 2019 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.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RWController; import es.redmic.db.atlas.layer.model.ThemeInspire; import es.redmic.db.atlas.layer.service.ThemeInspireService; import es.redmic.es.atlas.service.ThemeInspireESService; import es.redmic.models.es.atlas.dto.ThemeInspireDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; @RestController @RequestMapping(value = "${controller.mapping.THEME_INSPIRE}") public class ThemeInspireController extends RWController<ThemeInspire, es.redmic.models.es.atlas.model.ThemeInspire, ThemeInspireDTO, SimpleQueryDTO> { @Autowired public ThemeInspireController(ThemeInspireService service, ThemeInspireESService serviceES) { super(service, serviceES); } }