Sun Directory Server Enterprise Edition 7.0 Administration Guide

Virtual Transformation Examples

The following sections provide use cases in which virtual data views are required, and the combination of transformation models and actions required to implement the use cases.

Deriving an Attribute From the Existing Attributes of an Entry

Use the following transformation rule to derive an attribute from the existing attributes of an entry. For example, when the following transformation rule is applied, it displays the mail attribute derived from the givenName and sn attributes.


$ dpconf add-virtual-transformation dataview1 read add-attr \
mail \${givenName}.\${sn}@example.com 

The following diagram indicates the transformation that occurs on user entries when they are returned in a search.

Deriving an Attribute From the Existing Attributes of
an Entry

Mapping a Virtual Attribute to a Physical Attribute

Use the following mapping transformation rule to add an attribute that is delivered as a part of a pure virtual attribute. For example, when the following transformation rule is applied, the givenName is stored in the server even when it is not specified in the entry. The value is taken from the pure virtual attribute which is defined as mail \${givenName}@example.com.


$ dpconf add-virtual-transformation dataview1 mapping add-attr \
mail \${givenName}@example.com 

First add an entry that contains a virtual attribute, mail, but no givenName attribute. The virtual transformation generates the value for the givenName attribute and the entry is stored with givenName but without the mail attribute. Then, doing a search on using the uid attribute, retrieve the value for givenName, and the same virtual transformation generates the value of the virtual attribute mail.

The following diagram indicates the transformation that occurs on user entries.

Adding an Attribute to the Entry From the Virtual Attribute

Displaying a Second Virtual Value of an Attribute, Specified by Another Physical Attribute

Use the following transformation to display the value of an attribute that is specified by another attribute. For example, displaying uid as cn along with the value of cn that is already stored in the entry. The following does not store the additional value to cn but before the result is returned to the client, the transformation is applied.


$ dpconf add-virtual-transformation dataview1 read add-attr-value cn \${uid}

The following diagram indicates the transformation that occurs on user entries when they are returned in a search.

Displaying the Value of an Attribute Specified by Another
Attribute

Storing a Second Value to an Attribute Specified by Another Physical Attribute

Use the following transformation rule to store the value of an attribute along with the value that you provide while adding a new entry. In this scenario, when you add an entry, an additional value for the mail attribute is stored. This transformation is applied only at the time of creating new entries.


$ dpconf add-virtual-transformation dataview1 write add-attr-value \
mail \${uid}@example.com

The following diagram indicates the transformation that occurs on an add request.

Adding a Value to an Attribute From Another Attribute

Removing an Attribute From the Output

Use the following transformation rule if you do not want to display an attribute in the output. For example, when the following transformation rule is applied, the givenName is not returned in the output.


dpconf add-virtual-transformation dataview1 read remove-attr givenName

The following diagram indicates the transformation that occurs on user entries when they are returned in a search.

Removing an Attribute From the Output

Masking an Attribute While Saving an Entry

Use the following transformation rule if you do not want to store a specific attribute. For example, when the following transformation rule is applied, the givenName attribute is not stored in the physical database. This transformation is applied only at the time of creating new entries.


$ dpconf add-virtual-transformation dataview1 write remove-attr givenName

The following diagram indicates the transformation that occurs on an add request.

Masking an Attribute While Saving an Entry

Displaying a Default Value of an Attribute

Use the following transformation if you want to display a default value assigned to an attribute. For example, when the following transformation is applied, a default telephone number in the entries that do not contain their own telephone number is displayed.


$ dpconf add-virtual-transformation data-view read 11111 telephoneNumber default-number

The following diagram indicates the transformation that occurs on user entries when they are returned in a search.

Displaying a Default Value of an Attribute

Storing a Default Value to an Attribute

The default value is stored only if the value for an attribute is not specified during the creation of an entry. Use the following transformation rule if you want to store an attribute with the default value. For example, when the following transformation is applied, a default telephone number with each entry you create is added. This transformation is applied only at the time of adding an entry.


$ dpconf add-virtual-transformation dataview1 write 11111 \
telephoneNumber telephone-number

The following diagram indicates the transformation that occurs on an add request.

Adding a Default Value to an Attribute