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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Converts ProductGroup into a filter including converting any PX searchable items into a custom filter.
    fromMap(ObjectMapper mapper, Map<String,Object> map)
    Creates ProductGroup object from a Map object that represents 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.
    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:
    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:
     
    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

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ProductGroup

      public ProductGroup()
  • Method Details

    • getLabel

      public String 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 by createProductGroupEntry.

      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

      public void setLabel(String label)
      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

      public String 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 by createProductGroupEntry.

      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

      public void setProductFieldName(String productFieldName)
      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

      public String 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 by createProductGroupEntry.

      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

      public void setProductFieldLabel(String productFieldLabel)
      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

      public String 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 by createProductGroupEntry.

      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

      public void setProductFieldValue(String productFieldValue)
      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

      protected String 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 by createProductGroupEntry.

      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

      protected void setProductFilterCriteriaJson(String productFilterCriteria)
      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

      public Map<String,Object> getProductFilterCriteria()
      Returns a filter as JSON by a criteria selected from the product group picker. The method is connected to the input field created by createProductGroupEntry.

      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

      public void setProductFilterCriteria(Map<String,Object> productFilterCriteriaMap)
      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

      public Filter 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

      public Filter asFilterWithPXSubQuery()
      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

      public Filter asFilter(DMDataSource productDS) throws DMFieldNotFoundException
      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

      public static ProductGroup fromMap(Map<String,Object> map)
      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

      public static ProductGroup fromMap(ObjectMapper mapper, Map<String,Object> map)
      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

      public static ProductGroup fromSimpleFilter(String productFieldName, String productFieldValue)
      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

      public String toString()
      Overrides:
      toString in class Object
    • validate

      public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService)
    • getDomainFilter

      public Filter 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 interface GroupObject
      Returns:
      The filter object.
    • getDomainTableName

      public String 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 interface GroupObject
      Returns:
      The domain object name
    • getDomainObjectType

      public String 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 interface GroupObject
      Returns:
      The domain object type name