org.cocome.tradingsystem.inventory.application.store.impl
Class StoreImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.cocome.tradingsystem.inventory.application.store.impl.StoreImpl
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, CashDeskConnectorIf, StoreIf

public class StoreImpl
extends java.rmi.server.UnicastRemoteObject
implements StoreIf, CashDeskConnectorIf

Author:
Yannick Welsch
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
StoreImpl(long storeid)
           
 
Method Summary
 void bookSale(SaleTO saleTO)
          Registers the selling of products contained in the stock of the store.
 ProductWithStockItemTO changePrice(StockItemTO stockItemTO)
          Updates sales price of a stock item.
 java.util.List<ProductWithSupplierTO> getAllProducts()
          Determines all products of the portfolio of a given store and the supplier for each of them.
 java.util.List<ProductWithSupplierAndStockItemTO> getAllProductsWithOptionalStockItem()
          Determines all products of the portfolio of a given store and the supplier for each of them.
 ComplexOrderTO getOrder(long orderId)
          Returns order information for a given order id.
 java.util.List<ProductWithStockItemTO> getProductsWithLowStock()
          Determines products and stock items which are nearly out of stock, meaning amount is lower than 10% of maximal stock.
 ProductWithStockItemTO getProductWithStockItem(long productBarCode)
          Determines product and the item in the stock of the store by the given barcode.
 ComplexOrderEntryTO[] getStockItems(ProductTO[] requiredProductTOs)
           
 StoreWithEnterpriseTO getStore()
          Gets transfer object with information of the store in which the component is running.
 void markProductsUnavailableInStock(ProductMovementTO requiredProductsAndAmount)
           
 java.util.List<ComplexOrderTO> orderProducts(ComplexOrderTO complexOrder)
          Creates a list of orders for different suppliers for an initial list of products to be ordered by a store.
 void rollInReceivedOrder(ComplexOrderTO complexOrderTO)
          Updates stocks after order delivery.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoreImpl

public StoreImpl(long storeid)
          throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

changePrice

public ProductWithStockItemTO changePrice(StockItemTO stockItemTO)
Description copied from interface: StoreIf
Updates sales price of a stock item. Used for realization of UC 7.

Specified by:
changePrice in interface StoreIf
Parameters:
stockItemTO - Stock item with new price.
Returns:
Returns instance of ProductWithStockItemTO which holds product information and updated price information for stock item identified by stockItemTO.

getAllProducts

public java.util.List<ProductWithSupplierTO> getAllProducts()
Description copied from interface: StoreIf
Determines all products of the portfolio of a given store and the supplier for each of them. Used for realization of UC 3.

Specified by:
getAllProducts in interface StoreIf
Returns:
Returns a list of products and their suppliers

getAllProductsWithOptionalStockItem

public java.util.List<ProductWithSupplierAndStockItemTO> getAllProductsWithOptionalStockItem()
Description copied from interface: StoreIf
Determines all products of the portfolio of a given store and the supplier for each of them. Additionally the corresponding stockitems are queried

Specified by:
getAllProductsWithOptionalStockItem in interface StoreIf
Returns:
Returns a list of products, their suppliers and the corresponding StockItem if they have any

getOrder

public ComplexOrderTO getOrder(long orderId)
Description copied from interface: StoreIf
Returns order information for a given order id. Used for realization of UC 4.

Specified by:
getOrder in interface StoreIf
Parameters:
orderId - The id of the order.
Returns:
Detailed order information of the desired order. NULL, if there is no order with the given id.

getProductsWithLowStock

public java.util.List<ProductWithStockItemTO> getProductsWithLowStock()
Description copied from interface: StoreIf
Determines products and stock items which are nearly out of stock, meaning amount is lower than 10% of maximal stock. Used for realization of UC 3.

Specified by:
getProductsWithLowStock in interface StoreIf
Returns:
Returns a list of products and their stock item in the given store.

getStore

public StoreWithEnterpriseTO getStore()
Description copied from interface: StoreIf
Gets transfer object with information of the store in which the component is running. This information is retrieved by the component during configuration and initialization.

Specified by:
getStore in interface StoreIf
Returns:
Store and enterprise information about the local store.

orderProducts

public java.util.List<ComplexOrderTO> orderProducts(ComplexOrderTO complexOrder)
Description copied from interface: StoreIf
Creates a list of orders for different suppliers for an initial list of products to be ordered by a store. ProductOrder is persisted and ordering date is set to date of method execution. Used for realization of UC 3.

Specified by:
orderProducts in interface StoreIf
Parameters:
complexOrder - Initial order which contains all products to be ordered.
Returns:
Returns a list of orders, one for each supplier that is affected.

rollInReceivedOrder

public void rollInReceivedOrder(ComplexOrderTO complexOrderTO)
Description copied from interface: StoreIf
Updates stocks after order delivery. Adds amount of ordered items to the stock items of the store. Sets delivery date to date of method execution. Used for realization of UC 4.

Specified by:
rollInReceivedOrder in interface StoreIf
Parameters:
complexOrderTO - Contains the order which is rolled in.

bookSale

public void bookSale(SaleTO saleTO)
Description copied from interface: CashDeskConnectorIf
Registers the selling of products contained in the stock of the store. Updates amount of stock items. Used for realization of UC 1.

Specified by:
bookSale in interface CashDeskConnectorIf
Parameters:
saleTO - The sale to be registered in stock.

getProductWithStockItem

public ProductWithStockItemTO getProductWithStockItem(long productBarCode)
                                               throws NoSuchProductException
Description copied from interface: CashDeskConnectorIf
Determines product and the item in the stock of the store by the given barcode. Used for realization of UC 1 and UC 4

Specified by:
getProductWithStockItem in interface CashDeskConnectorIf
Parameters:
productBarCode - Contains the given barcode
Returns:
Returns a ProductWithStockItemTO instance which contains the identified product which is linked to the stock item of the store. NULL, if barcode cannot be matched.
Throws:
NoSuchProductException

getStockItems

public ComplexOrderEntryTO[] getStockItems(ProductTO[] requiredProductTOs)
Specified by:
getStockItems in interface StoreIf
Parameters:
requiredProductTOs - The products to look up in the stock
Returns:
The products including amounts from the stock

markProductsUnavailableInStock

public void markProductsUnavailableInStock(ProductMovementTO requiredProductsAndAmount)
                                    throws java.rmi.RemoteException,
                                           ProductNotAvailableException
Specified by:
markProductsUnavailableInStock in interface StoreIf
Parameters:
requiredProductsAndAmount - The product required at another store; includes the amount of required products.
Throws:
ProductNotAvailableException - Thrown if the local stock of the required product is less than the required amount.
java.rmi.RemoteException