Class AbstractOrderEntry
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
- Direct Known Subclasses:
GeneratedCartEntry
,GeneratedOrderEntry
,GeneratedQuoteEntry
public abstract class AbstractOrderEntry extends GeneratedAbstractOrderEntry
This is a general superclass for all order entries, which describes an ordered (or sold) product amount.
Besides essential information like the product, the amount and unit these object also may contain pricing information. So base and total price are stored here as well as applied taxes ( as
TaxValue
objects ) and discounts (asDiscountValue
objects).Like
AbstractOrder
an entry does not have this information from the beginning but must be calculated. Since each entry belongs to an order its calculation status is set by its order if necessary.As price calculation is done by the installed price factory you should refer to its specific documentation how calculation for entries is done and if some behaviour differ from the descriptions stated here. Generally entry calculation is covered by these
PriceFactory
methods:PriceFactory.getBasePrice(AbstractOrderEntry)
,PriceFactory.getDiscountValues(AbstractOrderEntry)
andPriceFactory.getTaxValues(AbstractOrderEntry)
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.GenericItem
GenericItem.GenericItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DISCOUNTVALUES
Qualifier of theAbstractOrderEntry.discountValues
attributestatic java.lang.String
ENTRY_NUMBER
Deprecated.since ages - useGeneratedAbstractOrderEntry.ENTRYNUMBER
insteadstatic java.lang.String
TAXVALUES
Qualifier of theAbstractOrderEntry.taxValues
attribute-
Fields inherited from class de.hybris.platform.jalo.order.GeneratedAbstractOrderEntry
BASEPRICE, CALCULATED, DEFAULT_INITIAL_ATTRIBUTES, DISCOUNTVALUESINTERNAL, ENTRYGROUPNUMBERS, ENTRYNUMBER, GIVEAWAY, INFO, ORDER, ORDERHANDLER, PRODUCT, QUANTITY, REJECTED, TAXVALUESINTERNAL, TOTALPRICE, UNIT
-
Fields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLED
-
Fields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description AbstractOrderEntry()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAllDiscountValues(SessionContext ctx, java.util.List values)
Deprecated.since ages - Use OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.void
addAllDiscountValues(java.util.List values)
Deprecated.since ages - Use OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.void
addAllDisocuntValues(java.util.List values)
Deprecated.since ages - UseaddAllDiscountValues(List)
insteadvoid
addAllTaxValues(SessionContext ctx, java.util.Collection values)
Deprecated.since ages - Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.void
addAllTaxValues(java.util.Collection values)
Deprecated.since ages - Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.void
addDiscountValue(SessionContext ctx, DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.void
addDiscountValue(DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.void
addTaxValue(SessionContext ctx, TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.addTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.void
addTaxValue(TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.addTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.protected double
applyDiscounts(double totalWithoutDiscounts)
Applies the discount values of this order entry to the given total value.void
calculate()
Deprecated.since ages - Use CalculationService.calculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel) intsead.void
calculateTotals(boolean recalculate)
Deprecated.since ages - Use CalculationService.calculateTotals(de.hybris.platform.core.model.order.AbstractOrderEntryModel, boolean) insteadint
compareTo(java.lang.Object order)
AbstractOrderEntries are compared by entry number.protected Item
createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes)
Has to be implemented for each concrete subtype of item.protected java.util.List
findDiscounts()
Ffinds tax values for this entry.protected PriceValue
findPrice()
Finds a price for this entry.protected java.util.Collection
findTaxes()
Finds tax values for this entry.java.util.List
getDiscountValues()
Deprecated.since ages - Use AbstractOrderEntryModel.getDiscountValues() instead.java.util.List
getDiscountValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.getDiscountValues() instead.AbstractOrder
getOrder(SessionContext ctx)
This entrys order.java.util.Collection
getTaxValues()
Deprecated.since ages - Use AbstractOrderEntryModel.getTaxValues() instead.java.util.Collection
getTaxValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.getTaxValues() instead.java.lang.Boolean
isCalculated(SessionContext ctx)
Shows if this entry was calculated before.java.lang.Boolean
isGiveAway(SessionContext ctx)
Shows if this entry will be treated as a give away (that is, for free).java.lang.Boolean
isRejected(SessionContext ctx)
Shows if the GIVEAWAY flag of this entry will be ignored.void
recalculate()
Deprecated.since ages - Use CalculationService.recalculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel) instead.void
remove(SessionContext ctx)
This method delegates toAbstractOrder.removeEntry(AbstractOrderEntry)
instead of removing the item directly.void
removeAllDiscountValues()
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead.void
removeAllDiscountValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead.void
removeAllTaxValues()
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead.void
removeAllTaxValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead.void
removeDiscountValue(SessionContext ctx, DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.void
removeDiscountValue(DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.void
removeTaxValue(SessionContext ctx, TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.void
removeTaxValue(TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.protected void
removeWithoutOrderNotification(SessionContext ctx)
Removes the entry directly without notifying the enclosingAbstractOrder
.protected void
resetAllValues()
This tries to get base price, taxes and discounts and sets these values including converting the base price if necessary.void
setBasePrice(SessionContext ctx, java.lang.Double price)
Sets the calculated base price for this entry.protected void
setChanged()
void
setDiscountValues(SessionContext ctx, java.util.List discountValues)
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead.void
setDiscountValues(java.util.List discountValues)
void
setEntryNumber(SessionContext ctx, java.lang.Integer number)
Sets the entry number.protected void
setEntryNumberDirect(int number)
Changes entry number directly.void
setGiveAway(SessionContext ctx, java.lang.Boolean giveaway)
Generated method - Setter of theAbstractOrderEntry.giveAway
attribute.void
setOrder(SessionContext ctx, AbstractOrder value)
Generated method - Setter of theAbstractOrderEntry.order
attribute.void
setProduct(SessionContext ctx, Product product)
Changes the ordered product.void
setQuantity(SessionContext ctx, java.lang.Long qtd)
Changes the number of ordered products.void
setRejected(SessionContext ctx, java.lang.Boolean rejected)
Generated method - Setter of theAbstractOrderEntry.rejected
attribute.void
setTaxValues(SessionContext ctx, java.util.Collection collection)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) instead.void
setTaxValues(java.util.Collection collection)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) instead.void
setUnit(SessionContext ctx, Unit unit)
Changes the unit of the ordered amount. Please note that this resets the entry in the 'uncalculated' status since prices might also depend on units.java.lang.String
toString()
Returns theString
representation of this item.-
Methods inherited from class de.hybris.platform.jalo.order.GeneratedAbstractOrderEntry
getBasePrice, getBasePrice, getBasePriceAsPrimitive, getBasePriceAsPrimitive, getDefaultAttributeModes, getDiscountValuesInternal, getDiscountValuesInternal, getEntryGroupNumbers, getEntryGroupNumbers, getEntryNumber, getEntryNumber, getEntryNumberAsPrimitive, getEntryNumberAsPrimitive, getInfo, getInfo, getOrder, getProduct, getProduct, getQuantity, getQuantity, getQuantityAsPrimitive, getQuantityAsPrimitive, getTaxValuesInternal, getTaxValuesInternal, getTotalPrice, getTotalPrice, getTotalPriceAsPrimitive, getTotalPriceAsPrimitive, getUnit, getUnit, isCalculated, isCalculatedAsPrimitive, isCalculatedAsPrimitive, isGiveAway, isGiveAwayAsPrimitive, isGiveAwayAsPrimitive, isRejected, isRejectedAsPrimitive, isRejectedAsPrimitive, setBasePrice, setBasePrice, setBasePrice, setCalculated, setCalculated, setCalculated, setCalculated, setDiscountValuesInternal, setDiscountValuesInternal, setEntryGroupNumbers, setEntryGroupNumbers, setEntryNumber, setEntryNumber, setEntryNumber, setGiveAway, setGiveAway, setGiveAway, setInfo, setInfo, setOrder, setProduct, setQuantity, setQuantity, setQuantity, setRejected, setRejected, setRejected, setTaxValuesInternal, setTaxValuesInternal, setTotalPrice, setTotalPrice, setTotalPrice, setTotalPrice, setUnit
-
Methods inherited from class de.hybris.platform.jalo.GenericItem
getImplementation, getInitialProperties, getNonInitialAttributes, getRelatedItems, setRelatedItems
-
Methods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedProperty
-
Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setProperty
-
Methods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isMarkModifiedDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setTransientObject, setUseTA, useTA, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Field Detail
-
DISCOUNTVALUES
public static final java.lang.String DISCOUNTVALUES
Qualifier of theAbstractOrderEntry.discountValues
attribute- See Also:
- Constant Field Values
-
TAXVALUES
public static final java.lang.String TAXVALUES
Qualifier of theAbstractOrderEntry.taxValues
attribute- See Also:
- Constant Field Values
-
ENTRY_NUMBER
@Deprecated public static final java.lang.String ENTRY_NUMBER
Deprecated.since ages - useGeneratedAbstractOrderEntry.ENTRYNUMBER
insteadThe running order of the CartEntry on the Cart it is assigned to. Defaults to new Integer( de.hybris.platform.jalo.order.AbstractOrder.APPEND_AS_LAST )- See Also:
- Constant Field Values
-
-
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. ) duringComposedType.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 classGeneratedAbstractOrderEntry
- Parameters:
ctx
- the current session context which this item is created withintype
- 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
-
remove
public void remove(SessionContext ctx) throws ConsistencyCheckException
This method delegates toAbstractOrder.removeEntry(AbstractOrderEntry)
instead of removing the item directly.- Overrides:
remove
in classItem
- Parameters:
ctx
- A SessionContext object- Throws:
ConsistencyCheckException
- if this item could not be removed for some reason
-
removeWithoutOrderNotification
protected void removeWithoutOrderNotification(SessionContext ctx) throws ConsistencyCheckException
Removes the entry directly without notifying the enclosingAbstractOrder
. Use with care since the enclosing order is not marked as changed so that incorrect prices may be shown!- Parameters:
ctx
-- Throws:
ConsistencyCheckException
-
getOrder
public AbstractOrder getOrder(SessionContext ctx)
This entrys order.- Overrides:
getOrder
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access object may be outdated!- Returns:
- the
AbstractOrder
this abstract order entry is associated to
-
setOrder
public void setOrder(SessionContext ctx, AbstractOrder value)
Description copied from class:GeneratedAbstractOrderEntry
Generated method - Setter of theAbstractOrderEntry.order
attribute.- Overrides:
setOrder
in classGeneratedAbstractOrderEntry
value
- the order
-
setProduct
public void setProduct(SessionContext ctx, Product product)
Changes the ordered product. Please note that this resets the entry in the 'uncalculated' status since price information cannot be valid any more.- Overrides:
setProduct
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access object may be outdated!product
-
-
setQuantity
public void setQuantity(SessionContext ctx, java.lang.Long qtd)
Changes the number of ordered products. Please note that this resets the entry in the 'uncalculated' status since price information cannot be valid any more.- Overrides:
setQuantity
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access value may be outdated!qtd
-
-
setUnit
public void setUnit(SessionContext ctx, Unit unit)
Changes the unit of the ordered amount. Please note that this resets the entry in the 'uncalculated' status since prices might also depend on units.- Overrides:
setUnit
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access object may be outdated!unit
-
-
setBasePrice
public void setBasePrice(SessionContext ctx, java.lang.Double price)
Sets the calculated base price for this entry.- Overrides:
setBasePrice
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- the session contextprice
- the new base price
-
getTaxValues
@Deprecated public java.util.Collection getTaxValues()
Deprecated.since ages - Use AbstractOrderEntryModel.getTaxValues() instead.The collection of this entry's taxes. These are relativeTaxValues
which means they dont include real prices but only the tax rate. Please note that duringorder calculation
these tax values are calculated by the currentprice factory
.- Returns:
- a collection containing all
TaxValue
objects which are applied on this entry - Throws:
JaloNotYetCalculatedException
- if this order entry was not yetcalculated
.
-
getTaxValues
@Deprecated public java.util.Collection getTaxValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.getTaxValues() instead.The collection of this entry's taxes. These are relativeTaxValues
which means they dont include real prices but only the tax rate. Please note that duringorder calculation
these tax values are calculated by the currentprice factory
.- Parameters:
ctx
- can be used for cached access values may be outdated!- Returns:
- a collection containing all
TaxValue
objects which are applied on this entry - Throws:
JaloNotYetCalculatedException
- if this order entry was not yetcalculated
.
-
setTaxValues
@Deprecated public void setTaxValues(java.util.Collection collection)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) instead.discards all present tax values and adds the given values.- Parameters:
collection
- the new tax values
-
setTaxValues
@Deprecated public void setTaxValues(SessionContext ctx, java.util.Collection collection)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) instead.discards all present tax values and adds the given values.- Parameters:
collection
- the new tax values
-
addTaxValue
@Deprecated public void addTaxValue(TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.addTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.Adds a new tax into this entry- Parameters:
taxValue
-
-
addTaxValue
@Deprecated public void addTaxValue(SessionContext ctx, TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.addTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.Adds a new tax into this entry- Parameters:
ctx
-taxValue
-
-
addAllTaxValues
@Deprecated public void addAllTaxValues(java.util.Collection values)
Deprecated.since ages - Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.Adds a collection of taxes into this entry- Parameters:
values
-
-
addAllTaxValues
@Deprecated public void addAllTaxValues(SessionContext ctx, java.util.Collection values)
Deprecated.since ages - Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.Adds a collection of taxes into this entry- Parameters:
ctx
-values
-
-
removeTaxValue
@Deprecated public void removeTaxValue(TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.Removes a new tax out of this entry- Parameters:
taxValue
-
-
removeTaxValue
@Deprecated public void removeTaxValue(SessionContext ctx, TaxValue taxValue)
Deprecated.since ages - Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, TaxValue) instead.Removes a new tax out of this entry- Parameters:
ctx
-taxValue
-
-
removeAllTaxValues
@Deprecated public void removeAllTaxValues()
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead. In order to remove all taxes, use null in the setter.Removes all taxes of this entry
-
removeAllTaxValues
@Deprecated public void removeAllTaxValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead. In order to remove all taxes, use null in the setter.Removes all taxes of this entry- Parameters:
ctx
- the session context
-
getDiscountValues
@Deprecated public java.util.List getDiscountValues()
Deprecated.since ages - Use AbstractOrderEntryModel.getDiscountValues() instead.The list of this entry's discount values. In contrary to taxes these values contain "real" prices since all discounts directly apply to this entry ( otherwise they're global discounts and are not applied here). Since this may include absolute discounts the ordering of values is important for correct presentation of this entry, so we chose a List as collection format. Please note that duringorder calculation
these discount values are calculated by the currentprice factory
.- Returns:
- a list of all
DiscountValue
objects which are applied on this entry - Throws:
JaloNotYetCalculatedException
- if this order entry was not yetcalculated
.
-
getDiscountValues
@Deprecated public java.util.List getDiscountValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.getDiscountValues() instead.The list of this entry's discount values. In contrary to taxes these values contain "real" prices since all discounts directly apply to this entry ( otherwise they're global discounts and are not applied here). Since this may include absolute discounts the ordering of values is important for correct presentation of this entry, so we chose a List as collection format. Please note that duringorder calculation
these discount values are calculated by the currentprice factory
.- Parameters:
ctx
- can be used for cached access values may be outdated!- Returns:
- a list of all
DiscountValue
objects which are applied on this entry - Throws:
JaloNotYetCalculatedException
- if this order entry was not yetcalculated
.
-
setDiscountValues
@Deprecated public void setDiscountValues(SessionContext ctx, java.util.List discountValues)
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead.discards all present discount values and adds the given values.- Parameters:
discountValues
- the new values
-
setDiscountValues
public void setDiscountValues(java.util.List discountValues)
-
addDiscountValue
@Deprecated public void addDiscountValue(DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.Adds a new discount into this entry- Parameters:
discountValue
-
-
addDiscountValue
@Deprecated public void addDiscountValue(SessionContext ctx, DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.Adds a new discount into this entry- Parameters:
ctx
-discountValue
-
-
addAllDisocuntValues
@Deprecated public void addAllDisocuntValues(java.util.List values)
Deprecated.since ages - UseaddAllDiscountValues(List)
insteadAdds a collection of discounts into this entry- Parameters:
values
-
-
addAllDiscountValues
@Deprecated public void addAllDiscountValues(java.util.List values)
Deprecated.since ages - Use OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.Adds a collection of discounts into this entry- Parameters:
values
-
-
addAllDiscountValues
@Deprecated public void addAllDiscountValues(SessionContext ctx, java.util.List values)
Deprecated.since ages - Use OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel, List) instead.Adds a collection of discounts into this entry- Parameters:
ctx
-values
-
-
removeDiscountValue
@Deprecated public void removeDiscountValue(DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.Removes a new discount out of this entry- Parameters:
discountValue
-
-
removeDiscountValue
@Deprecated public void removeDiscountValue(SessionContext ctx, DiscountValue discountValue)
Deprecated.since ages - Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel, DiscountValue) instead.Removes a new discount out of this entry- Parameters:
ctx
-discountValue
-
-
removeAllDiscountValues
@Deprecated public void removeAllDiscountValues()
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead. In order to remove all discounts, simply use null as setter argument.Removes all discounts of this entry
-
removeAllDiscountValues
@Deprecated public void removeAllDiscountValues(SessionContext ctx)
Deprecated.since ages - Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead. In order to remove all discounts, simply use null as setter argument.Removes all discounts of this entry- Parameters:
ctx
- the session context
-
isCalculated
public java.lang.Boolean isCalculated(SessionContext ctx)
Shows if this entry was calculated before. Please note that all calculated fields are only valid if this method returnstrue
.- Overrides:
isCalculated
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access value may be outdated!- Returns:
true
if this entry is calculated
-
isGiveAway
public java.lang.Boolean isGiveAway(SessionContext ctx)
Shows if this entry will be treated as a give away (that is, for free).- Overrides:
isGiveAway
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access value may be outdated!- Returns:
true
if this entry is calculated
-
setGiveAway
public void setGiveAway(SessionContext ctx, java.lang.Boolean giveaway)
Description copied from class:GeneratedAbstractOrderEntry
Generated method - Setter of theAbstractOrderEntry.giveAway
attribute.- Overrides:
setGiveAway
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- the session contextgiveaway
- the giveaway flag
-
isRejected
public java.lang.Boolean isRejected(SessionContext ctx)
Shows if the GIVEAWAY flag of this entry will be ignored.- Overrides:
isRejected
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- can be used for cached access value may be outdated!- Returns:
true
the rejected flag
-
setRejected
public void setRejected(SessionContext ctx, java.lang.Boolean rejected)
Description copied from class:GeneratedAbstractOrderEntry
Generated method - Setter of theAbstractOrderEntry.rejected
attribute.- Overrides:
setRejected
in classGeneratedAbstractOrderEntry
- Parameters:
ctx
- the session contextrejected
- the rejected flag
-
calculate
@Deprecated public void calculate() throws JaloPriceFactoryException
Deprecated.since ages - Use CalculationService.calculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel) intsead.Calculates this entry if the entry is not calculated yet. This includes finding the correct base price, taxes and discount using the currently installed price factory.If prices should be left as currently set but the entry totals have to be consolidated (e.g. when the quantity has changed) call
calculateTotals(boolean)
instead !- Throws:
JaloPriceFactoryException
- if no price could be found or other price factory errors occurred.
-
recalculate
@Deprecated public void recalculate() throws JaloPriceFactoryException
Deprecated.since ages - Use CalculationService.recalculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel) instead.Calculates this entry even if the entry was calculated before. This includes finding the correct base price, taxes and discount using the currently installed price factory.If prices should be left as currently set but the entry totals have to be consolidated (e.g. when the quantity has changed) call
calculateTotals(boolean)
instead !- Throws:
JaloPriceFactoryException
- if no price could be found or other price factory errors occurred.
-
setEntryNumber
public void setEntryNumber(SessionContext ctx, java.lang.Integer number)
Sets the entry number. This number affects the position of this entry within the collection obtainable viaAbstractOrder.getAllEntries()
which is ordered by entry numbers.- Overrides:
setEntryNumber
in classGeneratedAbstractOrderEntry
- Parameters:
number
- the new entry number
-
setEntryNumberDirect
protected void setEntryNumberDirect(int number)
Changes entry number directly.- Parameters:
number
- the new entry number
-
resetAllValues
protected void resetAllValues() throws JaloPriceFactoryException
This tries to get base price, taxes and discounts and sets these values including converting the base price if necessary. Please note that this doesnt change this entry's total. You have to callcalculateTotals(boolean)
to do so.- Throws:
JaloPriceFactoryException
-
findPrice
protected PriceValue findPrice() throws JaloPriceFactoryException
Finds a price for this entry. as default this just callsAbstractPriceFactory.getBasePrice(AbstractOrderEntry)
but you may override this four your own (non-pricefactory) logic.The returned price value does not need to have the net/gross state of this order nor does it have to have the same currency as this entry's order.
- Returns:
- a price value - null is not allowed
- Throws:
JaloPriceFactoryException
- on pricefactory errors
-
findTaxes
protected java.util.Collection findTaxes() throws JaloPriceFactoryException
Finds tax values for this entry. as default this just callsAbstractPriceFactory.getTaxValues(AbstractOrderEntry)
but you may override this four your own (non-pricefactory) logic.The returned tax values are converted into applied tax values after the price was found.
- Returns:
- a collection of
TaxValue
- Throws:
JaloPriceFactoryException
- on pricefactory errors
-
findDiscounts
protected java.util.List findDiscounts() throws JaloPriceFactoryException
Ffinds tax values for this entry. as default this just callsAbstractPriceFactory.getDiscountValues(AbstractOrderEntry)
but you may override this four your own (non-pricefactory) logic.The returned discount values are converted into applied tax values after the price was found.
- Returns:
- a collection of
DiscountValue
- Throws:
JaloPriceFactoryException
- on pricefactory errors
-
calculateTotals
@Deprecated public void calculateTotals(boolean recalculate)
Deprecated.since ages - Use CalculationService.calculateTotals(de.hybris.platform.core.model.order.AbstractOrderEntryModel, boolean) insteadRecalculates this entries total prices and re-applies tax and discount values. This does not include finding price, taxes or discount but uses all currently set values.- Parameters:
recalculate
- forces the recalculation of the abstract order entry.
-
applyDiscounts
protected double applyDiscounts(double totalWithoutDiscounts)
Applies the discount values of this order entry to the given total value. The calculation algorithm is:value = given total value for each DiscountValue dv { if dv is absolute subtract from value the value of dv else subtract from value ( the value of dv * value / 100 ) } round value to order currency
- Parameters:
totalWithoutDiscounts
-- Returns:
- the total minus all discounts
-
toString
public java.lang.String toString()
Description copied from class:Item
Returns theString
representation of this item. This is by default the representation of the primary key of this item.
-
compareTo
public int compareTo(java.lang.Object order)
AbstractOrderEntries are compared by entry number.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Overrides:
compareTo
in classItem
- Parameters:
order
- the abstract order entry, which should be compared with this abstract order entry- Returns:
- an int value calculated by subtracting the entry number of the argument abstract order entry from the entry number of this abstract order entry.
-
setChanged
protected void setChanged()
-
-