use of com.dubion.domain.Artist in project dubion by valsamiq.
the class ArtistResource method getArtist.
/**
* GET /artists/:id : get the "id" artist.
*
* @param id the id of the artist to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the artist, or with status 404 (Not Found)
*/
@GetMapping("/artists/{id}")
@Timed
public ResponseEntity<Artist> getArtist(@PathVariable Long id) {
log.debug("REST request to get Artist : {}", id);
Artist artist = artistService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(artist));
}
use of com.dubion.domain.Artist in project dubion by valsamiq.
the class ArtistResource method createArtist.
/**
* POST /artists : Create a new artist.
*
* @param artist the artist to create
* @return the ResponseEntity with status 201 (Created) and with body the new artist, or with status 400 (Bad Request) if the artist has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/artists")
@Timed
public ResponseEntity<Artist> createArtist(@RequestBody Artist artist) throws URISyntaxException {
log.debug("REST request to save Artist : {}", artist);
if (artist.getId() != null) {
throw new BadRequestAlertException("A new artist cannot already have an ID", ENTITY_NAME, "idexists");
}
Artist result = artistService.save(artist);
return ResponseEntity.created(new URI("/api/artist/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.domain.Artist in project dubion by valsamiq.
the class ArtistResource method updateArtist.
/**
* PUT /artists : Updates an existing artist.
*
* @param artist the artist to update
* @return the ResponseEntity with status 200 (OK) and with body the updated artist,
* or with status 400 (Bad Request) if the artist is not valid,
* or with status 500 (Internal Server Error) if the artist couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/artists")
@Timed
public ResponseEntity<Artist> updateArtist(@RequestBody Artist artist) throws URISyntaxException {
log.debug("REST request to update Artist : {}", artist);
if (artist.getId() == null) {
return createArtist(artist);
}
Artist result = artistService.save(artist);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, artist.getId().toString())).body(result);
}
use of com.dubion.domain.Artist in project dubion by valsamiq.
the class NapsterDTOService method importTopArtist.
public List<Artist> importTopArtist() {
NapsterArtist topArtistNapster = getTopArtistNap();
List<Artist> topArtists = new ArrayList<>();
for (com.dubion.service.dto.NapsterAPI.Artist.Artist t : topArtistNapster.getArtists()) {
if (artistRepository.findByName(t.getName()) == null) {
Artist s = new Artist();
String a = "";
s.setName(t.getName());
for (String b : t.getBlurbs()) {
a = b;
}
s.setBio(a);
s = artistRepository.save(s);
topArtists.add(s);
} else {
topArtists.add(artistRepository.findByName(t.getName()));
}
}
return topArtists;
}
Aggregations