com.elasticpath.sfweb.ajax.bean.impl
Class ShippingServiceLevelBeanImpl

java.lang.Object
  extended by com.elasticpath.sfweb.ajax.bean.impl.ShippingServiceLevelBeanImpl
All Implemented Interfaces:
Entity, EpDomain, Persistence, ShippingServiceLevel, ShippingServiceLevelBean, java.io.Serializable

public class ShippingServiceLevelBeanImpl
extends java.lang.Object
implements ShippingServiceLevelBean

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.elasticpath.domain.shipping.ShippingServiceLevel
LOCALIZED_PROPERTY_NAME
 
Constructor Summary
ShippingServiceLevelBeanImpl(ShippingServiceLevel shippingServiceLevel, java.util.Locale locale)
          Wraps a ShippingServiceLevel object for easy localized dwr conversion.
 
Method Summary
 Money calculateRegularPriceShippingCost(ShoppingCart shoppingCart)
          Returns the shipping cost before any discount has been applied.
 Money calculateShippingCost(ShoppingCart shoppingCart)
          Return the calculated, after-promotion shipping cost.
 void clearPromotions()
          Clears any discount that has been set for this shipping service level.
 void executeBeforePersistAction()
          Interceptor to perform tasks before persisting changes.
 java.lang.String getCarrier()
           
 java.lang.String getDisplayName()
          Return the ShippingServiceLevel name for the given locale.
 ElasticPath getElasticPath()
          Get the ElasticPath singleton.
 java.lang.String getGuid()
          Return the guid.
 java.util.Locale getLocale()
           
 LocalizedProperties getLocalizedProperties()
          Returns the LocalizedProperties.
 java.lang.String getName(java.util.Locale locale)
          Return the ShippingServiceLevel name for the given locale.
 Money getRegularPriceShippingCost()
          Return the calculted before-discount shipping cost (make sure calculateRegularPriceShippingCost has been invoked already).
 Money getShippingCost()
          Return the calculated, after-promotion shipping cost (make sure calculateShippingCost has been invoked already).
 ShippingCostCalculationMethod getShippingCostCalculationMethod()
          Get the shipping cost calculation method associated with this ShippingServiceLevel.
 ShippingRegion getShippingRegion()
          Get the shipping region associated with this ShippingServiceLevel.
 long getUidPk()
          Gets the unique identifier for this domain model object.
 boolean isPersistent()
          True if the object has previously been persisted.
 void setCarrier(java.lang.String carrier)
           
 void setDefaultValues()
          Set default values for those fields need default values.
 void setElasticPath(ElasticPath elasticPath)
          Inject the ElasticPath singleton.
 void setGuid(java.lang.String guid)
          Set the guid.
 void setLocale(java.util.Locale locale)
           
 void setShippingCostCalculationMethod(ShippingCostCalculationMethod shippingCostCalculationMethod)
          Set the shipping cost calculation method associated with this ShippingServiceLevel.
 void setShippingDiscount(Money discount)
          Applies a discount to this shipping service level.
 void setShippingRegion(ShippingRegion shippingRegion)
          Set the shipping region associated with this ShippingServiceLevel.
 void setUidPk(long uidPk)
          Sets the unique identifier for this domain model object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShippingServiceLevelBeanImpl

public ShippingServiceLevelBeanImpl(ShippingServiceLevel shippingServiceLevel,
                                    java.util.Locale locale)
Wraps a ShippingServiceLevel object for easy localized dwr conversion.

Parameters:
shippingServiceLevel - the ShippingServiceLevel to be wrapped.
locale - the current locale.
Method Detail

calculateRegularPriceShippingCost

public Money calculateRegularPriceShippingCost(ShoppingCart shoppingCart)
Returns the shipping cost before any discount has been applied.

Specified by:
calculateRegularPriceShippingCost in interface ShippingServiceLevel
Parameters:
shoppingCart - the shopping cart containing items to be shipped
Returns:
the regular price shipping cost.

calculateShippingCost

public Money calculateShippingCost(ShoppingCart shoppingCart)
Return the calculated, after-promotion shipping cost.

Specified by:
calculateShippingCost in interface ShippingServiceLevel
Parameters:
shoppingCart - the shopping cart containing items to be shipped
Returns:
the shipping cost.

clearPromotions

public void clearPromotions()
Clears any discount that has been set for this shipping service level.

Specified by:
clearPromotions in interface ShippingServiceLevel

executeBeforePersistAction

public void executeBeforePersistAction()
Interceptor to perform tasks before persisting changes.

Specified by:
executeBeforePersistAction in interface Persistence

getCarrier

public java.lang.String getCarrier()
Specified by:
getCarrier in interface ShippingServiceLevel
Returns:
Returns the carrier.

getDisplayName

public java.lang.String getDisplayName()
Return the ShippingServiceLevel name for the given locale.

Specified by:
getDisplayName in interface ShippingServiceLevelBean
Returns:
returns the localized name.

getElasticPath

public ElasticPath getElasticPath()
Get the ElasticPath singleton.

Specified by:
getElasticPath in interface EpDomain
Returns:
elasticpath the ElasticPath singleton.

getGuid

public java.lang.String getGuid()
Return the guid.

Specified by:
getGuid in interface Entity
Returns:
the guid.

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface ShippingServiceLevelBean
Returns:
the locale

getLocalizedProperties

public LocalizedProperties getLocalizedProperties()
Returns the LocalizedProperties.

Specified by:
getLocalizedProperties in interface ShippingServiceLevel
Returns:
the LocalizedProperties

getName

public java.lang.String getName(java.util.Locale locale)
Return the ShippingServiceLevel name for the given locale.

Specified by:
getName in interface ShippingServiceLevel
Parameters:
locale - the locale to retrieve the name.
Returns:
Returns the name.

getRegularPriceShippingCost

public Money getRegularPriceShippingCost()
Return the calculted before-discount shipping cost (make sure calculateRegularPriceShippingCost has been invoked already).

Specified by:
getRegularPriceShippingCost in interface ShippingServiceLevel
Returns:
the regular price shipping cost.

getShippingCost

public Money getShippingCost()
Return the calculated, after-promotion shipping cost (make sure calculateShippingCost has been invoked already). This method is intended for use when the shopping cart used in the calculation is no longer available (DWR outbound conversion)

Specified by:
getShippingCost in interface ShippingServiceLevel
Returns:
the shipping cost.

getShippingCostCalculationMethod

public ShippingCostCalculationMethod getShippingCostCalculationMethod()
Get the shipping cost calculation method associated with this ShippingServiceLevel.

Specified by:
getShippingCostCalculationMethod in interface ShippingServiceLevel
Returns:
shippingCostCalculationMethod.

getShippingRegion

public ShippingRegion getShippingRegion()
Get the shipping region associated with this ShippingServiceLevel.

Specified by:
getShippingRegion in interface ShippingServiceLevel
Returns:
the shippingRegion.

getUidPk

public long getUidPk()
Gets the unique identifier for this domain model object.

Specified by:
getUidPk in interface Persistence
Returns:
the unique identifier.

isPersistent

public boolean isPersistent()
True if the object has previously been persisted.

Specified by:
isPersistent in interface Persistence
Returns:
true if the object has previously been persisted.

setCarrier

public void setCarrier(java.lang.String carrier)
Specified by:
setCarrier in interface ShippingServiceLevel
Parameters:
carrier - The carrier to set.

setDefaultValues

public void setDefaultValues()
Set default values for those fields need default values.

Specified by:
setDefaultValues in interface Persistence

setElasticPath

public void setElasticPath(ElasticPath elasticPath)
Inject the ElasticPath singleton.

Specified by:
setElasticPath in interface EpDomain
Parameters:
elasticPath - the ElasticPath singleton.

setGuid

public void setGuid(java.lang.String guid)
Set the guid.

Specified by:
setGuid in interface Entity
Parameters:
guid - the guid to set.

setLocale

public void setLocale(java.util.Locale locale)
Specified by:
setLocale in interface ShippingServiceLevelBean
Parameters:
locale - the locale to set

setShippingCostCalculationMethod

public void setShippingCostCalculationMethod(ShippingCostCalculationMethod shippingCostCalculationMethod)
Set the shipping cost calculation method associated with this ShippingServiceLevel.

Specified by:
setShippingCostCalculationMethod in interface ShippingServiceLevel
Parameters:
shippingCostCalculationMethod - the shipping cost calculation method to be associated with this shippingServiceLevel.

setShippingDiscount

public void setShippingDiscount(Money discount)
Applies a discount to this shipping service level.

Specified by:
setShippingDiscount in interface ShippingServiceLevel
Parameters:
discount - the amount to be discounted

setShippingRegion

public void setShippingRegion(ShippingRegion shippingRegion)
Set the shipping region associated with this ShippingServiceLevel.

Specified by:
setShippingRegion in interface ShippingServiceLevel
Parameters:
shippingRegion - the shipping region to be associated with this shippingServiceLevel.

setUidPk

public void setUidPk(long uidPk)
Sets the unique identifier for this domain model object.

Specified by:
setUidPk in interface Persistence
Parameters:
uidPk - the new unique identifier.