Package net.pricefx.formulaengine
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 Summary
Modifier and TypeMethodDescriptionvoidAdds an arbitraryFilterto this slice's inclusion conditions, independent of and in addition to its group and time-period inclusions.voidclear()Clears all of this slice's inclusions, exclusions, and added filters, leaving its date dimension field name unchanged.voidexclude(CalendarUtil.TimePeriod timePeriod) Excludes the givenCalendarUtil.TimePeriodfrom this slice, matched against this slice's date dimension field.voidexclude(CustomerGroup customerGroup) Excludes the givenCustomerGroupfrom this slice.voidexclude(ProductGroup productGroup) Excludes the givenProductGroupfrom this slice.Returns the technical name of the date dimension field this slice'sCalendarUtil.TimePeriodinclusions and exclusions are matched against.voidinclude(CalendarUtil.TimePeriod timePeriod) Includes the givenCalendarUtil.TimePeriodin this slice, matched against this slice's date dimension field.voidinclude(CustomerGroup customerGroup) Includes the givenCustomerGroupin this slice.voidinclude(ProductGroup productGroup) Includes the givenProductGroupin this slice.voidsetDateFieldName(String dateDimFieldName) Sets the technical name of the date dimension field this slice'sCalendarUtil.TimePeriodinclusions and exclusions are matched against.
-
Method Details
-
include
Includes the givenCustomerGroupin this slice.- Parameters:
customerGroup- the customer group to include; does nothing ifnull
-
include
Includes the givenProductGroupin this slice.- Parameters:
productGroup- the product group to include; does nothing ifnull
-
exclude
Excludes the givenCustomerGroupfrom this slice.- Parameters:
customerGroup- the customer group to exclude; does nothing ifnull
-
exclude
Excludes the givenProductGroupfrom this slice.- Parameters:
productGroup- the product group to exclude; does nothing ifnull
-
include
Includes the givenCalendarUtil.TimePeriodin this slice, matched against this slice's date dimension field.- Parameters:
timePeriod- the time period to include; does nothing ifnull- See Also:
-
exclude
Excludes the givenCalendarUtil.TimePeriodfrom this slice, matched against this slice's date dimension field.- Parameters:
timePeriod- the time period to exclude; does nothing ifnull- See Also:
-
addFilter
Adds an arbitraryFilterto 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 ifnull
-
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'sCalendarUtil.TimePeriodinclusions and exclusions are matched against.- Returns:
- this slice's date dimension field name, or the unresolved
placeholderif none has been set
-
setDateFieldName
Sets the technical name of the date dimension field this slice'sCalendarUtil.TimePeriodinclusions and exclusions are matched against.- Parameters:
dateDimFieldName- the date dimension field name to set
-