A JSON Attribute Mapping Field is used to construct a value for a single JSON field as part of a JSON Attribute Mapping. The field value can be populated from either a source attribute or a constructed value pattern.
If a single value for the field cannot be constructed (either the required attributes are not present on the source entry or the resulting value has the wrong type), then the mapping does not fail, but the field will not be present in the JSON attribute.
The following components have a direct composition relation to JSON Attribute Mapping Fields:
The properties supported by this managed object are as follows:
Basic Properties: | Advanced Properties: |
---|---|
description | None |
json-field | |
json-type | |
from-attribute | |
value-pattern |
Description | A description for this JSON Attribute Mapping Field |
Default Value | None |
Allowed Values | A string |
Multi-Valued | No |
Required | No |
Admin Action Required | None. Modification requires no further action |
Description | Specifies the name of the JSON field whose value will be constructed. The specified field must be at the top of the desired JSON object hierarchy. That is, the field cannot be a field within a nested object. |
Default Value | None |
Allowed Values | The name of the JSON field |
Multi-Valued | No |
Required | Yes |
Admin Action Required | None. Modification requires no further action |
Description | The type of the JSON field. This is used to validate the content of the field. Use 'raw' to avoid most validation. 'string' types are automatically enclosed in quotes and special characters escaped. |
Default Value | None |
Allowed Values | boolean - The value is boolean (true or false). number - The value is a JSON number. object - The value is a JSON object. raw - The value is raw JSON. It could be any of the types here or an array. String values must be quoted and special characters escaped. string - The value is a string. It will automatically enclosed in quotes and special characters escaped. |
Multi-Valued | No |
Required | Yes |
Admin Action Required | None. Modification requires no further action |
Description | Specifies the name of the source attribute whose value is used to directly provide the value of the JSON field. |
Default Value | None |
Allowed Values | The name of the source attribute |
Multi-Valued | No |
Required | No |
Admin Action Required | None. Modification requires no further action |
Description | Specifies a pattern for constructing the field value using fixed text and attribute values from the source entry. If the json-type property is set to 'string', then the value will automatically be quoted and special characters escaped. By default, any text provided in the value-pattern is copied verbatim into the target value with the exception of attribute names embedded in '{}'s. Attributes are substituted using their value, e.g. {uid} will select the uid attribute from the entry and use that value in place of {uid} in the value-pattern. No attribute values may be multivalued. If the entry has no value or if there are any multivalued attributes, the field value construction will fail and no values will be constructed. The field will be omitted from the JSON attribute. To include a '{' in the constructed value use '{{' in the value-pattern. Likewise, '}}' will result in '}' in the value pattern. Furthermore, a regular expression with a substitution pattern can be used to further manipulate an individual attribute value. The java.util.regex.Pattern and java.util.regex.Matcher classes are used to perform the substitution. The regular expression with replacement value uses this syntax '{attr-name:/regex/replacement/flags}'. 'attr-name' is an attribute name such as 'cn'. 'regex' is a regular expression using the syntax described in the java.util.regex.Pattern javadoc. The optional flags value can also be used to change how this regular expression is interpreted. 'replacement' is a replacement value that is passed to the java.util.regex.Matcher#replaceFirst or java.util.regex.Matcher#replaceAll method to perform the replacement. The 'g' (global) flag controls whether replaceFirst or replaceAll is called. 'flags' is an optional set of single character flags that control how the regular expression is interpreted and how the replacement is performed. The flags are:
Pattern pattern = Pattern.compile(regex, flagsMask); To extract JSON fields within JSON attributes append '.' and then the JSON field to extract to the attribute name. For example, if 'ubidEmailJSON' is a JSON attribute and the 'value' field is to be extracted then 'ubidEmailJSON.value' could be specified for the attribute name resulting in '{ubidEmailJSON.value}' or '{ubidEmailJSON.value:/regex/replacement/flags}' if a regular expression is to be used. In addition, a JSON object filter may be provided in parentheses after the JSON field name to indicate that the field value will only be extracted if the attribute value matches the provided filter. For example, if 'ubidEmailJSON' is a JSON attribute and the 'value' field is to be extracted only for values where the 'type' field is equal to 'work', then the value pattern that would specify this would be '{ubidEmailJSON.value({{"filterType":"equals","field":"type","value":"work"}})}' or '{ubidEmailJSON.value({{"filterType":"equals","field":"type","value":"work"}})}:/regex/replacement/flags' if a regular expression is to be used. Note that all instances of '{' and '}' need to be escaped as '{{' and '}}' within the constructed value including those in the JSON object filter. To apply modifiers to the values extracted append ':' and then the name of the modifier to apply. For example, if field 'mail' is to be included in a nested JSON object value then modifier 'jsonEscape' could be specified resulting in '{{ "userMail":"{mail:jsonEscape}" }}' or '{{ "userMail":"{mail:/regex/replacement/flags:jsonEscape}" }}' if a regular expression is to be used. Note that '{{' expands to '{' and '}}' to '}'. The modifiers are:
|
Default Value | None |
Allowed Values | The pattern to use to construct the field value. |
Multi-Valued | No |
Required | No |
Admin Action Required | None. Modification requires no further action |
To list the configured JSON Attribute Mapping Fields:
dsconfig list-json-attribute-mapping-fields [--property {propertyName}] ...
To view the configuration for an existing JSON Attribute Mapping Field:
dsconfig get-json-attribute-mapping-field-prop --field-name {name} --mapping-name {name} --map-name {name} [--tab-delimited] [--script-friendly] [--property {propertyName}] ...
To update the configuration for an existing JSON Attribute Mapping Field:
dsconfig set-json-attribute-mapping-field-prop --field-name {name} --mapping-name {name} --map-name {name} (--set|--add|--remove) {propertyName}:{propertyValue} [(--set|--add|--remove) {propertyName}:{propertyValue}] ...
To create a new JSON Attribute Mapping Field:
dsconfig create-json-attribute-mapping-field --field-name {name} --mapping-name {name} --map-name {name} --set json-type:{propertyValue} [--set {propertyName}:{propertyValue}] ...
To delete an existing JSON Attribute Mapping Field:
dsconfig delete-json-attribute-mapping-field --field-name {name} --mapping-name {name} --map-name {name}