コード例 #1
0
 /** POST /cardTypes -> Create a new cardType. */
 @RequestMapping(
     value = "/cardTypes",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CardType> createCardType(@Valid @RequestBody CardType cardType)
     throws URISyntaxException {
   log.debug("REST request to save CardType : {}", cardType);
   if (cardType.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "cardType", "idexists", "A new cardType cannot already have an ID"))
         .body(null);
   }
   CardType result = cardTypeRepository.save(cardType);
   cardTypeSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/cardTypes/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("cardType", result.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);
 }
コード例 #3
0
 /** DELETE /cardTypes/:id -> delete the "id" cardType. */
 @RequestMapping(
     value = "/cardTypes/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteCardType(@PathVariable Long id) {
   log.debug("REST request to delete CardType : {}", id);
   cardTypeRepository.delete(id);
   cardTypeSearchRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("cardType", id.toString()))
       .build();
 }
コード例 #4
0
 /** PUT /cardTypes -> Updates an existing cardType. */
 @RequestMapping(
     value = "/cardTypes",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CardType> updateCardType(@Valid @RequestBody CardType cardType)
     throws URISyntaxException {
   log.debug("REST request to update CardType : {}", cardType);
   if (cardType.getId() == null) {
     return createCardType(cardType);
   }
   CardType result = cardTypeRepository.save(cardType);
   cardTypeSearchRepository.save(result);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("cardType", cardType.getId().toString()))
       .body(result);
 }
コード例 #5
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);
 }