Package net.pricefx.domain
Class ProductGroup
Object
DomainObject
ProductGroup
- All Implemented Interfaces:
GroupObject
@Embeddable
public class ProductGroup
extends DomainObject
implements GroupObject
ProductGroup
-
Field Summary
Fields inherited from class DomainObject
DEFAULT_MAX_PACKET_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasFilter()
Converts ProductGroup to a filter object.asFilter
(DMDataSource productDS) Returns resolved filter using the given Data Source, which should represent the Product attributed object class.asFilter
(DMDataSource productDS, Collection<DMDataSource> pxExtDS) Returns resolved filter using the given Product Data Source and external Data Source, which should represent the Product attributed object class.Deprecated.static ProductGroup
Creates ProductGroup object from a Map object that represents ProductGroup.static ProductGroup
Creates ProductGroup object from a Map object that represents ProductGroup.
Allows you, for example, to use this object in a Datamart query with usage of the "where" clause.static ProductGroup
fromSimpleFilter
(String productFieldName, String productFieldValue) Returns ProducGroup created from a simple fieldName and fieldValue filter.Get GroupObject as a filter including any extension valid for particular DomainObject into a custom filter Example:Get group context parameter name for the particular DomainObject Example:Get context parameter name for the particular DomainObject Example:getLabel()
Returns the product field label when an item (not a filter statement) from the product group picker is selected.Returns the product field label when an item (not a filter statement) from the product group picker is selected.Returns the product field name when an item (not a filter statement) from the product group picker is selected.Returns the product field value when an item (not a filter statement) from the product group picker is selected.Returns a filter as JSON by a criteria selected from the product group picker.protected String
Returns a filter as deserialized JSON by a criteria selected from the product group picker.void
Sets the new Product Group input label.
Example:void
setProductFieldLabel
(String productFieldLabel) Sets a field label value of the ProductGroup object.
Example:void
setProductFieldName
(String productFieldName) Sets a field name value of the ProductGroup object.
Example:void
setProductFieldValue
(String productFieldValue) Sets a field value of the ProductGroup object.
Example:void
setProductFilterCriteria
(Map<String, Object> productFilterCriteriaMap) Sets the filter criteria from a map of filters for the ProductGroup.
Example:protected void
setProductFilterCriteriaJson
(String productFilterCriteria) Sets the filter criteria from a JSON filter for the ProductGroup.
Example:toString()
boolean
validate
(ValidationVisitor validationVisitor, PersistedObjectService objService) Methods inherited from class DomainObject
deepCopy, getNewMidnightDate, getNewMidnightDateTime, isMidnight, isMidnight, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerializedSizeOK, jsonSerializeToBytes, jsonSerializeToBytes, setToDayEnd, setToDayEnd, setToMidnight, setToMidnight, setToMidnightAsLocalDateTime, toPropertyMap
-
Constructor Details
-
ProductGroup
public ProductGroup()
-
-
Method Details
-
getLabel
Returns the product field label when an item (not a filter statement) from the product group picker is selected. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputLabel = input.getLabel() return inputLabel
- Returns:
- The label value.
-
setLabel
Sets the new Product Group input label.
Example:ProductGroup cg = api.productGroupEntry("ProductGroup") cg.setLabel("The new product group label")
- Parameters:
label
- The new label of the Product Group.
-
getProductFieldName
Returns the product field name when an item (not a filter statement) from the product group picker is selected. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputName = input.getProductFieldName() return inputName
- Returns:
- The productFieldName value.
-
setProductFieldName
Sets a field name value of the ProductGroup object.
Example:ProductGroup products = new ProductGroup() products.setProductFieldName("sku")
- Parameters:
productFieldName
- The value of the product field name.
-
getProductFieldLabel
Returns the product field label when an item (not a filter statement) from the product group picker is selected. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputLabel = input.getProductFieldLabel() return inputLabel
- Returns:
- The value of the label for the ProductGroup object.
-
setProductFieldLabel
Sets a field label value of the ProductGroup object.
Example:ProductGroup products = new ProductGroup() products.setProductFieldLabel("The Product Label")
- Parameters:
productFieldLabel
- The value of the product field label for the ProductGroup object.
-
getProductFieldValue
Returns the product field value when an item (not a filter statement) from the product group picker is selected. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputValue = input.getProductFieldValue() return inputValue
- Returns:
- The productFieldValue value.
-
setProductFieldValue
Sets a field value of the ProductGroup object.
Example:ProductGroup products = new ProductGroup() products.setProductFieldValue("123456789")
- Parameters:
productFieldValue
- The value of the field for the ProductGroup object.
-
getProductFilterCriteriaJson
Returns a filter as deserialized JSON by a criteria selected from the product group picker. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputFilterJson = input.getProductFilterCriteria() return inputFilterJson
- Returns:
- The deserialized JSON formatted filter object.
-
setProductFilterCriteriaJson
Sets the filter criteria from a JSON filter for the ProductGroup.
Example:def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) Map filterJson = """{ "_constructor":"AdvancedCriteria", "operator":"and", "criteria":[ { "fieldName":"sku", "operator":"iEquals", "value":"123456789" } ] } """ ProductGroup newPg = new ProductGroup() newPg.setProductFilterCriteriaJson(filterJson) return newPg
- Parameters:
productFilterCriteria
- The filter criteria as a JSON representation.
-
getProductFilterCriteria
Returns a filter as JSON by a criteria selected from the product group picker. The method is connected to the input field created bycreateProductGroupEntry
.Example:
def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) String inputFilterJson = input.getProductFilterCriteriaJson() return inputFilterJson
- Returns:
- The JSON formatted filter.
-
setProductFilterCriteria
Sets the filter criteria from a map of filters for the ProductGroup.
Example:def inputMap = input.ProductGroup if (inputMap == null){ return } def input = ProductGroup.fromMap(inputMap) Map filterJson = [_constructor: "AdvancedCriteria", operator : "and", criteria : [ [ fieldName : "sku", operator : "equals", value : "123456789", _constructor: "AdvancedCriteria" ] ] ] ProductGroup newPg = new ProductGroup() newPg.setProductFilterCriteria(filterJson) return newPg
- Parameters:
productFilterCriteriaMap
- The product filter criteria as a map.
-
asFilter
Converts ProductGroup to a filter object. Creates Filter from instance properties productFieldName and productFieldValue, or from productCriteria. Can return null.Example:
def productGroupMap = input.ProductGroup if (productGroupMap == null){ return } def products = api.find("P", (input.ProductGroup as ProductGroup)?.asFilter()) return products
- Returns:
- The filter object.
-
asFilterWithPXSubQuery
Deprecated.Directly useasFilter()
Converts ProductGroup into a filter including converting any PX searchable items into a custom filter. Not intended for PA.Example:
def productGroup = input.ProductGroup ProductGroup pg = ProductGroup.fromMap(input.ProductGroup) def products = api.find("C", pg.asFilterWithPXSubQuery())
- Returns:
- The filter object.
-
asFilter
Returns resolved filter using the given Data Source, which should represent the Product attributed object class.- Parameters:
productDS
- Product Data Source.- Returns:
- The filter object.
- Throws:
DMFieldNotFoundException
-
asFilter
public Filter asFilter(DMDataSource productDS, Collection<DMDataSource> pxExtDS) throws DMFieldNotFoundException Returns resolved filter using the given Product Data Source and external Data Source, which should represent the Product attributed object class.- Parameters:
productDS
- Product Data Source. Must not be null.pxExtDS
- External Data Source.- Returns:
- The filter object.
- Throws:
DMFieldNotFoundException
-
fromMap
Creates ProductGroup object from a Map object that represents ProductGroup.
Allows you, for example, to use this object in a Datamart query with usage of the "where" clause.Example:
def pgInput = api.productGroupEntry("Entry") ProductGroup cg = ProductGroup.fromMap(pgInput)
- Parameters:
map
- The representation of ProductGroup as a Map.- Returns:
- The ProductGroup object.
-
fromMap
Creates ProductGroup object from a Map object that represents ProductGroup.- Parameters:
mapper
- The JSON object mapper.map
- The representation of ProductGroup as a Map.- Returns:
- The ProductGroup object.
-
fromSimpleFilter
Returns ProducGroup created from a simple fieldName and fieldValue filter.Example:
ProductGroup productGroup = ProductGroup.fromSimpleFilter('sku', "P12345")
- Parameters:
productFieldName
- The name of the field from the Product Master table used in the simple filter.productFieldValue
- The value of the field from the Product Master table used in the simple filter.- Returns:
- The ProductGroup object.
-
toString
-
validate
public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService) -
getDomainFilter
Description copied from interface:net.pricefx.domain.GroupObject
Get GroupObject as a filter including any extension valid for particular DomainObject into a custom filter Example:def customerGroup = api.customerGroupEntry('Select customers:') def domainFilter = customerGroup.getDomainFilter() def customers = api.find('C', domainFilter)
- Specified by:
getDomainFilter
in interfaceGroupObject
- Returns:
- The filter object.
-
getDomainTableName
Description copied from interface:net.pricefx.domain.GroupObject
Get context parameter name for the particular DomainObject Example:def customerGroup = api.customerGroupEntry('Select customers:') def domainTableName = customerGroup.getDomainTableName() api.trace('domain table', domainTableName) // == 'Customer'
- Specified by:
getDomainTableName
in interfaceGroupObject
- Returns:
- The domain object name
-
getDomainObjectType
Description copied from interface:net.pricefx.domain.GroupObject
Get group context parameter name for the particular DomainObject Example:def customerGroup = api.customerGroupEntry('Select customers:') def domainObjectType = customerGroup.getDomainObjectType() api.trace('domain type', domainObjectType) // == 'CustomerGroup'
- Specified by:
getDomainObjectType
in interfaceGroupObject
- Returns:
- The domain object type name
-
asFilter()