コード例 #1
0
 /** GET /countryRates -> get all the countryRates. */
 @RequestMapping(
     value = "/countryRates",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public List<CountryRate> getAllCountryRates() {
   log.debug("REST request to get all CountryRates");
   return countryRateRepository.findAll();
 }
コード例 #2
0
 /** DELETE /countryRates/:id -> delete the "id" countryRate. */
 @RequestMapping(
     value = "/countryRates/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteCountryRate(@PathVariable Long id) {
   log.debug("REST request to delete CountryRate : {}", id);
   countryRateRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("countryRate", id.toString()))
       .build();
 }
コード例 #3
0
 /** GET /countryRates/:id -> get the "id" countryRate. */
 @RequestMapping(
     value = "/countryRates/{id}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CountryRate> getCountryRate(@PathVariable Long id) {
   log.debug("REST request to get CountryRate : {}", id);
   CountryRate countryRate = countryRateRepository.findOne(id);
   return Optional.ofNullable(countryRate)
       .map(result -> new ResponseEntity<>(result, HttpStatus.OK))
       .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
 }
コード例 #4
0
 /** PUT /countryRates -> Updates an existing countryRate. */
 @RequestMapping(
     value = "/countryRates",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CountryRate> updateCountryRate(@Valid @RequestBody CountryRate countryRate)
     throws URISyntaxException {
   log.debug("REST request to update CountryRate : {}", countryRate);
   if (countryRate.getId() == null) {
     return createCountryRate(countryRate);
   }
   CountryRate result = countryRateRepository.save(countryRate);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("countryRate", countryRate.getId().toString()))
       .body(result);
 }
コード例 #5
0
 /** POST /countryRates -> Create a new countryRate. */
 @RequestMapping(
     value = "/countryRates",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CountryRate> createCountryRate(@Valid @RequestBody CountryRate countryRate)
     throws URISyntaxException {
   log.debug("REST request to save CountryRate : {}", countryRate);
   if (countryRate.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "countryRate", "idexists", "A new countryRate cannot already have an ID"))
         .body(null);
   }
   CountryRate result = countryRateRepository.save(countryRate);
   return ResponseEntity.created(new URI("/api/countryRates/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("countryRate", result.getId().toString()))
       .body(result);
 }