Search in sources :

Example 6 with Country

use of com.furyviewer.domain.Country in project FuryViewer by TheDoctor-95.

the class CountryResource method getCountry.

/**
 * GET  /countries/:id : get the "id" country.
 *
 * @param id the id of the country to retrieve
 * @return the ResponseEntity with status 200 (OK) and with body the country, or with status 404 (Not Found)
 */
@GetMapping("/countries/{id}")
@Timed
public ResponseEntity<Country> getCountry(@PathVariable Long id) {
    log.debug("REST request to get Country : {}", id);
    Country country = countryRepository.findOne(id);
    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(country));
}
Also used : Country(com.furyviewer.domain.Country) Timed(com.codahale.metrics.annotation.Timed)

Example 7 with Country

use of com.furyviewer.domain.Country in project FuryViewer by TheDoctor-95.

the class GoogleMapsDTOService method importCountry.

/**
 * Se convierte la informacion de Country proveniente de la api de GoogleMaps al formato de FuryViewer.
 * @param countryName String | Nombre de la localizacion.
 * @return Country | Country en el formato FuryViewer.
 */
public Country importCountry(String countryName) {
    Country country = null;
    if (getCoordinates(countryName) != null) {
        country = new Country();
        country.setName(getName(countryName));
        country.setLongitude(getLongitude(getName(countryName)));
        country.setLatitude(getLatitude(getName(countryName)));
        country = countryRepository.save(country);
    }
    return country;
}
Also used : Country(com.furyviewer.domain.Country)

Aggregations

Country (com.furyviewer.domain.Country)7 Timed (com.codahale.metrics.annotation.Timed)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1