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 (as DiscountValue 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) and
PriceFactory.getTaxValues(AbstractOrderEntry).
GenericItem.GenericItemImplLocalizableItem.LocalizableItemImplExtensibleItem.ExtensibleItemImplItem.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException| Modifier and Type | Field and Description |
|---|---|
static String |
DISCOUNTVALUES
Qualifier of the
AbstractOrderEntry.discountValues attribute |
static String |
ENTRY_NUMBER
Deprecated.
use
GeneratedAbstractOrderEntry.ENTRYNUMBER instead |
static String |
TAXVALUES
Qualifier of the
AbstractOrderEntry.taxValues attribute |
BASEPRICE, CALCULATED, DEFAULT_INITIAL_ATTRIBUTES, DISCOUNTVALUESINTERNAL, ENTRYNUMBER, GIVEAWAY, INFO, ORDER, ORDERHANDLER, PRODUCT, QUANTITY, REJECTED, TAXVALUESINTERNAL, TOTALPRICE, UNITLANGUAGE_FALLBACK_ENABLED_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEimpl, tenant| Constructor and Description |
|---|
AbstractOrderEntry() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllDiscountValues(List values)
Deprecated.
Use
OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
List) instead.
|
void |
addAllDiscountValues(SessionContext ctx,
List values)
Deprecated.
Use
OrderEntryService.addAllDiscountValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
List) instead.
|
void |
addAllDisocuntValues(List values)
Deprecated.
Use
addAllDiscountValues(List) instead |
void |
addAllTaxValues(Collection values)
Deprecated.
Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
List) instead.
|
void |
addAllTaxValues(SessionContext ctx,
Collection values)
Deprecated.
Use OrderEntryService.addAllTaxValues(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
List) instead.
|
void |
addDiscountValue(DiscountValue discountValue)
Deprecated.
Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
DiscountValue) instead.
|
void |
addDiscountValue(SessionContext ctx,
DiscountValue discountValue)
Deprecated.
Use OrderEntryService.addDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
DiscountValue) instead.
|
void |
addTaxValue(SessionContext ctx,
TaxValue taxValue)
Deprecated.
Use OrderEntryService.addTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
TaxValue) instead.
|
void |
addTaxValue(TaxValue taxValue)
Deprecated.
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.
Use CalculationService.calculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel) intsead.
|
void |
calculateTotals(boolean recalculate)
Deprecated.
Use CalculationService.calculateTotals(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
boolean) instead
|
int |
compareTo(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 List |
findDiscounts()
Ffinds tax values for this entry.
|
protected PriceValue |
findPrice()
Finds a price for this entry.
|
protected Collection |
findTaxes()
Finds tax values for this entry.
|
List |
getDiscountValues()
Deprecated.
Use AbstractOrderEntryModel.getDiscountValues() instead.
|
List |
getDiscountValues(SessionContext ctx)
Deprecated.
Use AbstractOrderEntryModel.getDiscountValues() instead.
|
AbstractOrder |
getOrder(SessionContext ctx)
This entrys order.
|
Collection |
getTaxValues()
Deprecated.
Use AbstractOrderEntryModel.getTaxValues() instead.
|
Collection |
getTaxValues(SessionContext ctx)
Deprecated.
Use AbstractOrderEntryModel.getTaxValues() instead.
|
Boolean |
isCalculated(SessionContext ctx)
Shows if this entry was calculated before.
|
Boolean |
isGiveAway(SessionContext ctx)
Shows if this entry will be treated as a give away (that is, for free).
|
Boolean |
isRejected(SessionContext ctx)
Shows if the GIVEAWAY flag of this entry will be ignored.
|
void |
recalculate()
Deprecated.
Use CalculationService.recalculate(de.hybris.platform.core.model.order.AbstractOrderEntryModel)
instead.
|
void |
remove(SessionContext ctx)
This method delegates to
AbstractOrder.removeEntry(AbstractOrderEntry) instead of removing the item
directly. |
void |
removeAllDiscountValues()
Deprecated.
Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead. In order
to remove all discounts, simply use null as setter argument.
|
void |
removeAllDiscountValues(SessionContext ctx)
Deprecated.
Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead. In order
to remove all discounts, simply use null as setter argument.
|
void |
removeAllTaxValues()
Deprecated.
Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead. In order to
remove all taxes, use null in the setter.
|
void |
removeAllTaxValues(SessionContext ctx)
Deprecated.
Use AbstractOrderEntryModel.setTaxValues(Collection) and ModelService.save() instead. In order to
remove all taxes, use null in the setter.
|
void |
removeDiscountValue(DiscountValue discountValue)
Deprecated.
Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
DiscountValue) instead.
|
void |
removeDiscountValue(SessionContext ctx,
DiscountValue discountValue)
Deprecated.
Use OrderEntryService.removeDiscountValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
DiscountValue) instead.
|
void |
removeTaxValue(SessionContext ctx,
TaxValue taxValue)
Deprecated.
Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
TaxValue) instead.
|
void |
removeTaxValue(TaxValue taxValue)
Deprecated.
Use OrderEntryService.removeTaxValue(de.hybris.platform.core.model.order.AbstractOrderEntryModel,
TaxValue) instead.
|
protected void |
removeWithoutOrderNotification(SessionContext ctx)
Removes the entry directly without notifying the enclosing
AbstractOrder. |
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,
Double price)
Sets the calculated base price for this entry.
|
protected void |
setChanged() |
void |
setDiscountValues(List discountValues) |
void |
setDiscountValues(SessionContext ctx,
List discountValues)
Deprecated.
Use AbstractOrderEntryModel.setDiscountValues(List) and ModelService.save() method instead.
|
void |
setEntryNumber(SessionContext ctx,
Integer number)
Sets the entry number.
|
protected void |
setEntryNumberDirect(int number)
Changes entry number directly.
|
void |
setGiveAway(SessionContext ctx,
Boolean giveaway)
Generated method - Setter of the
AbstractOrderEntry.giveAway attribute. |
void |
setOrder(SessionContext ctx,
AbstractOrder value)
Generated method - Setter of the
AbstractOrderEntry.order attribute. |
void |
setProduct(SessionContext ctx,
Product product)
Changes the ordered product.
|
void |
setQuantity(SessionContext ctx,
Long qtd)
Changes the number of ordered products.
|
void |
setRejected(SessionContext ctx,
Boolean rejected)
Generated method - Setter of the
AbstractOrderEntry.rejected attribute. |
void |
setTaxValues(Collection collection)
Deprecated.
Use AbstractOrderEntryModel.setTaxValues(Collection) instead.
|
void |
setTaxValues(SessionContext ctx,
Collection collection)
Deprecated.
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.
|
String |
toString()
Returns the
String representation of this item. |
getBasePrice, getBasePrice, getBasePriceAsPrimitive, getBasePriceAsPrimitive, getDefaultAttributeModes, getDiscountValuesInternal, getDiscountValuesInternal, 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, setEntryNumber, setEntryNumber, setEntryNumber, setGiveAway, setGiveAway, setGiveAway, setInfo, setInfo, setOrder, setProduct, setQuantity, setQuantity, setQuantity, setRejected, setRejected, setRejected, setTaxValuesInternal, setTaxValuesInternal, setTotalPrice, setTotalPrice, setTotalPrice, setTotalPrice, setUnitgetInitialProperties, getNonInitialAttributesgetAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertycreateNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyaddLinkedItems, 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, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, readResolve, refreshRemote, 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, writeReplacegetImplementation, setTenantpublic static final String DISCOUNTVALUES
AbstractOrderEntry.discountValues attributepublic static final String TAXVALUES
AbstractOrderEntry.taxValues attribute@Deprecated public static final String ENTRY_NUMBER
GeneratedAbstractOrderEntry.ENTRYNUMBER insteadprotected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
ItemComposedType.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; }
createItem in class GeneratedAbstractOrderEntryctx - 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 )JaloBusinessException - indicates an error during creation - any changes will be rollbackedpublic void remove(SessionContext ctx) throws ConsistencyCheckException
AbstractOrder.removeEntry(AbstractOrderEntry) instead of removing the item
directly.remove in class Itemctx - A SessionContext objectConsistencyCheckException - if this item could not be removed for some reasonprotected void removeWithoutOrderNotification(SessionContext ctx) throws ConsistencyCheckException
AbstractOrder. Use with care since the
enclosing order is not marked as changed so that incorrect prices may be shown!ctx - ConsistencyCheckExceptionpublic AbstractOrder getOrder(SessionContext ctx)
getOrder in class GeneratedAbstractOrderEntryctx - can be used for cached access object may be outdated! AbstractOrder this abstract order entry is associated topublic void setOrder(SessionContext ctx, AbstractOrder value)
GeneratedAbstractOrderEntryAbstractOrderEntry.order attribute.setOrder in class GeneratedAbstractOrderEntryvalue - the orderpublic void setProduct(SessionContext ctx, Product product)
setProduct in class GeneratedAbstractOrderEntryctx - can be used for cached access object may be outdated! product - public void setQuantity(SessionContext ctx, Long qtd)
setQuantity in class GeneratedAbstractOrderEntryctx - can be used for cached access value may be outdated! qtd - public void setUnit(SessionContext ctx, Unit unit)
setUnit in class GeneratedAbstractOrderEntryctx - can be used for cached access object may be outdated! unit - public void setBasePrice(SessionContext ctx, Double price)
setBasePrice in class GeneratedAbstractOrderEntryctx - the session contextprice - the new base price@Deprecated public Collection getTaxValues()
TaxValues which means they dont
include real prices but only the tax rate. Please note that during order
calculation these tax values are calculated by the current
price factory.TaxValue objects which are applied on this entryJaloNotYetCalculatedException - if this order entry was not yet calculated.@Deprecated public Collection getTaxValues(SessionContext ctx)
TaxValues which means they dont
include real prices but only the tax rate. Please note that during order
calculation these tax values are calculated by the current
price factory.ctx - can be used for cached access values may be outdated! TaxValue objects which are applied on this entryJaloNotYetCalculatedException - if this order entry was not yet calculated.@Deprecated public void setTaxValues(Collection collection)
collection - the new tax values@Deprecated public void setTaxValues(SessionContext ctx, Collection collection)
collection - the new tax values@Deprecated public void addTaxValue(TaxValue taxValue)
taxValue - @Deprecated public void addTaxValue(SessionContext ctx, TaxValue taxValue)
ctx - taxValue - @Deprecated public void addAllTaxValues(Collection values)
values - @Deprecated public void addAllTaxValues(SessionContext ctx, Collection values)
ctx - values - @Deprecated public void removeTaxValue(TaxValue taxValue)
taxValue - @Deprecated public void removeTaxValue(SessionContext ctx, TaxValue taxValue)
ctx - taxValue - @Deprecated public void removeAllTaxValues()
@Deprecated public void removeAllTaxValues(SessionContext ctx)
ctx - the session context@Deprecated public List getDiscountValues()
order calculation
these discount values are calculated by the current
price factory.DiscountValue objects which are applied on this entryJaloNotYetCalculatedException - if this order entry was not yet calculated.@Deprecated public List getDiscountValues(SessionContext ctx)
order calculation
these discount values are calculated by the current
price factory.ctx - can be used for cached access values may be outdated! DiscountValue objects which are applied on this entryJaloNotYetCalculatedException - if this order entry was not yet calculated.@Deprecated public void setDiscountValues(SessionContext ctx, List discountValues)
discountValues - the new valuespublic void setDiscountValues(List discountValues)
@Deprecated public void addDiscountValue(DiscountValue discountValue)
discountValue - @Deprecated public void addDiscountValue(SessionContext ctx, DiscountValue discountValue)
ctx - discountValue - @Deprecated public void addAllDisocuntValues(List values)
addAllDiscountValues(List) insteadvalues - @Deprecated public void addAllDiscountValues(List values)
values - @Deprecated public void addAllDiscountValues(SessionContext ctx, List values)
ctx - values - @Deprecated public void removeDiscountValue(DiscountValue discountValue)
discountValue - @Deprecated public void removeDiscountValue(SessionContext ctx, DiscountValue discountValue)
ctx - discountValue - @Deprecated public void removeAllDiscountValues()
@Deprecated public void removeAllDiscountValues(SessionContext ctx)
ctx - the session contextpublic Boolean isCalculated(SessionContext ctx)
true .isCalculated in class GeneratedAbstractOrderEntryctx - can be used for cached access value may be outdated! true if this entry is calculatedpublic Boolean isGiveAway(SessionContext ctx)
isGiveAway in class GeneratedAbstractOrderEntryctx - can be used for cached access value may be outdated! true if this entry is calculatedpublic void setGiveAway(SessionContext ctx, Boolean giveaway)
GeneratedAbstractOrderEntryAbstractOrderEntry.giveAway attribute.setGiveAway in class GeneratedAbstractOrderEntryctx - the session contextgiveaway - the giveaway flagpublic Boolean isRejected(SessionContext ctx)
isRejected in class GeneratedAbstractOrderEntryctx - can be used for cached access value may be outdated! true the rejected flagpublic void setRejected(SessionContext ctx, Boolean rejected)
GeneratedAbstractOrderEntryAbstractOrderEntry.rejected attribute.setRejected in class GeneratedAbstractOrderEntryctx - the session contextrejected - the rejected flag@Deprecated public void calculate() throws JaloPriceFactoryException
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 !
JaloPriceFactoryException - if no price could be found or other price factory errors occurred.@Deprecated public void recalculate() throws JaloPriceFactoryException
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 !
JaloPriceFactoryException - if no price could be found or other price factory errors occurred.public void setEntryNumber(SessionContext ctx, Integer number)
AbstractOrder.getAllEntries() which is ordered by entry numbers.setEntryNumber in class GeneratedAbstractOrderEntrynumber - the new entry numberprotected void setEntryNumberDirect(int number)
number - the new entry numberprotected void resetAllValues()
throws JaloPriceFactoryException
calculateTotals(boolean) to do so.JaloPriceFactoryExceptionprotected PriceValue findPrice() throws JaloPriceFactoryException
AbstractPriceFactory.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.
JaloPriceFactoryException - on pricefactory errorsprotected Collection findTaxes() throws JaloPriceFactoryException
AbstractPriceFactory.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.
TaxValueJaloPriceFactoryException - on pricefactory errorsprotected List findDiscounts() throws JaloPriceFactoryException
AbstractPriceFactory.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.
DiscountValueJaloPriceFactoryException - on pricefactory errors@Deprecated public void calculateTotals(boolean recalculate)
recalculate - forces the recalculation of the abstract order entry.protected double applyDiscounts(double totalWithoutDiscounts)
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
totalWithoutDiscounts - public String toString()
ItemString representation of this item. This is by default the representation of the primary
key of this item.public int compareTo(Object order)
compareTo in interface ComparablecompareTo in class Itemorder - the abstract order entry, which should be compared with this abstract order entryprotected void setChanged()
Copyright © 2017 SAP SE. All Rights Reserved.