Exemplo n.º 1
0
 /** SEARCH /_search/issuers/:query -> search for the issuer corresponding to the query. */
 @RequestMapping(
     value = "/_search/issuers/{query:.+}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public List<Issuer> searchIssuers(@PathVariable String query) {
   log.debug("REST request to search Issuers for query {}", query);
   return StreamSupport.stream(
           issuerSearchRepository.search(queryStringQuery(query)).spliterator(), false)
       .collect(Collectors.toList());
 }
Exemplo n.º 2
0
 /** DELETE /issuers/:id -> delete the "id" issuer. */
 @RequestMapping(
     value = "/issuers/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteIssuer(@PathVariable Long id) {
   log.debug("REST request to delete Issuer : {}", id);
   issuerRepository.delete(id);
   issuerSearchRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("issuer", id.toString()))
       .build();
 }
Exemplo n.º 3
0
 /** PUT /issuers -> Updates an existing issuer. */
 @RequestMapping(
     value = "/issuers",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Issuer> updateIssuer(@Valid @RequestBody Issuer issuer)
     throws URISyntaxException {
   log.debug("REST request to update Issuer : {}", issuer);
   if (issuer.getId() == null) {
     return createIssuer(issuer);
   }
   Issuer result = issuerRepository.save(issuer);
   issuerSearchRepository.save(result);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("issuer", issuer.getId().toString()))
       .body(result);
 }
Exemplo n.º 4
0
 /** POST /issuers -> Create a new issuer. */
 @RequestMapping(
     value = "/issuers",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Issuer> createIssuer(@Valid @RequestBody Issuer issuer)
     throws URISyntaxException {
   log.debug("REST request to save Issuer : {}", issuer);
   if (issuer.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "issuer", "idexists", "A new issuer cannot already have an ID"))
         .body(null);
   }
   Issuer result = issuerRepository.save(issuer);
   issuerSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/issuers/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("issuer", result.getId().toString()))
       .body(result);
 }