com.elasticpath.domain.shipping.impl
Class ShippingServiceLevelImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.shipping.impl.ShippingServiceLevelImpl
All Implemented Interfaces:
Entity, EpDomain, Persistence, ShippingServiceLevel, java.io.Serializable

public class ShippingServiceLevelImpl
extends AbstractEntityImpl
implements ShippingServiceLevel

A ShippingRegion represents a region that will be associated with one or more shipping services. For now, it is composed of country and a subcountry, i.e. CA(country) and BC(subcountry).

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Fields inherited from interface com.elasticpath.domain.shipping.ShippingServiceLevel
LOCALIZED_PROPERTY_NAME
 
Constructor Summary
ShippingServiceLevelImpl()
           
 
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.
 java.lang.String getCarrier()
           
 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.
 void setCarrier(java.lang.String carrier)
           
 void setLocalizedProperties(LocalizedProperties localizedProperties)
          Sets the LocalizedProperties.
 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.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setDefaultValues, setGuid
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Entity
getGuid, setGuid
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

ShippingServiceLevelImpl

public ShippingServiceLevelImpl()
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

getCarrier

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

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.

setCarrier

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

setLocalizedProperties

public void setLocalizedProperties(LocalizedProperties localizedProperties)
Sets the LocalizedProperties.

Parameters:
localizedProperties - the LocalizedProperties

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.