Class DeliveryMode

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
GeneratedPickUpDeliveryMode, GeneratedZoneDeliveryMode, TestDeliveryMode

public class DeliveryMode extends GeneratedDeliveryMode
Basis class of all DeliveryModes.
See Also:
  • Constructor Details

    • DeliveryMode

      public DeliveryMode()
  • Method Details

    • createItem

      protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
      Description copied from class: Item
      Has to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) during ComposedType.newInstance(Map).

      In case this method uses any of the attribute values during creation it is required to override Item.getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
      Sn example:

      
       public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
       ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
       man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
       // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
       SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
       super.getNonInitialAttributes( ctx, allAttributes );
       // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
      
       
      Overrides:
      createItem in class GenericItem
      Parameters:
      ctx - the current session context which this item is created within
      type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
      Returns:
      the new item instance
      Throws:
      JaloBusinessException - indicates an error during creation - any changes will be rollbacked
    • getAllNames

      @Deprecated(since="ages", forRemoval=false) public Map getAllNames(SessionContext ctx)
      Gets all names (in all languages).
      Parameters:
      ctx - A SessionContext object
      Returns:
      map with following combination key:language, value:name
    • setAllNames

      @Deprecated(since="ages", forRemoval=false) public void setAllNames(SessionContext ctx, Map names)
      Sets names (in all languages).
      Parameters:
      ctx - A SessionContext object
      names - map with following combination key:language, value:name
    • getAllDescriptions

      @Deprecated(since="ages", forRemoval=false) public Map getAllDescriptions(SessionContext ctx)
      Gets all descriptions (in all languages).
      Parameters:
      ctx - A SessionContext object
      Returns:
      map with following combination key:language, value:description
    • setAllDescriptions

      @Deprecated(since="ages", forRemoval=false) public void setAllDescriptions(SessionContext ctx, Map descriptions)
      Sets descriptions (in all languages).
      Parameters:
      ctx - A SessionContext object
      descriptions - map with following combination key:language, value:description
    • setCode

      public void setCode(String code) throws ConsistencyCheckException
      Sets the code of this delivery mode.
      Overrides:
      setCode in class GeneratedDeliveryMode
      Parameters:
      code - new code for this mode
      Throws:
      ConsistencyCheckException - if there is a mode given code already
    • setCode

      public void setCode(SessionContext ctx, String code) throws ConsistencyCheckException
      Sets the code of this delivery mode.
      Overrides:
      setCode in class GeneratedDeliveryMode
      Parameters:
      code - new code for this mode
      Throws:
      ConsistencyCheckException - if there is a mode given code already
    • getCost

      @Deprecated(since="ages", forRemoval=false) public PriceValue getCost(SessionContext ctx, AbstractOrder order) throws JaloDeliveryModeException
      Deprecated.
      {@link de.hybris.platform.order.strategies.calculation.FindDeliveryCostStrategy.getDeliveryCost(AbstractOrderModel)} when the Hybris Platform is configured to use the service-layer based (the 'pdt.calculation.mode' is set to the 'sl' value) cart calculation (prices, tax & discounts) processing strategy.
      Calculates the delivery cost of this mode for a given order. This is called when the specified order is calculated the first time or recalculated.

      This default implementation always returns 0 costs. each subtype may override this method to implement its own cost model.

      Parameters:
      ctx - session context
      order - the order to calculate costs for
      Throws:
      JaloDeliveryModeException
    • getCost

      public PriceValue getCost(AbstractOrder order) throws JaloDeliveryModeException
      Deprecated.
      {@link de.hybris.platform.order.strategies.calculation.FindDeliveryCostStrategy.getDeliveryCost(AbstractOrderModel)} when the Hybris Platform is configured to use the service-layer based (the 'pdt.calculation.mode' is set to the 'sl' value) cart calculation (prices, tax & discounts) processing strategy.
      Calculates the delivery cost of this mode for a given order. This is called when the specified order is calculated the first time or recalculated.

      This default implementation always returns 0 costs.

      Parameters:
      order - the order to calculate costs for
      Throws:
      JaloDeliveryModeException
    • getSupportedPaymentModes

      public Collection<PaymentMode> getSupportedPaymentModes(SessionContext ctx)
      Gets all payment modes supported by this delivery mode.
      Specified by:
      getSupportedPaymentModes in class GeneratedDeliveryMode
      Returns:
      the supportedPaymentModes
    • setSupportedPaymentModes

      public void setSupportedPaymentModes(SessionContext ctx, Collection paymentModes)
      Sets all payment modes supported by this delivery mode.
      Specified by:
      setSupportedPaymentModes in class GeneratedDeliveryMode
      paymentModes - the supportedPaymentModes
    • addSupportedPaymentMode

      public void addSupportedPaymentMode(PaymentMode paymentMode)
      Adds support of given payment mode.
    • removeSupportedPaymentMode

      public void removeSupportedPaymentMode(PaymentMode paymentMode)
      Removes support of given payment mode.
    • isSupportedPaymentMode

      public boolean isSupportedPaymentMode(PaymentMode paymentMode)
      Checks whether given payment mode is supported for this delivery mode.
    • checkRemovable

      protected void checkRemovable(SessionContext ctx) throws ConsistencyCheckException
      Description copied from class: Item
      Checks whether or not this it may be removed or not. Called before the actual removal process.
      Overrides:
      checkRemovable in class Item
      Throws:
      ConsistencyCheckException - to indicate that the item cannot be removed