package org.codehaus.enunciate.samples.petclinic.services; import org.codehaus.enunciate.samples.petclinic.schema.*; import org.codehaus.enunciate.rest.annotations.*; import org.codehaus.enunciate.modules.gwt.GWTTransient; import javax.jws.WebService; import javax.activation.DataHandler; import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; import java.util.Collection; /** * The high-level PetClinic business interface. *
*This is basically a data access object,
* as PetClinic doesn't have dedicated business logic.
*
* @author Ken Krebs
* @author Juergen Hoeller
*/
@WebService (
targetNamespace = "http://enunciate.codehaus.org/services",
serviceName = "clinic"
)
@RESTEndpoint
@PermitAll
public interface Clinic {
/**
* Get a photo of a vet by id.
*
* @param id The vet id.
* @return The photo (raw data) of the vet.
*/
@Noun ( "vetpix" )
@Verb ( VerbType.read )
@GWTTransient
@RolesAllowed( "ADMIN" )
DataHandler getVetPhoto(@ProperNoun Integer id) throws PetClinicException, PictureException;
/**
* Sets a specific vet photo.
*
* @param dataHandler The data handler for the photo.
* @param id The id of the vet for which to store a picture.
*/
@Noun ( "vetpix" )
@Verb ( VerbType.create )
@GWTTransient
void storeVetPhoto(@NounValue DataHandler dataHandler, @ProperNoun( optional = false ) Integer id) throws PetClinicException, PictureException;
/**
* Get the brochure for the clinic in the specified format.
*
* @param format The format.
* @return The brochure.
*/
@Noun ( "brochure" )
@Verb ( VerbType.read )
@RolesAllowed("USER")
@ContentType (
value = {"text/html", "text/plain", "application/pdf"}
)
ClinicBrochure getClinicBrochure(@ContentTypeParameter String format) throws PetClinicException;
/**
* Get the brochure for the specified animal in the specified format.
*
* @param animalType The animal type.
* @param contentType The content type (MIME type)
* @return The brochure.
*/
@Noun (
value = "brochure",
context = "{animalType}"
)
@Verb ( VerbType.read )
@ContentType (
value = {"text/html", "text/plain", "application/pdf"}
)
AnimalBrochure getAnimalBrochure(@ContextParameter ( "animalType" ) String animalType, @ContentTypeParameter String contentType) throws PetClinicException;
/**
* Retrieve all Vets from the datastore.
*
* @return a Collection of Vets
*/
CollectionPetTypes from the datastore.
*
* @return a Collection of PetTypes
*/
CollectionOwners from the datastore by last name,
* returning all owners whose last name starts with the given name.
*
* @param lastName Value to search for
* @return a Collection of matching Owners
* (or an empty Collection if none found)
*/
CollectionOwner from the datastore by id.
*
* @param id the id to search for
* @return the Owner if found
*/
@Noun ("owner")
@Verb ( VerbType.read )
Owner loadOwner(@ProperNoun (optional=false) int id) throws PetClinicException;
/**
* Retrieve a Pet from the datastore by id.
*
* @param id the id to search for
* @return the Pet if found
*/
Pet loadPet(int id) throws PetClinicException;
/**
* Save an Owner to the datastore,
* either inserting or updating it.
*
* @param owner the Owner to save
* @see org.codehaus.enunciate.samples.petclinic.schema.Entity#isNew
*/
void storeOwner(Owner owner) throws PetClinicException;
/**
* Save a Pet to the datastore,
* either inserting or updating it.
*
* @param pet the Pet to save
* @see org.codehaus.enunciate.samples.petclinic.schema.Entity#isNew
*/
void storePet(Pet pet) throws PetClinicException;
/**
* Save a Visit to the datastore,
* either inserting or updating it.
*
* @param visit the Visit to save
* @see org.codehaus.enunciate.samples.petclinic.schema.Entity#isNew
*/
void storeVisit(Visit visit) throws PetClinicException;
}