Interface DatamartContext.DataSlice

Enclosing interface:
DatamartContext

public static interface DatamartContext.DataSlice
A reusable definition of a filtered subset ("slice") of a PA DataSet (Datamart, DataSource...): a combination of CustomerGroup, ProductGroup, and CalendarUtil.TimePeriod inclusions and exclusions, plus arbitrary other Filters added with addFilter(Filter). Obtained from DatamartContext.newDatamartSlice() or DatamartContext.newDatamartSlice(String, Object...), and typically passed to Exprs.fromDataSlice(net.pricefx.formulaengine.scripting.queryapi.Tables.Columns, net.pricefx.formulaengine.DatamartContext.DataSlice) to use in a query. In Rebate Manager and Compensation Manager, a combination of a TimePeriod, CustomerGroup, and ProductGroup is a common way to define a calculation's base data.

Inclusions and exclusions are all OR-ed together. They are then combined as (inclusions AND NOT exclusions), i.e. ( (inclusion1 OR inclusion2 OR inclusion3...) AND NOT (exclusion1 OR exclusion2...) ).

When any TimePeriod is included or excluded, the slice also needs to know which date dimension field to match it against. This field is set via DatamartContext.newDatamartSlice(String, Object...) or setDateFieldName(String) and is common to all TimePeriods used.

  • Method Details

    • include

      void include(CustomerGroup customerGroup)
      Includes the given CustomerGroup in this slice.
      Parameters:
      customerGroup - the customer group to include; does nothing if null
    • include

      void include(ProductGroup productGroup)
      Includes the given ProductGroup in this slice.
      Parameters:
      productGroup - the product group to include; does nothing if null
    • exclude

      void exclude(CustomerGroup customerGroup)
      Excludes the given CustomerGroup from this slice.
      Parameters:
      customerGroup - the customer group to exclude; does nothing if null
    • exclude

      void exclude(ProductGroup productGroup)
      Excludes the given ProductGroup from this slice.
      Parameters:
      productGroup - the product group to exclude; does nothing if null
    • include

      void include(CalendarUtil.TimePeriod timePeriod)
      Includes the given CalendarUtil.TimePeriod in this slice, matched against this slice's date dimension field.
      Parameters:
      timePeriod - the time period to include; does nothing if null
      See Also:
    • exclude

      void exclude(CalendarUtil.TimePeriod timePeriod)
      Excludes the given CalendarUtil.TimePeriod from this slice, matched against this slice's date dimension field.
      Parameters:
      timePeriod - the time period to exclude; does nothing if null
      See Also:
    • addFilter

      void addFilter(Filter filter)
      Adds an arbitrary Filter to this slice's inclusion conditions, independent of and in addition to its group and time-period inclusions.
      Parameters:
      filter - the filter to add; does nothing if null
    • clear

      void clear()
      Clears all of this slice's inclusions, exclusions, and added filters, leaving its date dimension field name unchanged.
    • getDateFieldName

      String getDateFieldName()
      Returns the technical name of the date dimension field this slice's CalendarUtil.TimePeriod inclusions and exclusions are matched against.
      Returns:
      this slice's date dimension field name, or the unresolved placeholder if none has been set
    • setDateFieldName

      void setDateFieldName(String dateDimFieldName)
      Sets the technical name of the date dimension field this slice's CalendarUtil.TimePeriod inclusions and exclusions are matched against.
      Parameters:
      dateDimFieldName - the date dimension field name to set