Class PDTRow

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
GeneratedAbstractDiscountRow, GeneratedPriceRow, GeneratedTaxRow

public abstract class PDTRow extends GeneratedPDTRow
Abstract Superclass of our price , tax and discount rule classes PriceRow, TaxRow and DiscountRow. Here the basic matching fields are defined: product, product price group, user and user group.
See Also:
  • Field Details

  • Constructor Details

    • PDTRow

      public PDTRow()
  • Method Details

    • 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 GenericItem
      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
    • setProductMatchQualifier

      public void setProductMatchQualifier(SessionContext ctx, Long value)
      Overwritten to disallow changing this calculated field from outside this class
      Overrides:
      setProductMatchQualifier in class GeneratedPDTRow
      value - the productMatchQualifier
    • setUserMatchQualifier

      public void setUserMatchQualifier(SessionContext ctx, Long value)
      Overwritten to disallow changing this calculated field from outside this class
      Overrides:
      setUserMatchQualifier in class GeneratedPDTRow
      value - the userMatchQualifier
    • getInitialProductMatchField

      protected Long getInitialProductMatchField(Item.ItemAttributeMap allAttributes)
    • getInitialUserMatchField

      protected Long getInitialUserMatchField(Item.ItemAttributeMap allAttributes)
    • updateProductMatchField

      protected void updateProductMatchField()
    • updateUserMatchField

      protected void updateUserMatchField()
    • setProduct

      protected void setProduct(SessionContext ctx, Product value)
      Whenever a non-null product is set the PG attribute is cleared.
      Overrides:
      setProduct in class GeneratedPDTRow
      value - the product
    • setProductId

      public void setProductId(SessionContext ctx, String value)
      Description copied from class: GeneratedPDTRow
      Generated method - Setter of the PDTRow.productId attribute.
      Overrides:
      setProductId in class GeneratedPDTRow
      value - the productId
    • setUser

      public void setUser(SessionContext ctx, User value)
      Whenever a non-null user is set the UG attribute is cleared.
      Overrides:
      setUser in class GeneratedPDTRow
      value - the user
    • setPg

      protected void setPg(SessionContext ctx, EnumerationValue value)
      Whenever a non-null PG is set the product attribute is cleared.
      Overrides:
      setPg in class GeneratedPDTRow
      value - the pg
    • setUg

      public void setUg(SessionContext ctx, EnumerationValue value)
      Whenever a non-null UG is set the user attribute is cleared.
      Overrides:
      setUg in class GeneratedPDTRow
      value - the ug
    • removeLinks

      protected void removeLinks()
      Superclass method overridden to skip searching for links during removal of a PDTRow. PDTRows are not linked!
      Overrides:
      removeLinks in class Item
    • getProductPriceGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getProductPriceGroup()
      Deprecated.
      since ages - please use getProductGroup() instead
      Specified the product price group this rule is assigned to. This field is only of interest if no product was specified.Please note that by now product price groups are not managed by the hybris Platform, and therefore are only Strings. null is a valid value and means that all groups are matched, while an empty String will result in an invisible PriceRow as it is only matching the "empty String" product price group.
    • getProductGroup

      public EnumerationValue getProductGroup()
      Specified the product price group this rule is assigned to. This field is only of interest if no product was specified.Please note that by now product price groups are not managed by the hybris Platform, and therefore are only Strings. null is a valid value and means that all groups are matched, while an empty String will result in an invisible PriceRow as it is only matching the "empty String" product price group.
    • getProductPriceGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getProductPriceGroup(SessionContext ctx)
      Deprecated.
      since ages - please use getProductGroup( SessionContext ctx ) instead
      Parameters:
      ctx -
    • getProductGroup

      public EnumerationValue getProductGroup(SessionContext ctx)
      Parameters:
      ctx -
    • getCustomer

      @Deprecated(since="ages", forRemoval=false) public Customer getCustomer()
      Deprecated.
      since ages - please use getUser() instead.
      The customer this rule is assigned to. If null is set all customers are meant. If one is specified the customer price group field is not evaluated.
    • getCustomer

      @Deprecated(since="ages", forRemoval=false) public Customer getCustomer(SessionContext ctx)
      Deprecated.
      since ages - please use getUser(SessionContext) instead.
      Parameters:
      ctx -
    • getCustomerPriceGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getCustomerPriceGroup()
      Deprecated.
      since ages - please use getCustomerGroup() instead
      The customer price group which this rule is assigned to. This applies only if no customer is specified. Please note that by now customer price groups are not managed by the hybris Platform, and therefore are only Strings. null is a valid value and means that all groups are matched.
    • getCustomerGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getCustomerGroup()
      Deprecated.
      since ages - please use getUserGroup instead.
      The customer price group which this rule is assigned to. This applies only if no customer is specified. Please note that by now customer price groups are not managed by the hybris Platform, and therefore are only Strings. null is a valid value and means that all groups are matched.
    • getUserGroup

      public EnumerationValue getUserGroup()
      The user group which this rule is assigned to. This applies only if no user is specified. Please note that by now user groups are not managed by the hybris Platform, and therefore are only Strings. null is a valid value and means that all groups are matched.
    • getCustomerPriceGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getCustomerPriceGroup(SessionContext ctx)
      Deprecated.
      since ages - please use getUserGroup( SessionContext ctx) instead
      Parameters:
      ctx -
    • getCustomerGroup

      @Deprecated(since="ages", forRemoval=false) public EnumerationValue getCustomerGroup(SessionContext ctx)
      Deprecated.
      since ages - please use getUserGroup instead.
      Parameters:
      ctx -
    • getUserGroup

      public EnumerationValue getUserGroup(SessionContext ctx)
      Parameters:
      ctx -
    • getDateRange

      public StandardDateRange getDateRange()
    • getDateRange

      public StandardDateRange getDateRange(SessionContext ctx)
      The range of time which this row is valid within. If null the row is always valid.
    • setDateRange

      public void setDateRange(StandardDateRange dateRange)
    • setDateRange

      public void setDateRange(SessionContext ctx, StandardDateRange dateRange)
      Method setDateRange
      Parameters:
      ctx -
      dateRange -
    • remove

      public void remove(SessionContext ctx) throws ConsistencyCheckException
      Description copied from class: Item
      Removes this item.

      This method is using the following attributes of the given SessionContext:

      CacheUsage   Language   StagingMethod
      n/a (this is a setter method)   no, language doesn't matter for removal   yes if called on a StageableItem, no otherwise


      Overrides:
      remove in class Item
      Parameters:
      ctx - A SessionContext object
      Throws:
      ConsistencyCheckException - if this item could not be removed for some reason
    • setProperty

      public Object setProperty(SessionContext ctx, String name, Object value)
      Overwritten to mark owning product as modified each time a property of this row has been changed.
      Overrides:
      setProperty in class ExtensibleItem
      Parameters:
      ctx - A SessionContext object
      name - the name (key) of the property
      value - the value
      Returns:
      the property that was bound to the name or null if there was no property.
    • markProductModified

      protected void markProductModified()
      Marks the product which this row (might) belong to modified. This method is called upon all modifications done to a PDTRow to allow proper product modification status.

      This functionality can be enabled / disabled using two config settings. First you can enabled / disable it using the session attribute Europe1Constants.PDTROW_MARK_PRODUCT_MODIFIED to true / false. If this session attribute is set to true, the product will be marked as modified independent of the other config setting. If set to false, the config property pdtrow.mark.product.modified configured in your local.properties will be evaluated, if set to true, the product will be marked modified, if set to false the mark as modified will be skipped.

      By default this feature is disabled (no session attribute set (-> false) and the default value in project.properties is set to false.