Class ZoneDeliveryMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class ZoneDeliveryMode
    extends GeneratedZoneDeliveryMode
    Represents a delivery mode, which values depend upon a minimum property, the requested currency and the requested country. Since one value may match multiple countries it is called 'zone' dependent instead of 'country' dependent.
    See Also:
    Serialized Form
    • Field Detail

      • PROPERTY_NAME

        @Deprecated
        public static final java.lang.String PROPERTY_NAME
        Deprecated.
        since ages
        See Also:
        Constant Field Values
    • Constructor Detail

      • ZoneDeliveryMode

        public ZoneDeliveryMode()
    • Method Detail

      • 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 DeliveryMode
        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
      • setModeIsUsingPrice

        public void setModeIsUsingPrice()
        Convenience method for setting the special price property name.
      • isModeUsingPrice

        public boolean isModeUsingPrice()
        Tells whether or not this mode is using the order subtotal as calculation base.
      • getZones

        public java.util.Collection<Zone> getZones()
        Returns all zones for which price values are defined in this delivery mode.
      • getValue

        public ZoneDeliveryModeValue getValue​(Zone zone,
                                              Currency currency,
                                              double min)
        Finds a specific value for a given zone, currency and minimum.
        Returns:
        the value with the specified settings or null if no such value exists
      • getCost

        @Deprecated
        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.
        Description copied from class: DeliveryMode
        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.

        Overrides:
        getCost in class DeliveryMode
        Parameters:
        ctx - session context
        order - the order to calculate costs for
        Throws:
        JaloDeliveryModeException
      • parseItemProperty

        protected java.lang.Double parseItemProperty​(SessionContext ctx,
                                                     Item item,
                                                     java.lang.String propertyName)
      • getAmbigousZones

        protected java.util.Map<Country,​java.util.Set<Zone>> getAmbigousZones​(java.util.Set<Zone> zones)
      • isZoneAllowed

        public boolean isZoneAllowed​(Zone toCheck)
        Tells whether or not a zone is allowed to be used for adding new values to this delivery mode. This is necessary because two zones may share countries so the delivery mode can no longer calculate distinct prices for a given country.

        If a new ZoneDeliveryModeValue is tried to be created with such a disallowed zone a ConsistencyCheckException is thrown!