org.cocome.tradingsystem.inventory.data.store.impl
Class StoreQueryImpl

java.lang.Object
  extended by org.cocome.tradingsystem.inventory.data.store.impl.StoreQueryImpl
All Implemented Interfaces:
StoreQueryIf

public class StoreQueryImpl
extends java.lang.Object
implements StoreQueryIf

Author:
Yannick Welsch

Constructor Summary
StoreQueryImpl()
           
 
Method Summary
 java.util.Collection<StockItem> getStockItems(long storeId, long[] productIds, PersistenceContext pctx)
           
 java.util.Collection<StockItem> queryAllStockItems(long storeId, PersistenceContext pctx)
           
 java.util.Collection<StockItem> queryLowStockItems(long storeId, PersistenceContext pctx)
          queries the stockitems which are low on stock
 ProductOrder queryOrderById(long orderId, PersistenceContext pctx)
          The following methods from StoreIf use this method: List orderProducts(ComplexOrderTO complexOrder, StoreTO storeTO); ComplexOrderTO getOrder(int orderId); void rollInReceivedOrder(ComplexOrderTO complexOrder, StoreTO store);
 Product queryProductById(long productId, PersistenceContext pctx)
           
 java.util.Collection<Product> queryProducts(long storeId, PersistenceContext pctx)
           
 StockItem queryStockItem(long storeId, long productbarcode, PersistenceContext pctx)
          The following methods from StoreIf use this method: ProductWithStockItemTO getProductWithStockItem(int productBarCode);
 StockItem queryStockItemById(long stockId, PersistenceContext pctx)
           
 Store queryStoreById(long storeId, PersistenceContext pctx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreQueryImpl

public StoreQueryImpl()
Method Detail

queryLowStockItems

public java.util.Collection<StockItem> queryLowStockItems(long storeId,
                                                          PersistenceContext pctx)
Description copied from interface: StoreQueryIf
queries the stockitems which are low on stock

Specified by:
queryLowStockItems in interface StoreQueryIf
Parameters:
storeId - A unique identifier of a Store object
pctx - the persistence context
Returns:
A list of StockItem objects

queryAllStockItems

public java.util.Collection<StockItem> queryAllStockItems(long storeId,
                                                          PersistenceContext pctx)
Specified by:
queryAllStockItems in interface StoreQueryIf
Parameters:
storeId - A unique identifier of a Store object
pctx - the persistence context
Returns:
A list of StockItem objects

queryOrderById

public ProductOrder queryOrderById(long orderId,
                                   PersistenceContext pctx)
Description copied from interface: StoreQueryIf
The following methods from StoreIf use this method: List orderProducts(ComplexOrderTO complexOrder, StoreTO storeTO); ComplexOrderTO getOrder(int orderId); void rollInReceivedOrder(ComplexOrderTO complexOrder, StoreTO store);

Specified by:
queryOrderById in interface StoreQueryIf
Parameters:
orderId - A unique identifier of an ProductOrder object
pctx - the persistence context
Returns:
An ProductOrder object which has the specified id

queryStoreById

public Store queryStoreById(long storeId,
                            PersistenceContext pctx)
Specified by:
queryStoreById in interface StoreQueryIf
Parameters:
storeId - A unique identifier of a Store object
pctx - the persistence context
Returns:
A Store object which has the the specified id

queryProducts

public java.util.Collection<Product> queryProducts(long storeId,
                                                   PersistenceContext pctx)
Specified by:
queryProducts in interface StoreQueryIf
Parameters:
storeId - A unique identifier of a Store object
pctx - the persistence context
Returns:
The products owned by this store

queryStockItem

public StockItem queryStockItem(long storeId,
                                long productbarcode,
                                PersistenceContext pctx)
Description copied from interface: StoreQueryIf
The following methods from StoreIf use this method: ProductWithStockItemTO getProductWithStockItem(int productBarCode);

Specified by:
queryStockItem in interface StoreQueryIf
Parameters:
storeId - A unique identifier of a Store object
pctx - the persistence context
Returns:
the stockitem from the Store with storeId and being of product type with barcode productbarcode. Return null if the product was not found in the store.

queryStockItemById

public StockItem queryStockItemById(long stockId,
                                    PersistenceContext pctx)
Specified by:
queryStockItemById in interface StoreQueryIf
Parameters:
stockId - A unique identifier of a StockItem object
Returns:
the StockItem which has this id

queryProductById

public Product queryProductById(long productId,
                                PersistenceContext pctx)
Specified by:
queryProductById in interface StoreQueryIf
Parameters:
productId - A unique identifier of a Product object
pctx - the persistence context
Returns:
the Product which has this id

getStockItems

public java.util.Collection<StockItem> getStockItems(long storeId,
                                                     long[] productIds,
                                                     PersistenceContext pctx)
Specified by:
getStockItems in interface StoreQueryIf
Parameters:
storeId - The store to search StockItems for.
productIds - The products to look up in the stock
pctx - the persistence context
Returns:
The products as StockItems (including amounts)