org.zeroexchange.resource.stock
Class DefaultStockManager

java.lang.Object
  extended by org.zeroexchange.common.AbstractBeansRegistry<T>
      extended by org.zeroexchange.common.TypedBeansRegistry<P>
          extended by org.zeroexchange.common.processors.AbstractDataProcessorsRegistry<ResourceStockManager>
              extended by org.zeroexchange.resource.stock.DefaultStockManager
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.InitializingBean, BeansRegistry<ResourceStockManager>, StockManager

@Transactional
public class DefaultStockManager
extends AbstractDataProcessorsRegistry<ResourceStockManager>
implements StockManager

Author:
black

Constructor Summary
DefaultStockManager()
           
 
Method Summary
 void freeAmount(ResourceTender resourceTender, Resource resource)
          Reserves resource amount.
protected  Class<?> getBeanClass()
           
 BigDecimal getConsumeAmount(Resource resource)
          Returns consume amount for the resource.
protected  ResourceStockManager getProcessor(Resource resource)
          Returns processor by the category's alias.
 BigDecimal getSupplyAmount(Resource resource)
          Returns supply amount for the resource.
 BigDecimal getUserAvailableAmount(Resource resource, User user)
          Returns resource category.
 boolean isAmountManagementEnabled(Resource resource, TenderType tenderType)
          Returns true of the amount management is enabled.
 boolean isAutoMovementEnabled(Resource resource)
          Returns true if the stock auto-movement is enabled for the specified resource.
 boolean isPriceManagementEnabled(Resource resource)
          Returns true if the price management is enabled for the specified resource.
 void performAutoMovement(Integer contractId)
          Performs automatic stuff movement.
 void reserveAmount(ResourceTender resourceTender, Resource resource)
          Reserves resource amount.
 
Methods inherited from class org.zeroexchange.common.processors.AbstractDataProcessorsRegistry
getProcessor, getProcessors, isElected
 
Methods inherited from class org.zeroexchange.common.TypedBeansRegistry
afterPropertiesSet
 
Methods inherited from class org.zeroexchange.common.AbstractBeansRegistry
createBeansCollection, getBeans, postProcessAfterInitialization, postProcessBeforeInitialization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultStockManager

public DefaultStockManager()
Method Detail

getUserAvailableAmount

public BigDecimal getUserAvailableAmount(Resource resource,
                                         User user)
Returns resource category.

Specified by:
getUserAvailableAmount in interface StockManager

reserveAmount

public void reserveAmount(ResourceTender resourceTender,
                          Resource resource)
Reserves resource amount.

Specified by:
reserveAmount in interface StockManager

freeAmount

public void freeAmount(ResourceTender resourceTender,
                       Resource resource)
Reserves resource amount.

Specified by:
freeAmount in interface StockManager

performAutoMovement

public void performAutoMovement(Integer contractId)
Performs automatic stuff movement.

Specified by:
performAutoMovement in interface StockManager

isAutoMovementEnabled

public boolean isAutoMovementEnabled(Resource resource)
Returns true if the stock auto-movement is enabled for the specified resource.

Specified by:
isAutoMovementEnabled in interface StockManager

isPriceManagementEnabled

public boolean isPriceManagementEnabled(Resource resource)
Returns true if the price management is enabled for the specified resource.

Specified by:
isPriceManagementEnabled in interface StockManager

isAmountManagementEnabled

public boolean isAmountManagementEnabled(Resource resource,
                                         TenderType tenderType)
Returns true of the amount management is enabled.

Specified by:
isAmountManagementEnabled in interface StockManager

getProcessor

protected ResourceStockManager getProcessor(Resource resource)
Returns processor by the category's alias.


getSupplyAmount

public BigDecimal getSupplyAmount(Resource resource)
Returns supply amount for the resource.

Specified by:
getSupplyAmount in interface StockManager

getConsumeAmount

public BigDecimal getConsumeAmount(Resource resource)
Returns consume amount for the resource.

Specified by:
getConsumeAmount in interface StockManager

getBeanClass

protected Class<?> getBeanClass()
Specified by:
getBeanClass in class TypedBeansRegistry<ResourceStockManager>


Copyright © 2013. All Rights Reserved.