String Attributes
Attribute type id | Type specific restriction parameters |
---|---|
string | minLength: Minimum string length (number of Unicode code units) |
maxLength: Maximum string length (number of Unicode code units) | |
patterns: List of patters that the value must match (Java Pattern). Values has to match all the patters. | |
listOfValues: List of possible values for attribute (can’t be mixed with other restrictions) | |
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" : "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 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();
Updated over 1 year ago