Tivoli Directory Integrator, Version 7.1.1

The attribute object

An attribute object is usually contained in Entry objects. An attribute is a named object with associated values. Each value in the attribute corresponds to a Java object of some type. Attribute names are not case-sensitive, and cannot contain a slash ( / ) as part of the name. Remember that some of the Connectors for example, those accessing a database, might consider other characters as unsuitable. If you can, try to stick to alphanumeric characters in attribute names.

If the attribute was populated with Connector values by the attribute map, the values are of the same datatype that the Connector supplied.

For more information, see the Javadocs material included in the installation package (the com.ibm.di.entry.Attribute class).

Examples

Creating a new attribute object

var attr =  system.newAttribute("AttributeName");

This example creates an attribute object with name AttributeName and assigns it to the attr variable. Note that upon initial creation, the attribute holds no value. Now, through the attr variable you can access and interact with the newly created attribute.

Adding values to an attribute

attr.addValue("value 1");
attr.addValue("value 2");

This example adds the string values "value 1" and "value 2" to the attr attribute, thereby creating a multiple values attribute. Consecutive calls to addValue(obj) add values in the same order in the attribute.

Scanning attribute's values

var values = attr.getValues(); 
for (i=0; i<values.length; i++) { 
 	task.logmsg("Value " + i + " --> " + values[i]); 
} 

This example processes any attribute object, whether it holds single or multiple values. In reality, there is no difference between single and multiple-value attributes. Every attribute can hold zero, one or more values. A single-value attribute is therefore merely an underloaded multiple-values attribute.

See also

The Entry object.

[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1