Exemplo n.º 1
0
 /** SEARCH /_search/fases/:query -> search for the fase corresponding to the query. */
 @RequestMapping(
     value = "/_search/fases/{query}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public List<Fase> search(@PathVariable String query) {
   return StreamSupport.stream(
           faseSearchRepository.search(queryString(query)).spliterator(), false)
       .collect(Collectors.toList());
 }
Exemplo n.º 2
0
 /** DELETE /fases/:id -> delete the "id" fase. */
 @RequestMapping(
     value = "/fases/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> delete(@PathVariable Long id) {
   log.debug("REST request to delete Fase : {}", id);
   faseRepository.delete(id);
   faseSearchRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("fase", id.toString()))
       .build();
 }
Exemplo n.º 3
0
 /** PUT /fases -> Updates an existing fase. */
 @RequestMapping(
     value = "/fases",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<FaseDTO> update(@RequestBody FaseDTO faseDTO) throws URISyntaxException {
   log.debug("REST request to update Fase : {}", faseDTO);
   if (faseDTO.getId() == null) {
     return create(faseDTO);
   }
   Fase fase = faseMapper.faseDTOToFase(faseDTO);
   Fase result = faseRepository.save(fase);
   faseSearchRepository.save(fase);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("fase", faseDTO.getId().toString()))
       .body(faseMapper.faseToFaseDTO(result));
 }
Exemplo n.º 4
0
 /** POST /fases -> Create a new fase. */
 @RequestMapping(
     value = "/fases",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<FaseDTO> create(@RequestBody FaseDTO faseDTO) throws URISyntaxException {
   log.debug("REST request to save Fase : {}", faseDTO);
   if (faseDTO.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new fase cannot already have an ID")
         .body(null);
   }
   Fase fase = faseMapper.faseDTOToFase(faseDTO);
   Fase result = faseRepository.save(fase);
   faseSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/fases/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("fase", result.getId().toString()))
       .body(faseMapper.faseToFaseDTO(result));
 }