public class PetStoreService extends AbstractPersistenceService
Uses JPA persistence to store and retrieve PetStore DTOs.
JPA beans are defined in META-INF/persistence.xml
.
Constructor and Description |
---|
PetStoreService() |
Modifier and Type | Method and Description |
---|---|
Order |
create(CreateOrder c) |
Pet |
create(CreatePet c) |
User |
create(User c) |
Map<PetStatus,Integer> |
getInventory() |
Order |
getOrder(long id) |
List<Order> |
getOrders() |
Pet |
getPet(long id) |
List<Pet> |
getPets() |
Collection<Pet> |
getPetsByStatus(PetStatus[] status) |
Collection<Pet> |
getPetsByTags(String[] tags) |
User |
getUser(String username) |
List<User> |
getUsers() |
PetStoreService |
initDirect(PrintWriter w)
Initialize the petstore database using JPA.
|
PetStoreService |
initViaRest(PrintWriter w)
Initialize the petstore database by using a remote resource interface against our REST.
|
boolean |
isValid(String username,
String password) |
void |
removeOrder(long id) |
void |
removePet(long id) |
void |
removeUser(String username) |
Order |
update(Order o) |
Pet |
update(UpdatePet u) |
User |
update(User u) |
public PetStoreService()
public PetStoreService initDirect(PrintWriter w) throws Exception
w
- Console output.Exception
public PetStoreService initViaRest(PrintWriter w) throws Exception
w
- Console output.Exception
public Pet getPet(long id) throws IdNotFound
IdNotFound
public Order getOrder(long id) throws IdNotFound
IdNotFound
public User getUser(String username) throws InvalidUsername, IdNotFound
InvalidUsername
IdNotFound
public Order create(CreateOrder c)
public Pet update(UpdatePet u) throws IdNotFound
IdNotFound
public Order update(Order o) throws IdNotFound
IdNotFound
public User update(User u) throws IdNotFound, InvalidUsername
IdNotFound
InvalidUsername
public void removePet(long id) throws IdNotFound
IdNotFound
public void removeOrder(long id) throws IdNotFound
IdNotFound
public void removeUser(String username) throws IdNotFound
IdNotFound
public Collection<Pet> getPetsByStatus(PetStatus[] status)
public Collection<Pet> getPetsByTags(String[] tags) throws InvalidTag
InvalidTag
public Map<PetStatus,Integer> getInventory()
Copyright © 2018 Apache. All rights reserved.