public abstract class AbstractPromotion extends GeneratedAbstractPromotion
GenericItem.GenericItemImplLocalizableItem.LocalizableItemImplExtensibleItem.ExtensibleItemImplItem.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationExceptionCODE, DEFAULT_INITIAL_ATTRIBUTES, DESCRIPTION, DETAILSURL, ENABLED, ENDDATE, IMMUTABLEKEY, IMMUTABLEKEYHASH, PRIORITY, PROMOTIONGROUP, PROMOTIONGROUPHANDLER, PROMOTIONTYPE, RESTRICTIONS, STARTDATE, TITLELANGUAGE_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 |
|---|
AbstractPromotion() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildDataUniqueKey(SessionContext ctx,
java.lang.StringBuilder builder)
Build a unique data driven key.
|
protected static void |
buildDataUniqueKeyForCategories(SessionContext ctx,
java.lang.StringBuilder builder,
java.util.Collection<Category> categories) |
protected static void |
buildDataUniqueKeyForPriceRows(SessionContext ctx,
java.lang.StringBuilder builder,
java.util.Collection<PromotionPriceRow> priceRows) |
protected static void |
buildDataUniqueKeyForProducts(SessionContext ctx,
java.lang.StringBuilder builder,
java.util.Collection<Product> products) |
protected static java.lang.String |
buildMD5Hash(java.lang.String message) |
protected void |
buildPromotionResultDataUnigueKey(SessionContext ctx,
PromotionResult promotionResult,
java.lang.StringBuilder builder)
Build a unique identifier for a PromotionResult.
|
protected AbstractPromotion |
createImmutableDeepClone(SessionContext ctx,
java.lang.String immutableKeyHash,
java.lang.String immutableKey) |
protected Item |
createItem(SessionContext ctx,
ComposedType type,
Item.ItemAttributeMap allAttributes)
Create the item.
|
protected void |
deepCloneAttributes(SessionContext ctx,
java.util.Map values)
Called to deep clone attributes of this instance.
|
protected static java.util.Collection<PromotionPriceRow> |
deepClonePriceRows(SessionContext ctx,
java.util.Collection<PromotionPriceRow> priceRows) |
static void |
deletePromotionPriceRows(SessionContext ctx,
java.util.Collection<PromotionPriceRow> prices)
Helper method to delete promotion price rows from the database.
|
abstract java.util.List<PromotionResult> |
evaluate(SessionContext ctx,
PromotionEvaluationContext promoContext)
Evaluate whether a promotion can fire or not.
|
protected static AbstractPromotion |
findImmutablePromotionByUniqueKey(JaloSession jaloSession,
SessionContext ctx,
java.lang.String immutableKeyHash,
java.lang.String immutableKey) |
protected AbstractPromotion |
findOrCreateImmutableClone(SessionContext ctx)
Find or create an immutable clone of this promotion.
|
protected static java.lang.String |
formatMessage(java.lang.String pattern,
java.lang.Object[] arguments,
java.util.Locale locale)
Format a message pattern using the MessageFormat
|
java.util.Map |
getAllPromotionType(SessionContext ctx)
Get promotionType for all supported languages.
|
protected java.lang.String |
getDataUniqueKey(SessionContext ctx)
Build a unique data driven key.
|
protected java.lang.Double |
getPriceForOrder(SessionContext ctx,
java.util.Collection<PromotionPriceRow> prices,
AbstractOrder order,
java.lang.String fieldLabel)
Lookup the price for an order.
|
protected java.lang.String |
getPromotionResultDataUnigueKey(SessionContext ctx,
PromotionResult promotionResult)
Generate a string identifier that can be used to establish if 2 PromotionResults are the same.
|
java.lang.String |
getPromotionType(SessionContext ctx)
Return the type name for this promotion instance.
|
java.util.Collection |
getRestrictions(SessionContext ctx)
Get the collection of
AbstractPromotionRestriction instances. |
abstract java.lang.String |
getResultDescription(SessionContext ctx,
PromotionResult promotionResult,
java.util.Locale locale)
Get a localized user presentable description for the result of this promotion.
|
void |
remove(SessionContext ctx)
Remove the item.
|
void |
setPromotionGroup(SessionContext ctx,
PromotionGroup promotionGroup)
Override the default behaviour to prevent PromotionGroup from being set to null.
|
void |
setRestrictions(SessionContext ctx,
java.util.Collection restrictions)
Set the collection of
AbstractPromotionRestriction instance. |
java.lang.String |
toString()
Get a simple description of promotion object.
|
getAllPromotionType, getCode, getCode, getDefaultAttributeModes, getDescription, getDescription, getDetailsURL, getDetailsURL, getEndDate, getEndDate, getImmutableKey, getImmutableKey, getImmutableKeyHash, getImmutableKeyHash, getPriority, getPriority, getPriorityAsPrimitive, getPriorityAsPrimitive, getPromotionGroup, getPromotionGroup, getPromotionType, getRestrictions, getStartDate, getStartDate, getTitle, getTitle, isEnabled, isEnabled, isEnabledAsPrimitive, isEnabledAsPrimitive, setCode, setCode, setDescription, setDescription, setDetailsURL, setDetailsURL, setEnabled, setEnabled, setEnabled, setEnabled, setEndDate, setEndDate, setImmutableKey, setImmutableKey, setImmutableKeyHash, setImmutableKeyHash, setPriority, setPriority, setPriority, setPriority, setPromotionGroup, setRestrictions, setStartDate, setStartDate, setTitle, setTitlegetInitialProperties, getNonInitialAttributesgetAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertycreateNonClassAccessor, getAllProperties, getAllProperties, getImplementation, 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, compareTo, 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, writeReplacesetTenantprotected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
createItem in class GeneratedAbstractPromotionctx - 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
remove in class Itemctx - A SessionContext objectConsistencyCheckException - if this item could not be removed for some reasonpublic java.lang.String toString()
public java.lang.String getPromotionType(SessionContext ctx)
getPromotionType in class GeneratedAbstractPromotionctx - The hybris contextpublic java.util.Map getAllPromotionType(SessionContext ctx)
getAllPromotionType in class GeneratedAbstractPromotionctx - The hybris contextpublic void setPromotionGroup(SessionContext ctx, PromotionGroup promotionGroup)
setPromotionGroup in class GeneratedAbstractPromotionctx - The hybris contextpromotionGroup - The promotion group to setpublic abstract java.util.List<PromotionResult> evaluate(SessionContext ctx, PromotionEvaluationContext promoContext)
ctx - The context to run the operation inpromoContext - The evaluation contextpublic abstract java.lang.String getResultDescription(SessionContext ctx, PromotionResult promotionResult, java.util.Locale locale)
ctx - The contextpromotionResult - The promotion result to be describedlocale - The locale to use to generate the messageprotected final java.lang.Double getPriceForOrder(SessionContext ctx, java.util.Collection<PromotionPriceRow> prices, AbstractOrder order, java.lang.String fieldLabel)
ctx - The hybris contextprices - The collection of PromotionPriceRow which is the set of pricesorder - The order to lookup the price forfieldLabel - A string label to use when generating error messages.protected static final java.lang.String formatMessage(java.lang.String pattern,
java.lang.Object[] arguments,
java.util.Locale locale)
pattern - the message patternarguments - the arguments to pass into the patternlocale - the rendering localeprotected final AbstractPromotion findOrCreateImmutableClone(SessionContext ctx)
ctx - the hybris contextprotected static final java.lang.String buildMD5Hash(java.lang.String message)
protected final AbstractPromotion createImmutableDeepClone(SessionContext ctx, java.lang.String immutableKeyHash, java.lang.String immutableKey)
protected static final AbstractPromotion findImmutablePromotionByUniqueKey(JaloSession jaloSession, SessionContext ctx, java.lang.String immutableKeyHash, java.lang.String immutableKey)
protected final java.lang.String getDataUniqueKey(SessionContext ctx)
ctx - The hybris contextStringBuilder used to build up the immutable keyprotected void buildDataUniqueKey(SessionContext ctx, java.lang.StringBuilder builder)
ctx - The hybris contextbuilder - A StringBuilder used to build up the immutable keyprotected void deepCloneAttributes(SessionContext ctx, java.util.Map values)
ctx - The hybris contextvalues - The map to write intoprotected static final java.util.Collection<PromotionPriceRow> deepClonePriceRows(SessionContext ctx, java.util.Collection<PromotionPriceRow> priceRows)
protected static final void buildDataUniqueKeyForPriceRows(SessionContext ctx, java.lang.StringBuilder builder, java.util.Collection<PromotionPriceRow> priceRows)
protected static final void buildDataUniqueKeyForProducts(SessionContext ctx, java.lang.StringBuilder builder, java.util.Collection<Product> products)
protected static final void buildDataUniqueKeyForCategories(SessionContext ctx, java.lang.StringBuilder builder, java.util.Collection<Category> categories)
public final java.util.Collection getRestrictions(SessionContext ctx)
AbstractPromotionRestriction instances.getRestrictions in class GeneratedAbstractPromotionctx - The hybris session contextAbstractPromotionRestriction instances attached to this promotion.public final void setRestrictions(SessionContext ctx, java.util.Collection restrictions)
AbstractPromotionRestriction instance. The AbstractPromotionRestriction
instances associated with this promotion are owned (and part of) this promotion. They cannot belong to another
instance, therefore when setting the collection any AbstractPromotionRestriction instances previously
associated with this promotion, that are no longer associated are deleted from the database.setRestrictions in class GeneratedAbstractPromotionctx - The hybris session contextrestrictions - the collection of restrictionspublic static void deletePromotionPriceRows(SessionContext ctx, java.util.Collection<PromotionPriceRow> prices) throws ConsistencyCheckException
ctx - The hybris contextprices - The prices to deleteConsistencyCheckExceptionprotected final java.lang.String getPromotionResultDataUnigueKey(SessionContext ctx, PromotionResult promotionResult)
buildPromotionResultDataUnigueKey(de.hybris.platform.jalo.SessionContext, de.hybris.platform.promotions.jalo.PromotionResult, java.lang.StringBuilder) method to allow subclasses to
affect the way the identifier is built.ctx - The hybris contextpromotionResult - The promotion resultprotected void buildPromotionResultDataUnigueKey(SessionContext ctx, PromotionResult promotionResult, java.lang.StringBuilder builder)
getPromotionResultDataUnigueKey(de.hybris.platform.jalo.SessionContext, de.hybris.platform.promotions.jalo.PromotionResult). This method may be overridden by a subclass to customize how the
identifier is built.ctx - The hybris contextpromotionResult - The promotion resultbuilder - A StringBuilder used to build up the identifierCopyright © 2018 SAP SE. All Rights Reserved.