1 package org.springframework.samples.petclinic;
2
3 import java.util.Collection;
4
5 import org.springframework.dao.DataAccessException;
6
7 /**
8 * The high-level PetClinic business interface.
9 *
10 * <p>This is basically a data access object.
11 * PetClinic doesn't have a dedicated business facade.
12 *
13 * @author Ken Krebs
14 * @author Juergen Hoeller
15 * @author Sam Brannen
16 */
17 public interface Clinic {
18
19 /**
20 * Retrieve all <code>Vet</code>s from the data store.
21 * @return a <code>Collection</code> of <code>Vet</code>s
22 */
23 Collection<Vet> getVets() throws DataAccessException;
24
25 /**
26 * Retrieve all <code>PetType</code>s from the data store.
27 * @return a <code>Collection</code> of <code>PetType</code>s
28 */
29 Collection<PetType> getPetTypes() throws DataAccessException;
30
31 /**
32 * Retrieve <code>Owner</code>s from the data store by last name,
33 * returning all owners whose last name <i>starts</i> with the given name.
34 * @param lastName Value to search for
35 * @return a <code>Collection</code> of matching <code>Owner</code>s
36 * (or an empty <code>Collection</code> if none found)
37 */
38 Collection<Owner> findOwners(String lastName) throws DataAccessException;
39
40 /**
41 * Retrieve an <code>Owner</code> from the data store by id.
42 * @param id the id to search for
43 * @return the <code>Owner</code> if found
44 * @throws org.springframework.dao.DataRetrievalFailureException if not found
45 */
46 Owner loadOwner(int id) throws DataAccessException;
47
48 /**
49 * Retrieve a <code>Pet</code> from the data store by id.
50 * @param id the id to search for
51 * @return the <code>Pet</code> if found
52 * @throws org.springframework.dao.DataRetrievalFailureException if not found
53 */
54 Pet loadPet(int id) throws DataAccessException;
55
56 /**
57 * Save an <code>Owner</code> to the data store, either inserting or updating it.
58 * @param owner the <code>Owner</code> to save
59 * @see BaseEntity#isNew
60 */
61 void storeOwner(Owner owner) throws DataAccessException;
62
63 /**
64 * Save a <code>Pet</code> to the data store, either inserting or updating it.
65 * @param pet the <code>Pet</code> to save
66 * @see BaseEntity#isNew
67 */
68 void storePet(Pet pet) throws DataAccessException;
69
70 /**
71 * Save a <code>Visit</code> to the data store, either inserting or updating it.
72 * @param visit the <code>Visit</code> to save
73 * @see BaseEntity#isNew
74 */
75 void storeVisit(Visit visit) throws DataAccessException;
76
77 /**
78 * Deletes a <code>Pet</code> from the data store.
79 */
80 void deletePet(int id) throws DataAccessException;
81
82 }