org.zeroexchange.resource.read
Class DefaultResourceInformant

java.lang.Object
  extended by org.zeroexchange.resource.read.DefaultResourceInformant
All Implemented Interfaces:
ResourceInformant

public class DefaultResourceInformant
extends Object
implements ResourceInformant

Author:
black

Constructor Summary
DefaultResourceInformant()
           
 
Method Summary
 BigDecimal getConsumeAmount(Resource resource)
          Returns the total confirmed consume amount of the resource.
 BigDecimal getProductionHours(Resource resource)
          Returns total production hours of the 'accepted' supplies.
 String getResourceUOM(Resource resource)
          Returns UOM's name for the resource.
 BigDecimal getSupplyAmount(Resource resource)
          Returns the total confirmed supply amount of the resource.
 Date getSupplyDate(Resource resource)
          Returns resource supply date.
 BigDecimal getUserContributionPrice(Resource resource, User user, ZECurrency currency)
          Returns value of the contribution made by the specified user into the specified resource.
 ResourceTender getUserTender(Resource resource, Integer userId)
          Returns the user's tender.
 BigDecimal getValue(Resource resource)
          Returns the 'accepted' resource supply price in the specified currency.
 String getValueUOM(Resource resource)
          Returns UOM's name for the exchange worth of the resource.
 boolean hasConsumers(Resource resource, User excludedUser)
          Returns true if the resource has at least one consumer.
 boolean hasSuppliers(Resource resource, User excludedUser)
          Returns true if the resource has at least one supplier.
 boolean isAcceptedTendersCountExceeded(Resource resource, Class<? extends ResourceTender> tenderClass)
          Returns true if allowed tenders count is exceeded.
 boolean isUserConsumer(Resource resource, Integer userId)
          Returns true if the user is the consumer of the specified resource.
 boolean isUserSupplier(Resource resource, Integer userId)
          Returns true if the user is the supplier of the specified resource.
 void setSessionUOMKey(String sessionUOMKey)
           
 void setUnknownUOMKey(String unknownUOMKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceInformant

public DefaultResourceInformant()
Method Detail

setUnknownUOMKey

public void setUnknownUOMKey(String unknownUOMKey)

setSessionUOMKey

public void setSessionUOMKey(String sessionUOMKey)

getSupplyAmount

public BigDecimal getSupplyAmount(Resource resource)
Returns the total confirmed supply amount of the resource. NOTE: should never return null.

Specified by:
getSupplyAmount in interface ResourceInformant

getConsumeAmount

public BigDecimal getConsumeAmount(Resource resource)
Returns the total confirmed consume amount of the resource. NOTE: should never return null.

Specified by:
getConsumeAmount in interface ResourceInformant

getUserTender

public ResourceTender getUserTender(Resource resource,
                                    Integer userId)
Returns the user's tender.

Specified by:
getUserTender in interface ResourceInformant

isUserConsumer

public boolean isUserConsumer(Resource resource,
                              Integer userId)
Returns true if the user is the consumer of the specified resource. If the resource is null, the method searches over all resources.

Specified by:
isUserConsumer in interface ResourceInformant

isUserSupplier

public boolean isUserSupplier(Resource resource,
                              Integer userId)
Returns true if the user is the supplier of the specified resource. If the resource is null, the method searches over all resources.

Specified by:
isUserSupplier in interface ResourceInformant

getValue

public BigDecimal getValue(Resource resource)
Returns the 'accepted' resource supply price in the specified currency.

Specified by:
getValue in interface ResourceInformant

getProductionHours

public BigDecimal getProductionHours(Resource resource)
Returns total production hours of the 'accepted' supplies.

Specified by:
getProductionHours in interface ResourceInformant

getUserContributionPrice

public BigDecimal getUserContributionPrice(Resource resource,
                                           User user,
                                           ZECurrency currency)
Returns value of the contribution made by the specified user into the specified resource.

Specified by:
getUserContributionPrice in interface ResourceInformant

isAcceptedTendersCountExceeded

public boolean isAcceptedTendersCountExceeded(Resource resource,
                                              Class<? extends ResourceTender> tenderClass)
Returns true if allowed tenders count is exceeded.

Specified by:
isAcceptedTendersCountExceeded in interface ResourceInformant

hasConsumers

public boolean hasConsumers(Resource resource,
                            User excludedUser)
Returns true if the resource has at least one consumer.

Specified by:
hasConsumers in interface ResourceInformant

hasSuppliers

public boolean hasSuppliers(Resource resource,
                            User excludedUser)
Returns true if the resource has at least one supplier.

Specified by:
hasSuppliers in interface ResourceInformant

getSupplyDate

public Date getSupplyDate(Resource resource)
Returns resource supply date.

Specified by:
getSupplyDate in interface ResourceInformant

getResourceUOM

public String getResourceUOM(Resource resource)
Returns UOM's name for the resource. If the resource is a good, it returns Kilogram/Liter/Each/etc..., If the resource is a service, it returns "Session" It the resource is a currency, it returns the currency name

Specified by:
getResourceUOM in interface ResourceInformant

getValueUOM

public String getValueUOM(Resource resource)
Description copied from interface: ResourceInformant
Returns UOM's name for the exchange worth of the resource.

Specified by:
getValueUOM in interface ResourceInformant


Copyright © 2013. All Rights Reserved.