Loading src/main/java/es/redmic/api/toponym/controller/ToponymController.javadeleted 100644 → 0 +0 −138 Original line number Diff line number Diff line package es.redmic.api.toponym.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.List; 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.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; 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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RBaseController; import es.redmic.api.geodata.common.controller.IRWGeoDataController; import es.redmic.db.geodata.toponym.model.Toponym; import es.redmic.db.geodata.toponym.service.ToponymService; import es.redmic.es.toponym.service.ToponymESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.common.dto.ElasticSearchDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.models.es.geojson.toponym.dto.ToponymDTO; @RestController @RequestMapping(value = "${controller.mapping.TOPONYM}") public class ToponymController extends RBaseController<es.redmic.models.es.geojson.toponym.model.Toponym, ToponymDTO, GeoDataQueryDTO> implements IRWGeoDataController<Toponym, ToponymDTO> { ToponymService service; ToponymESService serviceES; @Autowired public ToponymController(ToponymESService serviceES, ToponymService service) { super(serviceES); this.serviceES = serviceES; this.service = service; } @GetMapping(value = "/{id}") @ResponseBody public SuperDTO findById(@PathVariable("id") String id) { ToponymDTO item = serviceES.get(id, null); return new ElasticSearchDTO(item, item != null && item.getId() != null ? 1 : 0); } @PostMapping(value = "/_mget") @ResponseBody public SuperDTO _mget(@Valid @RequestBody MgetDTO mgetDto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new ElasticSearchDTO(serviceES.mget(mgetDto, null)); } @PostMapping(value = "/_search") @ResponseBody public SuperDTO _search(@Valid @RequestBody GeoDataQueryDTO queryDTO, BindingResult bindingResult) { processQuery(queryDTO, bindingResult); return new ElasticSearchDTO(serviceES.find(orikaMapper.getMapperFacade().map(queryDTO, GeoDataQueryDTO.class), null)); } @GetMapping(value = "/_suggest") @ResponseBody public SuperDTO _suggest(@RequestParam(required = false, value = "fields") String[] fields, @RequestParam("text") String text, @RequestParam(required = false, value = "size") Integer size) { SimpleQueryDTO queryDTO = serviceES.createSimpleQueryDTOFromSuggestQueryParams(fields, text, size); processQuery((GeoDataQueryDTO) queryDTO); List<String> response = serviceES.suggest(convertToGeoDataQuery((GeoDataQueryDTO)queryDTO)); return new ElasticSearchDTO(response, response.size()); } @PostMapping(value = "/_suggest") @ResponseBody public SuperDTO _suggest(@Valid @RequestBody GeoDataQueryDTO queryDTO, BindingResult bindingResult) { processQuery(queryDTO, bindingResult); List<String> response = serviceES.suggest(convertToGeoDataQuery(queryDTO)); return new ElasticSearchDTO(response, response.size()); } @Override public SuperDTO add(String activityId, ToponymDTO dto, BindingResult errorDto) { // TODO Auto-generated method stub return null; } @Override public SuperDTO update(ToponymDTO dto, BindingResult errorDto, String activityId, String id, HttpServletResponse response) { // TODO Auto-generated method stub return null; } @Override public SuperDTO delete(String id) { // TODO Auto-generated method stub return null; } } src/main/java/es/redmic/api/toponym/controller/ToponymTypeController.javadeleted 100644 → 0 +0 −43 Original line number Diff line number Diff line package es.redmic.api.toponym.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.maintenance.common.controller.RWDomainController; import es.redmic.db.maintenance.toponym.model.ToponymType; import es.redmic.db.maintenance.toponym.service.ToponymTypeService; import es.redmic.es.maintenance.toponym.service.ToponymTypeESService; import es.redmic.models.es.common.model.DomainES; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.models.es.maintenance.toponym.dto.ToponymTypeDTO; @RestController @RequestMapping(value = "${controller.mapping.TOPONYM_TYPE}") public class ToponymTypeController extends RWDomainController<ToponymType, DomainES, ToponymTypeDTO, SimpleQueryDTO> { @Autowired public ToponymTypeController(ToponymTypeService service, ToponymTypeESService serviceES) { super(service, serviceES); } } src/main/resources/application.properties +0 −5 Original line number Diff line number Diff line Loading @@ -282,11 +282,6 @@ controller.mapping.URL_BASE_UTILS=/utils controller.mapping.URL_BASE_GEO_UTILS=${controller.mapping.URL_BASE_UTILS}/geo controller.mapping.utils.geo.CONVERT_TO_GEOJSON=${controller.mapping.URL_BASE_GEO_UTILS}/convert2geojson #Toponym controller.mapping.TOPONYM_TYPE=/toponymtypes controller.mapping.TOPONYM=/toponyms #Partial target contoller.mapping.FILTERED_ACTIVITIES=/{id}/activities Loading Loading
src/main/java/es/redmic/api/toponym/controller/ToponymController.javadeleted 100644 → 0 +0 −138 Original line number Diff line number Diff line package es.redmic.api.toponym.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.List; 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.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; 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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import es.redmic.api.common.controller.RBaseController; import es.redmic.api.geodata.common.controller.IRWGeoDataController; import es.redmic.db.geodata.toponym.model.Toponym; import es.redmic.db.geodata.toponym.service.ToponymService; import es.redmic.es.toponym.service.ToponymESService; import es.redmic.exception.databinding.DTONotValidException; import es.redmic.models.es.common.dto.ElasticSearchDTO; import es.redmic.models.es.common.dto.SuperDTO; import es.redmic.models.es.common.query.dto.GeoDataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.models.es.geojson.toponym.dto.ToponymDTO; @RestController @RequestMapping(value = "${controller.mapping.TOPONYM}") public class ToponymController extends RBaseController<es.redmic.models.es.geojson.toponym.model.Toponym, ToponymDTO, GeoDataQueryDTO> implements IRWGeoDataController<Toponym, ToponymDTO> { ToponymService service; ToponymESService serviceES; @Autowired public ToponymController(ToponymESService serviceES, ToponymService service) { super(serviceES); this.serviceES = serviceES; this.service = service; } @GetMapping(value = "/{id}") @ResponseBody public SuperDTO findById(@PathVariable("id") String id) { ToponymDTO item = serviceES.get(id, null); return new ElasticSearchDTO(item, item != null && item.getId() != null ? 1 : 0); } @PostMapping(value = "/_mget") @ResponseBody public SuperDTO _mget(@Valid @RequestBody MgetDTO mgetDto, BindingResult errorDto) { if (errorDto.hasErrors()) throw new DTONotValidException(errorDto); return new ElasticSearchDTO(serviceES.mget(mgetDto, null)); } @PostMapping(value = "/_search") @ResponseBody public SuperDTO _search(@Valid @RequestBody GeoDataQueryDTO queryDTO, BindingResult bindingResult) { processQuery(queryDTO, bindingResult); return new ElasticSearchDTO(serviceES.find(orikaMapper.getMapperFacade().map(queryDTO, GeoDataQueryDTO.class), null)); } @GetMapping(value = "/_suggest") @ResponseBody public SuperDTO _suggest(@RequestParam(required = false, value = "fields") String[] fields, @RequestParam("text") String text, @RequestParam(required = false, value = "size") Integer size) { SimpleQueryDTO queryDTO = serviceES.createSimpleQueryDTOFromSuggestQueryParams(fields, text, size); processQuery((GeoDataQueryDTO) queryDTO); List<String> response = serviceES.suggest(convertToGeoDataQuery((GeoDataQueryDTO)queryDTO)); return new ElasticSearchDTO(response, response.size()); } @PostMapping(value = "/_suggest") @ResponseBody public SuperDTO _suggest(@Valid @RequestBody GeoDataQueryDTO queryDTO, BindingResult bindingResult) { processQuery(queryDTO, bindingResult); List<String> response = serviceES.suggest(convertToGeoDataQuery(queryDTO)); return new ElasticSearchDTO(response, response.size()); } @Override public SuperDTO add(String activityId, ToponymDTO dto, BindingResult errorDto) { // TODO Auto-generated method stub return null; } @Override public SuperDTO update(ToponymDTO dto, BindingResult errorDto, String activityId, String id, HttpServletResponse response) { // TODO Auto-generated method stub return null; } @Override public SuperDTO delete(String id) { // TODO Auto-generated method stub return null; } }
src/main/java/es/redmic/api/toponym/controller/ToponymTypeController.javadeleted 100644 → 0 +0 −43 Original line number Diff line number Diff line package es.redmic.api.toponym.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.maintenance.common.controller.RWDomainController; import es.redmic.db.maintenance.toponym.model.ToponymType; import es.redmic.db.maintenance.toponym.service.ToponymTypeService; import es.redmic.es.maintenance.toponym.service.ToponymTypeESService; import es.redmic.models.es.common.model.DomainES; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.models.es.maintenance.toponym.dto.ToponymTypeDTO; @RestController @RequestMapping(value = "${controller.mapping.TOPONYM_TYPE}") public class ToponymTypeController extends RWDomainController<ToponymType, DomainES, ToponymTypeDTO, SimpleQueryDTO> { @Autowired public ToponymTypeController(ToponymTypeService service, ToponymTypeESService serviceES) { super(service, serviceES); } }
src/main/resources/application.properties +0 −5 Original line number Diff line number Diff line Loading @@ -282,11 +282,6 @@ controller.mapping.URL_BASE_UTILS=/utils controller.mapping.URL_BASE_GEO_UTILS=${controller.mapping.URL_BASE_UTILS}/geo controller.mapping.utils.geo.CONVERT_TO_GEOJSON=${controller.mapping.URL_BASE_GEO_UTILS}/convert2geojson #Toponym controller.mapping.TOPONYM_TYPE=/toponymtypes controller.mapping.TOPONYM=/toponyms #Partial target contoller.mapping.FILTERED_ACTIVITIES=/{id}/activities Loading