public interface OpenBookService
Service Factory
.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_UNIT_NAME |
Modifier and Type | Method and Description |
---|---|
void |
clean()
Cleans everything.
|
long |
count(Class<?> cls)
Count the number of instances of the given persistent type.
|
PurchaseOrder |
deliver(PurchaseOrder order)
Delivers the given order.
|
<T> List<T> |
getExtent(Class<T> entity) |
List<PurchaseOrder> |
getOrders(PurchaseOrder.Status status,
Customer customer)
Gets the list of orders of given status.
|
String |
getQuery(String title,
Double min,
Double max,
String author)
Gets the query String for the given parameters.
|
List<Inventory> |
getReorderableBooks(int limit)
Gets the list of Books whose inventory is lower than the given limit.
|
javax.persistence.EntityManagerFactory |
getUnit()
Gets the underlying persistence unit.
|
String |
getUnitName()
Gets the name of the underlying persistence unit.
|
boolean |
initialize(Map<String,Object> loadParameters)
Populates the underlying data repository with sample values, only if
the data repository is empty.
|
boolean |
isManaged()
Affirms if the transaction on this persistence unit is managed by a container.
|
Customer |
login(String name)
Starts a session for the given named Customer.
|
PurchaseOrder |
placeOrder(ShoppingCart cart)
Buys the content of the given cart.
|
<T> List<T> |
query(String jpql,
Class<T> resultClass,
QueryDecorator... decorators)
Runs an arbitrary JPQL query to return a list of result.
|
List<Book> |
select(String title,
Double min,
Double max,
String author,
QueryDecorator... decorators)
Selects a list of Books matching the given conditions.
|
Book |
supply(Book b,
int quantity)
Add inventory of the given Book by the given quantity.
|
static final String DEFAULT_UNIT_NAME
Customer login(String name)
name
- name of a possibly existing customer. Or a new one.List<Book> select(String title, Double min, Double max, String author, QueryDecorator... decorators)
title
- title of the Bookmin
- minimum pricemax
- maximum priceauthor
- name of authordecorators
- to modify the executable query such as its range.String getQuery(String title, Double min, Double max, String author)
title
- title of the Bookmin
- minimum pricemax
- maximum priceauthor
- name of authordecorators
- to modify the executable query such as its range.<T> List<T> query(String jpql, Class<T> resultClass, QueryDecorator... decorators)
jpql
- a valid JPQL query string.resultClass
- type of the result.decorators
- zero or more QueryDecorators to be applied before Query is executed.PurchaseOrder placeOrder(ShoppingCart cart)
cart
- a non-empty cart.PurchaseOrder deliver(PurchaseOrder order)
order
- a PENDING order to be delivered.Book supply(Book b, int quantity)
b
- a Book whose inventory is to be incrementedquantity
- positive number.List<PurchaseOrder> getOrders(PurchaseOrder.Status status, Customer customer)
status
- status of the orders. null implies all orders.List<Inventory> getReorderableBooks(int limit)
limit
- reorder limit. null implies all inventory.long count(Class<?> cls)
cls
- a persistent type.boolean initialize(Map<String,Object> loadParameters)
loadParameters
- control the number of Books etc. to be created.
null is allowed.void clean()
javax.persistence.EntityManagerFactory getUnit()
String getUnitName()
boolean isManaged()
Copyright © 2006–2018 Apache Software Foundation. All rights reserved.