001: /*
002: * Copyright 2004-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.compass.sample.petclinic;
018:
019: import java.util.Collection;
020:
021: import org.springframework.dao.DataAccessException;
022:
023: /**
024: * The high-level PetClinic business interface.
025: *
026: * <p>
027: * This is basically a data access object, as PetClinic doesn't have dedicated
028: * business logic.
029: *
030: * @author Ken Krebs
031: * @author Juergen Hoeller
032: */
033: public interface Clinic {
034:
035: /**
036: * Retrieve all <code>Vet</code>s from the datastore.
037: *
038: * @return a <code>Collection</code> of <code>Vet</code>s
039: */
040: Collection getVets() throws DataAccessException;
041:
042: /**
043: * Retrieve all <code>PetType</code>s from the datastore.
044: *
045: * @return a <code>Collection</code> of <code>PetType</code>s
046: */
047: Collection getPetTypes() throws DataAccessException;
048:
049: /**
050: * Retrieve <code>Owner</code>s from the datastore by last name,
051: * returning all owners whose last name <i>starts</i> with the given name.
052: *
053: * @param lastName
054: * Value to search for
055: * @return a <code>Collection</code> of matching <code>Owner</code>s
056: * (or an empty <code>Collection</code> if none found)
057: */
058: Collection findOwners(String lastName) throws DataAccessException;
059:
060: /**
061: * Retrieve an <code>Owner</code> from the datastore by id.
062: *
063: * @param id
064: * the id to search for
065: * @return the <code>Owner</code> if found
066: * @throws org.springframework.dao.DataRetrievalFailureException
067: * if not found
068: */
069: Owner loadOwner(int id) throws DataAccessException;
070:
071: /**
072: * Retrieve a <code>Pet</code> from the datastore by id.
073: *
074: * @param id
075: * the id to search for
076: * @return the <code>Pet</code> if found
077: * @throws org.springframework.dao.DataRetrievalFailureException
078: * if not found
079: */
080: Pet loadPet(int id) throws DataAccessException;
081:
082: /**
083: * Retrieve all <code>Pet</code>s from the datastore.
084: *
085: * @return a <code>Collection</code> of <code>Pet</code>s.
086: */
087: public Collection getPets() throws DataAccessException;
088:
089: /**
090: * Save an <code>Owner</code> to the datastore, either inserting or
091: * updating it.
092: *
093: * @param owner
094: * the <code>Owner</code> to save
095: * @see Entity#isNew
096: */
097: void storeOwner(Owner owner) throws DataAccessException;
098:
099: /**
100: * Save a <code>Pet</code> to the datastore, either inserting or updating
101: * it.
102: *
103: * @param pet
104: * the <code>Pet</code> to save
105: * @see Entity#isNew
106: */
107: void storePet(Pet pet) throws DataAccessException;
108:
109: /**
110: * Save a <code>Visit</code> to the datastore, either inserting or
111: * updating it.
112: *
113: * @param visit
114: * the <code>Visit</code> to save
115: * @see Entity#isNew
116: */
117: void storeVisit(Visit visit) throws DataAccessException;
118:
119: }
|