/SampleApplication/ColdBox3/model/artist/ArtistService.cfc

http://github.com/bobsilverberg/ValidateThisColdBoxPlugin · ColdFusion CFScript · 54 lines · 24 code · 6 blank · 24 comment · 0 complexity · 8e4979a8eb408fe715811a0fcf4ed1e7 MD5 · raw file

  1. component extends="model.abstract.AbstractService" singleton="true"
  2. {
  3. /*
  4. ---------------------------------------------------------------------------
  5. constructor
  6. ---------------------------------------------------------------------------
  7. */
  8. ArtistService function init()
  9. {
  10. super.init();
  11. return this;
  12. }
  13. /*
  14. ---------------------------------------------------------------------------
  15. public
  16. ---------------------------------------------------------------------------
  17. */
  18. /**
  19. * returns an Artist by id, if the id is not found a new Artist is returned
  20. * @param1 the unique id
  21. */
  22. Artist function getArtistById( required id )
  23. {
  24. return getById( 'Artist', arguments.id );
  25. }
  26. /**
  27. * returns a struct of required properties
  28. */
  29. struct function getArtistRequiredFields()
  30. {
  31. return getRequiredFields( 'Artist' );
  32. }
  33. /**
  34. * returns an array of artists
  35. */
  36. array function getArtists()
  37. {
  38. return findByfilter( 'Artist', {}, "lastname,firstname" );
  39. }
  40. /**
  41. * delete an artist by id
  42. * @param1 the unique id
  43. */
  44. boolean function deleteArtistById( required id )
  45. {
  46. return deleteById( 'Artist', arguments.id );
  47. }
  48. }