Skip to content

Declarative value constructor

Ryan Newington edited this page Sep 4, 2025 · 7 revisions

Declarative Value Constructor

The Declarative Value Constructor (DVC) is the most frequently used constructor in ACMA deployments. It provides a powerful, flexible way to build attribute values using the intuitive ACMA declarative language, enabling complex value generation through simple, readable expressions.

Overview and Capabilities

The DVC allows you to create dynamic attribute values by combining:

  • Object attributes: Current and referenced object properties
  • Constants: Predefined configuration values
  • Sequences: Auto-incrementing numbers and identifiers
  • Static text: Fixed strings and formatting
  • Transforms: Data manipulation and formatting functions

Configuration Parameters

Basic Settings

Constructor ID

  • Purpose: Unique identifier across the entire ACMA configuration
  • Requirements: Must be unique across all class constructors
  • Format: Alphanumeric characters (A-Z, 0-9) and hyphens (-) only
  • Best practice: Use descriptive names like email-generation or display-name-builder

Description

  • Purpose: Documentation for constructor functionality and business logic
  • Format: Free-text field supporting detailed explanations
  • Best practice: Include business rules, examples, and maintenance notes

Disable Constructor

  • Purpose: Temporarily disable constructor without removing configuration
  • Behavior: Disabled constructors skip execution conditions and never run
  • Use cases: Testing, troubleshooting, phased deployments

Target Configuration

Target Attribute

  • Purpose: Specifies which attribute the constructor will modify
  • Scope: Must be bound to the current object class

Modification Type

Controls how the constructor interacts with existing attribute values:

Modification Type Single-Valued Behavior Multi-Valued Behavior
Add Sets value if empty, replaces if exists Adds new values to existing set
Replace Sets value (same as Add for SV) Replaces all existing values
Delete Removes specific value if present Removes specified values only
Conditional Adds/removes based on conditions Adds/removes based on conditions

Declaration Configuration

The declaration is the heart of the Declarative Value Constructor - it defines exactly what value will be generated and assigned to the target attribute. How declarations work depends on whether you're targeting a single-valued or multi-valued attribute, as each has different capabilities and behaviors.

Single-Valued Attributes

When targeting single-valued attributes (like displayName, mail, or employeeNumber), the constructor works with one declaration that produces a single result:

  • One declaration per constructor: You configure exactly one value declaration that will generate the attribute's value
  • ACMA declarative language expressions: The declaration uses the full power of ACMA DL syntax to combine attributes, constants, sequences, and static text into a dynamic expression
  • Transform support: After the declaration is evaluated, you can apply optional transforms to format, modify, or validate the resulting value
  • Replacement behavior: When the constructor runs, it will replace any existing value with the newly generated one (unless using conditional modification)

For example, a declaration like {firstName} {sn} will take the person's first name and surname, combine them with a space, and assign that as the display name.

Multi-Valued Attributes

Multi-valued attributes (like proxyAddresses, mailAlternateAddresses, or custom collection attributes) support more complex declaration patterns:

  • Multiple declarations supported: You can configure multiple separate declarations within a single constructor, each generating different values that will all be added to the attribute
  • Independent evaluation: Each declaration is evaluated separately and independently - if one fails or produces no value, the others still execute normally
  • Flexible value mixing: You can combine static values (like fixed email aliases) with dynamic expressions (like department-based aliases) in the same constructor
  • Additive behavior: By default, each declaration adds values to the existing set rather than replacing them (unless using Replace modification type)

For instance, you might have one declaration that adds a standard alias ({firstName}.{sn}@%mailDomain%) and another that adds a department-specific alias ({firstName}.{sn}@%altMailDomain%).

Advanced Features

Conditional Modification

The Conditional modification type provides sophisticated control over when values should be added or removed from attributes. Unlike the simpler Add, Replace, or Delete types, Conditional modification dynamically manages attribute values based on changing conditions.

When modification type is set to Conditional, the constructor behavior changes significantly:

Presence Conditions: Instead of always adding values, you define specific conditions (using the standard ACMA rules framework) that determine when each declared value should be present on the object. These conditions are evaluated every time the constructor runs.

Automatic Removal: This is the key differentiator - if a value is present but the presence conditions are no longer met, ACMA will automatically remove that value from the attribute. This creates truly dynamic attribute management.

Rule Integration: Presence conditions use the same rule types available elsewhere in ACMA (attribute presence, value comparison, object change, etc.), giving you full flexibility in defining complex conditional logic.

Bidirectional Management: The constructor not only adds values when conditions are met, but also removes them when conditions are no longer satisfied, maintaining consistency automatically.

Execution Order: The evaluation happens in a specific sequence to ensure predictable behavior:

  1. Constructor execution rules are evaluated first → If these fail, the constructor is skipped entirely
  2. For each declaration, presence conditions are evaluated → If conditions are met, the value is added; if not met but the value exists, it's removed
  3. Declared transformations are applied to any values being added
  4. Target attribute is updated with the final set of values

This makes conditional modification perfect for scenarios like dynamic group membership based on department, temporary access rights based on project assignment, or any situation where attribute values should automatically appear and disappear based on changing object properties.

Practical Examples

Basic Value Construction

Scenario: Create display name from first and last name

Target Attribute: displayName
Modification Type: Add
Declaration: {firstName} {sn}

Email Address Generation

Scenario: Generate email with domain suffix

Target Attribute: mail
Modification Type: Add  
Declaration: {firstName}.{sn}@%mailDomain%
Transforms: ToLower

Multi-Valued Email Aliases

Scenario: Generate multiple email aliases for a user

Target Attribute: proxyAddresses
Modification Type: Add
Declaration 1: {firstName}.{sn}@%mailDomain%
Declaration 2: {accountName}@%mailDomain%
Transforms: ToLower

Conditional Access Rights

Scenario: Add admin rights only for IT department

Target Attribute: accessRights
Modification Type: Conditional
Declaration: AdminAccess
Presence Conditions: orgUnitDisplayName = "IT"

Clone this wiki locally