Loading atlas-commands/src/main/java/es/redmic/atlascommands/controller/LayerController.java +20 −0 Original line number Diff line number Diff line package es.redmic.atlascommands.controller; import javax.validation.Valid; /*- * #%L * Atlas-management Loading @@ -21,12 +23,22 @@ package es.redmic.atlascommands.controller; */ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import es.redmic.atlascommands.service.LayerService; import es.redmic.atlaslib.dto.layer.LayerDTO; import es.redmic.atlaslib.dto.layerinfo.LayerInfoDTO; import es.redmic.atlaslib.dto.refresh.RefreshRequestDTO; import es.redmic.commandslib.controller.CommandController; import es.redmic.models.es.common.dto.BodyItemDTO; import es.redmic.models.es.common.dto.SuperDTO; @Controller @RequestMapping(value = "${controller.mapping.LAYER}") Loading @@ -39,4 +51,12 @@ public class LayerController extends CommandController<LayerInfoDTO> { super(service); this.service = service; } @PutMapping(value = "/refresh/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public SuperDTO refresh(@Valid @RequestBody RefreshRequestDTO dto, BindingResult errorDto, @PathVariable("id") String id) { return new BodyItemDTO<LayerDTO>(service.refresh(id, dto)); } } atlas-commands/src/main/java/es/redmic/atlascommands/service/LayerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -28,12 +28,14 @@ import org.springframework.stereotype.Service; import es.redmic.atlascommands.commands.layer.CreateLayerCommand; import es.redmic.atlascommands.commands.layer.DeleteLayerCommand; import es.redmic.atlascommands.commands.layer.RefreshLayerCommand; import es.redmic.atlascommands.commands.layer.UpdateLayerCommand; import es.redmic.atlascommands.handler.LayerCommandHandler; import es.redmic.atlascommands.mapper.LayerInfoDTOMapper; import es.redmic.atlaslib.dto.layer.LayerDTO; import es.redmic.atlaslib.dto.layerinfo.LayerInfoDTO; import es.redmic.atlaslib.dto.layerwms.LayerWMSDTO; import es.redmic.atlaslib.dto.refresh.RefreshRequestDTO; import es.redmic.commandslib.service.CommandServiceItfc; @Service Loading Loading @@ -80,4 +82,14 @@ public class LayerService implements CommandServiceItfc<LayerInfoDTO> { return commandHandler.update(id, new DeleteLayerCommand(id)); } public LayerDTO refresh(String id, RefreshRequestDTO refreshRequestDTO) { logger.debug("Refresh Layer"); LayerWMSDTO layerWMSDTO = ogcService.getLayerFromWMSService(refreshRequestDTO.getUrlSource(), refreshRequestDTO.getName()); return commandHandler.refresh(new RefreshLayerCommand(id, layerWMSDTO)); } } Loading
atlas-commands/src/main/java/es/redmic/atlascommands/controller/LayerController.java +20 −0 Original line number Diff line number Diff line package es.redmic.atlascommands.controller; import javax.validation.Valid; /*- * #%L * Atlas-management Loading @@ -21,12 +23,22 @@ package es.redmic.atlascommands.controller; */ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import es.redmic.atlascommands.service.LayerService; import es.redmic.atlaslib.dto.layer.LayerDTO; import es.redmic.atlaslib.dto.layerinfo.LayerInfoDTO; import es.redmic.atlaslib.dto.refresh.RefreshRequestDTO; import es.redmic.commandslib.controller.CommandController; import es.redmic.models.es.common.dto.BodyItemDTO; import es.redmic.models.es.common.dto.SuperDTO; @Controller @RequestMapping(value = "${controller.mapping.LAYER}") Loading @@ -39,4 +51,12 @@ public class LayerController extends CommandController<LayerInfoDTO> { super(service); this.service = service; } @PutMapping(value = "/refresh/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public SuperDTO refresh(@Valid @RequestBody RefreshRequestDTO dto, BindingResult errorDto, @PathVariable("id") String id) { return new BodyItemDTO<LayerDTO>(service.refresh(id, dto)); } }
atlas-commands/src/main/java/es/redmic/atlascommands/service/LayerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -28,12 +28,14 @@ import org.springframework.stereotype.Service; import es.redmic.atlascommands.commands.layer.CreateLayerCommand; import es.redmic.atlascommands.commands.layer.DeleteLayerCommand; import es.redmic.atlascommands.commands.layer.RefreshLayerCommand; import es.redmic.atlascommands.commands.layer.UpdateLayerCommand; import es.redmic.atlascommands.handler.LayerCommandHandler; import es.redmic.atlascommands.mapper.LayerInfoDTOMapper; import es.redmic.atlaslib.dto.layer.LayerDTO; import es.redmic.atlaslib.dto.layerinfo.LayerInfoDTO; import es.redmic.atlaslib.dto.layerwms.LayerWMSDTO; import es.redmic.atlaslib.dto.refresh.RefreshRequestDTO; import es.redmic.commandslib.service.CommandServiceItfc; @Service Loading Loading @@ -80,4 +82,14 @@ public class LayerService implements CommandServiceItfc<LayerInfoDTO> { return commandHandler.update(id, new DeleteLayerCommand(id)); } public LayerDTO refresh(String id, RefreshRequestDTO refreshRequestDTO) { logger.debug("Refresh Layer"); LayerWMSDTO layerWMSDTO = ogcService.getLayerFromWMSService(refreshRequestDTO.getUrlSource(), refreshRequestDTO.getName()); return commandHandler.refresh(new RefreshLayerCommand(id, layerWMSDTO)); } }