Often times it is necessary to create a mapping of keys to values in IdentityIQ. While most of IdentityIQ's data models are fairly flexible and allow attributes to be placed on them; other needs can arise to have these data structures exist independently of other objects. Fortunately, in IdentityIQ this is possible through usage of the Custom object.
Simply put, it is a simple object that has an attribute map, which can be serialized / deserialized into IdentityIQ. This is an example of what one looks like:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Custom PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Custom name="Some Custom Object">
<Attributes>
<Map>
<entry key="someKey1" value="someValue"/>
<entry key="someKey2">
<value>
<List>
<String>listValue1</String>
<String>listValue2</String>
<String>listValue3</String>
</List>
</value>
</entry>
<entry key="someKey3">
<value>
<Boolean>true</Boolean>
</value>
</entry>
</Map>
</Attributes>
</Custom>
You can create these structures in XML outside of IdentityIQ and import them into the system. Once they are there they can be used by rules, workflows, or even custom code.
Example 1: Getting a Custom object.
Custom custom = context.getObject( Custom.class, "Some Custom Object" );
System.out.println( custom.toXml() );
Example 2: Updating a Custom object.
// See if there is already a custom object, and lock it if there is.
Custom custom = (Custom) ObjectUtil.lockObject(
context, // SailPointContext
Custom.class, // Object Class - Custom.class in our case
null, // The object ID in String form
"Some Custom Object", // The object Name in String form
PersistenceManager.LOCK_TYPE_TRANSACTION // The type of lock we want - either persistent or transaction.
);
// There was not a Custom object already in the database, let's create a new one.
if ( custom == null ) {
custom = new Custom();
custom.setName( "Some Custom Object" );
}
// Now add some attributes:
custom.put( "someKey1", "someValue" );
custom.put( "someKey2", Arrays.asList( new String[] {"listValue1", "listValue2", "listValue3"} ) );
custom.put( "someKey3", true );
// Do more stuff...
// Save it and commit it.
context.saveObject( custom );
context.commitTransaction();
System.out.println( custom.toXml() );
Thats it! Enjoy your new found flexibility with the custom object!
Note: Keep in mind that these are objects stored in the database. Most times when you look up or edit these objects will result in additional call(s) to the database. Use your best judgement when to utilize these API calls to avoid any potential self-inflicted performance issues.
What is maximum lines that a custom object can hold? We see issues in opening custom objects to edit through Debug.