1 package be.dvw.administration.services.instruments; 2 3 import java.util.List; 4 import be.dvw.administration.model.Instrument; 5 6 /*** 7 * Service interface allowing to retrieve and manipulate scores in the persistence store 8 * (depending on the implementation used). 9 */ 10 public interface InstrumentService 11 { 12 /*** 13 * Method returning the complete list of instruments. 14 * @return List of instruments 15 * @throws Exception 16 */ 17 public List getAll() throws Exception; 18 19 /*** 20 * Method allowing to store a instrument (both update and create) 21 * @param instrument: the instrument to be saved 22 * @param newInstrument: boolean indicating wheter it is an update or a create 23 * @return the instrument as stored in the database 24 * @throws Exception 25 */ 26 public Instrument save(Instrument instrument, boolean newInstrument) throws Exception; 27 28 /*** 29 * Method allowing to delete a instrument 30 * @param id the identifier of the instrument 31 * @throws Exception 32 */ 33 public void delete(int id) throws Exception; 34 35 /*** 36 * Method returning a instrument corresponding to the id 37 * @param id 38 * @return the instrument corresponding to the id 39 * @throws Exception 40 */ 41 public Instrument load(int id) throws Exception; 42 43 /*** 44 * Method allowing to search for instruments based on an search string suc as: 45 * 'name' = $name AND 'composer' = $composer OR 'arranger' = $arranger 46 * @todo define the format of the search string (SQL, HQL, ...) 47 * @param searchString 48 * @return List of instruments containing the search result 49 * @throws Exception 50 */ 51 public List search(String searchString) throws Exception; 52 53 /*** 54 * Method returning the current value of the inventory 55 * @return the current value of the inventory (all instruments) being the purchase value 56 * less the depreciation 57 */ 58 public float getCurrentValue(); 59 60 /*** 61 * Method returning the purchase value of the inventory 62 * @return the purchase value 63 */ 64 public float getPurchaseValue(); 65 66 /*** 67 * Method counting the total number of instruments in the inventory 68 * @return number of instruments in the inventory 69 */ 70 public int getTotalNumber(); 71 72 }