Пример #1
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);
 }
Пример #2
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);
 }