String Attributes

Attribute type idType specific restriction parameters
stringminLength: Minimum string length (number of Unicode code units)
maxLength: Maximum string length (number of Unicode code units)
patterns: List of patterns that the value must match (Java Pattern). Values has to match all the patterns.
listOfValues: List of possible values for attribute (can’t be mixed with other restrictions)
skipListOfValuesValidation: When true, the listOfValues is treated as suggestions: PDX users get the values in a dropdown, but can also enter any custom value, and validation accepts it. Use this for "open enum" fields where the target system recommends values without enforcing them. Defaults to false (only listed values are valid).
listOfValuesDependsOnAttribute: Marks the attribute as dependent on the Account attribute value. Values are defined during account Authentication.
clientSpecificListOfValues: Specifies the attribute to use list of values defined during account Authentication. Value has to match one of ClientSpecificListOfValuesMap’s key returned by adapter during account Authentication.
listOfValuesFilterAttribute: Specifies the attribute to use as a filter attribute. Value of this attribute will be used to get the proper list of values from filteredListOfValues.
filteredListOfValues: Map of of list of values to use depending on listOfValuesFilterAttribute.
📘

All restrictions are validated in provided order.

Attribute validation will fail on the first unfulfilled restriction.

Code Examples:

{
  "id" : "PRODUCT_DESCRIPTION",
  "name" : "Product description",
  "type" : {
    "id" : "string",
    "restriction" : {
      "parameters" : {
        "minLength" : "32",
        "maxLength" : "200"
      },
      "patterns" : [ {
        "pattern" : "\\p{Lu}.*",
        "message" : "Description has to start with uppercase letter."
      }, {
        "pattern" : ".*\\.",
        "message" : "Description has to end with a dot."
      } ]
    }
  }
},
{
  "id" : "BRAND",
  "name" : "Product brand",
  "type" : {
    "id" : "string",
    "restriction" : {
      "listOfValues" : [ "Apple", "Microsoft", "Samsung" ]
    }
  }
},
{
  "id" : "CONDITION",
  "name" : "Product condition",
  "type" : {
    "id" : "string",
    "restriction" : {
      "listOfValues" : [ "new", "refurbished", "used" ],
      "skipListOfValuesValidation" : true
    }
  }
},
{
  "id" : "MODEL",
  "name" : "Product model",
  "type" : {
    "id" : "string",
    "restriction" : {
      "filteredListOfValues" : {
        "Samsung" : [ "Z Fold4", "S22 Ultra" ],
        "Microsoft" : [ "Surface", "Surface Duo" ],
        "Apple" : [ "iPhone 14", "iPhone 12" ]
      },
      "listOfValuesFilterAttribute" : "BRAND"
    }
  }
},
{
  "id" : "Location",
  "name" : "Locations (GLNs)",
  "type" : {
    "id" : "string",
    "restriction" : {
      "parameters" : {
        "listOfValuesDependsOnAttribute" : "true"
      }
    }
  }
},
{
  "id" : "PrimaryShipPoint",
  "name" : "Primary Ship Point",
  "type" : {
    "id" : "string",
    "restriction" : {
      "parameters" : {
        "clientSpecificListOfValues" : "supplierIdList"
      }
    }
  }
}
Attribute conditionAttribute = AttributeBuilder
        .stringAttribute("CONDITION", "Product condition")
        .withListOfValues(List.of("new", "refurbished", "used"))
        .build();
conditionAttribute.getType().getRestriction().setSkipListOfValuesValidation(true);

Attribute attribute = AttributeBuilder
        .stringAttribute("PRODUCT_DESCRIPTION", "Product description")
        .withDescription("Detailed attribute description.")
        .withDisableInSubmitStates(List.of("one", "two"))
        .withDisableInSubmitState("three")
        .withExternalId("PRODUCT.DESCRIPTION/1")
        .withGroups(List.of(AttributeGroupBuilder.listViewAttributeGroup().build(),
                AttributeGroupBuilder.attributeFilterAttributeGroup().build()))
        .withGroup(AttributeGroupBuilder.regularAttributeGroup("OTHER", "Other").build())
        .withHidden(true)
        .withIsFamily(true)
        .withLanguagesEnabled()
        .withMultiValue(true)
        .withReadOnly()
        .withDisplaySequence(1.2)
        .build();

Did this page help you?