Class CustomerGroup

Object
DomainObject
CustomerGroup
All Implemented Interfaces:
GroupObject

@Embeddable public class CustomerGroup extends DomainObject implements GroupObject
CustomerGroup
  • Field Summary

    Fields inherited from class DomainObject

    DEFAULT_MAX_PACKET_SIZE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Converts CustomerGroup to Filter object.
    asFilter(DMDataSource customerDS)
    Returns resolved filter using the given DS, which should represent the Customer attributed object class.
    asFilter(DMDataSource customerDS, Collection<DMDataSource> cxExtDS)
    Returns resolved filter using the given Customer Data Source and external Data Source, which should represent the Customer attributed object class.
    Converts CustomerGroup into a filter including converting any CX searchable items into a custom filter.
    boolean
    Indicates (returns true or false) whether another object is equal.
    fromMap(ObjectMapper mapper, Map<String,Object> map)
    Creates CustomerGroup object from a Map object that represents CustomerGroup.
    Creates CustomerGroup object from a Map object that represents CustomerGroup.
    Allows you, for example, to use this object in a Datamart query with usage of the "where" clause.
    fromSimpleFilter(String customerFieldName, String customerFieldValue)
    Returns CustomerGroup created from a simple fieldName and fieldValue filter.
    Returns the customer field label when an item (not a filter statement) from the customer group picker is selected.
    Returns the customer field name when an item (not a filter statement) from the customer group picker is selected.
    Returns the customer field value when an item (not a filter statement) from the customer group picker is selected.
    Returns a filter criteria as a map of filters by a criteria selected from the customer group picker.
    protected String
    Returns a filter as JSON by a criteria selected from the customer group picker.
    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 customer field label when an item (not a filter statement) from the customer group picker is selected.
    int
    Returns a hash code value for the given object.
    void
    setCustomerFieldLabel(String customerFieldLabel)
    Sets a field label value of the CustomerGroup object.
    Example:
    void
    setCustomerFieldName(String customerFieldName)
    Sets a field name value of the CustomerGroup object.
    Example:
    void
    setCustomerFieldValue(String customerFieldValue)
    Sets a field value of the CustomerGroup object.
    Example:
    void
    setCustomerFilterCriteria(Map<String,Object> customerFilterCriteriaMap)
    Sets the filter criteria from a map of filters for the CustomerGroup.
    Example:
    protected void
    setCustomerFilterCriteriaJson(String customerFilterCriteria)
    Sets the filter criteria from a JSON filter for the CustomerGroup.
    Example:
    void
    Sets the Customer Group input label.
    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, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CustomerGroup

      public CustomerGroup()
  • Method Details

    • getLabel

      public String getLabel()
      Returns the customer field label when an item (not a filter statement) from the customer group picker is selected. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null) {
           return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputLabel = input.getLabel()
      
       return inputLabel
       
      Returns:
      The label value.
    • setLabel

      public void setLabel(String label)
      Sets the Customer Group input label.
      Example:
      
       CustomerGroup cg = api.customerGroupEntry("CustomerGroup")
       cg.setLabel("The new customer group label")
       
      Parameters:
      label - The label of the Customer Group.
    • getCustomerFieldName

      public String getCustomerFieldName()
      Returns the customer field name when an item (not a filter statement) from the customer group picker is selected. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null){
         return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputName = input.getCustomerFieldName()
      
       return inputName
       
      Returns:
      The customerFieldName value.
    • setCustomerFieldName

      public void setCustomerFieldName(String customerFieldName)
      Sets a field name value of the CustomerGroup object.
      Example:
      
        CustomerGroup customers = new CustomerGroup()
        customers.setCustomerFieldName("customerId")
       
      Parameters:
      customerFieldName - The value of the field name for the CustomerGroup object.
    • getCustomerFieldLabel

      public String getCustomerFieldLabel()
      Returns the customer field label when an item (not a filter statement) from the customer group picker is selected. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null){
         return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputLabel = input.getCustomerFieldLabel()
      
       return inputLabel
       
      Returns:
      The customerFieldLabel value.
    • setCustomerFieldLabel

      public void setCustomerFieldLabel(String customerFieldLabel)
      Sets a field label value of the CustomerGroup object.
      Example:
      
       CustomerGroup customers = new CustomerGroup()
       customers.setCustomerFieldLabel("The Customer")
       
      Parameters:
      customerFieldLabel - The value of the CustomerGroup object's field label.
    • getCustomerFieldValue

      public String getCustomerFieldValue()
      Returns the customer field value when an item (not a filter statement) from the customer group picker is selected. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null){
         return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputValue = input.getCustomerFieldValue()
      
       return inputValue
       
      Returns:
      The customerFieldValue value.
    • setCustomerFieldValue

      public void setCustomerFieldValue(String customerFieldValue)
      Sets a field value of the CustomerGroup object.
      Example:
      
        CustomerGroup customers = new CustomerGroup()
        customers.setCustomerFieldValue("Bosch")
       
      Parameters:
      customerFieldValue - The value of the field for the CustomerGroup object.
    • getCustomerFilterCriteriaJson

      protected String getCustomerFilterCriteriaJson()
      Returns a filter as JSON by a criteria selected from the customer group picker. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null){
         return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputFilterJson = input.getCustomerFilterCriteriaJson()
      
       return inputFilterJson
       
      Returns:
      The JSON formatted filter.
    • setCustomerFilterCriteriaJson

      protected void setCustomerFilterCriteriaJson(String customerFilterCriteria)
      Sets the filter criteria from a JSON filter for the CustomerGroup.
      Example:
      
       def inputMap = input.CustomerGroup
                if (inputMap == null){
                 return
                  }
       def input = CustomerGroup.fromMap(inputMap)
       Map filterJson = """{
          "_constructor":"AdvancedCriteria",
          "operator":"and",
          "criteria":[
             {
                "fieldName":"attribute2",
                "operator":"iEquals",
                "value":"123456789"
             }
          ]
       }
       """
      
       CustomerGroup newCg = new CustomerGroup()
       newCg.setCustomerFilterCriteriaJson(filterJson)
       return newCg
           
      Parameters:
      customerFilterCriteria - The filter criteria as a JSON representation.
    • getCustomerFilterCriteria

      public Map<String,Object> getCustomerFilterCriteria()
      Returns a filter criteria as a map of filters by a criteria selected from the customer group picker. The method is connected to the input field created by createCustomerGroupEntry.

      Example:

      
       def inputMap = input.CustomerGroup
       if (inputMap == null){
         return
       }
      
       def input = CustomerGroup.fromMap(inputMap)
       String inputFilterJson = input.getCustomerFilterCriteria()
      
       return inputFilterJson
       
      Returns:
      The map of filters (deserialized JSON).
    • setCustomerFilterCriteria

      public void setCustomerFilterCriteria(Map<String,Object> customerFilterCriteriaMap)
      Sets the filter criteria from a map of filters for the CustomerGroup.
      Example:
      
       def inputMap = input.CustomerGroup
                if (inputMap == null){
                 return
                  }
       def input = CustomerGroup.fromMap(inputMap)
       Map filterJson = [_constructor: "AdvancedCriteria",
                                        operator    : "and",
                                        criteria    : [
                                                [
                                                        fieldName   : "attribute1",
                                                        operator    : "equals",
                                                        value       : "EA",
                                                        _constructor: "AdvancedCriteria"
                                                ]
                                        ]
           ]
      
      
       CustomerGroup newCg = new CustomerGroup()
       newCg.setCustomerFilterCriteria(filterJson)
       return newCg
           
      Parameters:
      customerFilterCriteriaMap - The filter criteria as a map.
    • asFilter

      public Filter asFilter()
      Converts CustomerGroup to Filter object. Creates Filter from instance properties customerFieldName and customerFieldValue, or from customerCriteria. Can return null.

      Example:

      
       def customerGroupMap = input.CustomerGroup
       if (customerGroupMap == null){
         return
       }
      
       def customers = api.find("P", (input.CustomerGroup as CustomerGroup)?.asFilter())
       return customers
       
      Returns:
      The filter object.
    • asFilterWithCXSubQuery

      public Filter asFilterWithCXSubQuery()
      Converts CustomerGroup into a filter including converting any CX searchable items into a custom filter. Not intended for PA.

      Example:

      
       def customerGroup = input.CustomerGroup
      
       CustomerGroup cg = CustomerGroup.fromMap(input.Entry)
       def customers = api.find("C", cg.asFilterWithCXSubQuery())
       
      Returns:
      The filter object.
    • asFilter

      public Filter asFilter(DMDataSource customerDS) throws DMFieldNotFoundException
      Returns resolved filter using the given DS, which should represent the Customer attributed object class.
      Parameters:
      customerDS -
      Returns:
      The filter object.
      Throws:
      DMFieldNotFoundException
    • asFilter

      public Filter asFilter(DMDataSource customerDS, Collection<DMDataSource> cxExtDS) throws DMFieldNotFoundException
      Returns resolved filter using the given Customer Data Source and external Data Source, which should represent the Customer attributed object class.
      Parameters:
      customerDS - Customer Data Source. Must not be null.
      cxExtDS - External Data Source.
      Returns:
      The filter object.
      Throws:
      DMFieldNotFoundException
    • fromMap

      public static CustomerGroup fromMap(Map<String,Object> map)
      Creates CustomerGroup object from a Map object that represents CustomerGroup.
      Allows you, for example, to use this object in a Datamart query with usage of the "where" clause.

      Example:

      
       def cgInput = api.customerGroupEntry("Entry")
       CustomerGroup cg = CustomerGroup.fromMap(cgInput)
           
      Parameters:
      map - The representation of CustomerGroup as a Map.
      Returns:
      The CustomerGroup object.
    • fromMap

      public static CustomerGroup fromMap(ObjectMapper mapper, Map<String,Object> map)
      Creates CustomerGroup object from a Map object that represents CustomerGroup.
      Parameters:
      mapper - The JSON object mapper.
      map - The representation of CustomerGroup as a Map.
      Returns:
      The CustomerGroup object.
    • fromSimpleFilter

      public static CustomerGroup fromSimpleFilter(String customerFieldName, String customerFieldValue)
      Returns CustomerGroup created from a simple fieldName and fieldValue filter.

      Example:

      
       CustomerGroup customerGroup = CustomerGroup.fromSimpleFilter('customerId', "Bosch-123")
       
      Parameters:
      customerFieldName - The name of the field from the Customer Master table used in the simple filter.
      customerFieldValue - The value of the field from the Customer Master table used in the simple filter.
      Returns:
      The CustomerGroup object.
    • toString

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

      public boolean equals(Object obj)
      Indicates (returns true or false) whether another object is equal.

      Example:

      
       CustomerGroup customersGroup1 = new CustomerGroup()
       CustomerGroup customersGroup2 = new CustomerGroup()
      
       customersGroup1.equals(customersGroup2)
       
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object to compare with.
    • hashCode

      public int hashCode()
      Returns a hash code value for the given object.

      Example:

      
       CustomerGroup customersGroup1 = new CustomerGroup()
       customersGroup1.hashCode()
       
      Overrides:
      hashCode in class Object
      Returns:
      The hash code value.
    • 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