Class AbstractPriceFactory
- java.lang.Object
-
- de.hybris.platform.jalo.Manager
-
- de.hybris.platform.jalo.extension.Extension
-
- de.hybris.platform.jalo.order.price.AbstractPriceFactory
-
- All Implemented Interfaces:
ItemLifecycleListener,PriceFactory,java.io.Serializable
- Direct Known Subclasses:
DummyPriceFactory,GeneratedEurope1PriceFactory
public abstract class AbstractPriceFactory extends Extension implements PriceFactory
The PriceFactory base class. All PriceFactory implementations must inherit from this class.A PriceFactory is responsible for calculating product price quotes as well as order prices. This may include the calcuation of taxes and discounts.
The Hybris Platform core does not have any default price model implemented but usually ships one PriceFactory implementation (in form of an extension) within the installation package. So please refer to the available extension documentation about which features this price model provides.
To implement a PriceFactory at least the following methods have to be implemented:
getBasePrice(AbstractOrderEntry)- provides the base price for aorder entrygetProductPriceInformations(Product, Date, boolean)- provides all prices which apply to aProductgetProductTaxInformations(Product, Date)- provides all taxes which apply to aProductgetProductDiscountInformations(Product, Date, boolean)- provides all discounts which apply to aProduct
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.extension.Extension
Extension.RestrictedLanguagesProvider, Extension.RightsProvider
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Manager
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator
-
-
Constructor Summary
Constructors Constructor Description AbstractPriceFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ProductPriceInformationsgetAllPriceInformations(Product product, java.util.Date date, boolean net)Deprecated.since ages - please usegetAllPriceInformations(SessionContext, Product, Date, boolean)insteadProductPriceInformationsgetAllPriceInformations(SessionContext ctx, Product product, java.util.Date date, boolean net)Calculates a product price quote containing all applicable prices, discounts and taxes for the given product and net/gross state.abstract PriceValuegetBasePrice(AbstractOrderEntry entry)override to define the base price of an order entryjava.util.ListgetDiscountValues(AbstractOrder order)override to define (global) discounts for an order.java.util.ListgetDiscountValues(AbstractOrderEntry entry)override to define discount values for an order entry.static AbstractPriceFactorygetInstance()java.util.ListgetProductDiscountInformations(Product product, java.util.Date date, boolean net)Deprecated.since ages - please usegetProductDiscountInformations(SessionContext, Product, Date, boolean)insteadabstract java.util.ListgetProductDiscountInformations(SessionContext ctx, Product product, java.util.Date date, boolean net)override this to show all discounts which may apply to the given productjava.util.ListgetProductPriceInformations(Product product, java.util.Date date, boolean net)Deprecated.since ages - please usegetProductPriceInformations(SessionContext, Product, Date, boolean)insteadabstract java.util.ListgetProductPriceInformations(SessionContext ctx, Product product, java.util.Date date, boolean net)Override this to show all prices available for the given productjava.util.ListgetProductTaxInformations(Product product, java.util.Date date)Deprecated.since ages - please usegetProductTaxInformations(SessionContext, Product, Date)insteadabstract java.util.ListgetProductTaxInformations(SessionContext ctx, Product product, java.util.Date date)override this to show all taxes which apply to the given productjava.util.CollectiongetTaxValues(AbstractOrderEntry entry)override to define tax values for an order entry.booleanisNetUser(User user)override to define whether a user should be treated as net or gross customer.-
Methods inherited from class de.hybris.platform.jalo.extension.Extension
checkBeforeItemRemoval, createEssentialData, createProjectData, createSampleData, getCreatorDescription, getCreatorName, getCreatorParameterDefault, getCreatorParameterNames, getCreatorParameterPossibleValues, getDefaultAttributeModes, getName, getRemote, isCreatorDisabled, notifyInitializationEnd, notifyInitializationStart, notifyItemRemoval, onFirstSessionCreation, writeReplace
-
Methods inherited from class de.hybris.platform.jalo.Manager
afterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, init, setAttribute, setTenant, setTransientObject, wrap
-
-
-
-
Method Detail
-
getInstance
public static AbstractPriceFactory getInstance()
-
getAllPriceInformations
@Deprecated public final ProductPriceInformations getAllPriceInformations(Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
Deprecated.since ages - please usegetAllPriceInformations(SessionContext, Product, Date, boolean)instead- Throws:
JaloPriceFactoryException- if a calculation error occured
-
getAllPriceInformations
public ProductPriceInformations getAllPriceInformations(SessionContext ctx, Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
Calculates a product price quote containing all applicable prices, discounts and taxes for the given product and net/gross state.This default implementation just calls
getProductPriceInformations(Product, Date, boolean),getProductTaxInformations(Product, Date)andgetProductDiscountInformations(Product, Date, boolean)and wraps the results inside aProductPriceInformationsobject.Override to define the prices, taxes and discounts for all occasions when no order or order entry is available, e.g. for product lists. Please take care also to override
getProductPriceInformations(Product, Date, boolean),getProductTaxInformations(Product, Date)andgetProductDiscountInformations(Product, Date, boolean)since these methods are called byProductdirectly.- Specified by:
getAllPriceInformationsin interfacePriceFactory- Throws:
JaloPriceFactoryException- if a calculation error occured- Since:
- 2.10
-
getProductPriceInformations
@Deprecated public final java.util.List getProductPriceInformations(Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
Deprecated.since ages - please usegetProductPriceInformations(SessionContext, Product, Date, boolean)instead- Parameters:
product- the productnet- the net/gross state of the requested prices- Returns:
- a list of
PriceInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductPriceInformations
public abstract java.util.List getProductPriceInformations(SessionContext ctx, Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
Override this to show all prices available for the given product- Specified by:
getProductPriceInformationsin interfacePriceFactory- Parameters:
product- the productnet- the net/gross state of the requested prices- Returns:
- a list of
PriceInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
getProductTaxInformations
@Deprecated public final java.util.List getProductTaxInformations(Product product, java.util.Date date) throws JaloPriceFactoryException
Deprecated.since ages - please usegetProductTaxInformations(SessionContext, Product, Date)instead- Parameters:
product- the product- Returns:
- a list of
TaxInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductTaxInformations
public abstract java.util.List getProductTaxInformations(SessionContext ctx, Product product, java.util.Date date) throws JaloPriceFactoryException
override this to show all taxes which apply to the given product- Specified by:
getProductTaxInformationsin interfacePriceFactory- Parameters:
product- the product- Returns:
- a list of
TaxInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
getProductDiscountInformations
@Deprecated public final java.util.List getProductDiscountInformations(Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
Deprecated.since ages - please usegetProductDiscountInformations(SessionContext, Product, Date, boolean)instead- Parameters:
product- the product- Returns:
- a list of
DiscountInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductDiscountInformations
public abstract java.util.List getProductDiscountInformations(SessionContext ctx, Product product, java.util.Date date, boolean net) throws JaloPriceFactoryException
override this to show all discounts which may apply to the given product- Specified by:
getProductDiscountInformationsin interfacePriceFactory- Parameters:
product- the product- Returns:
- a list of
DiscountInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
isNetUser
public boolean isNetUser(User user)
override to define whether a user should be treated as net or gross customer.- Specified by:
isNetUserin interfacePriceFactory- Returns:
- false as default
-
getTaxValues
public java.util.Collection getTaxValues(AbstractOrderEntry entry) throws JaloPriceFactoryException
override to define tax values for an order entry.- Specified by:
getTaxValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
getBasePrice
public abstract PriceValue getBasePrice(AbstractOrderEntry entry) throws JaloPriceFactoryException
override to define the base price of an order entry- Specified by:
getBasePricein interfacePriceFactory- Returns:
- a price with the order's currency iso code, 0.0 as value and the order's net status
- Throws:
JaloPriceFactoryException
-
getDiscountValues
public java.util.List getDiscountValues(AbstractOrderEntry entry) throws JaloPriceFactoryException
override to define discount values for an order entry.- Specified by:
getDiscountValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
getDiscountValues
public java.util.List getDiscountValues(AbstractOrder order) throws JaloPriceFactoryException
override to define (global) discounts for an order. these discounts are applied to the whole order, not just to one entry likegetDiscountValues(AbstractOrderEntry)- Specified by:
getDiscountValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
-