Schema script
Connectors continue to be released outside the IDM release. For the latest documentation, refer to the ICF documentation. |
A schema script builds the schema for the connector, either from a static, predefined schema, or by reading the schema from the external resource. The script should use the builder
object to create the schema.
A sample schema script for an SQL database is provided in openidm/samples/scripted-sql-with-mysql/tools/SchemaScript.groovy
.
- Input variables
-
The following variables are available to a sync script:
- configuration
-
A handler to the connector’s configuration object.
- operation
-
An OperationType that corresponds to the action (
SCHEMA
). - builder
-
An instance of the
ICFObjectBuilder
. Theschema()
method should be called with a Closure parameter defining the schema objects.For more information, refer to Using the
builder
Parameter. - log
-
A logger instance for the connector.
- Returns
-
This script has no return value.
Using the builder
parameter
The builder.schema()
must call the delegates objectClass
method and operationOption
method to define the schema.
Call the objectClass()
method for each object type (account, group, and so on) that must be defined. Include the call to the following delegates:
-
type()
- the name for this object type -
attribute()
- define a single attribute for this object type -
attributes()
- define multiple attribute for this object type -
disable()
- list the operations for which this object type is forbidden
The following example defines a simple ACCOUNT object type:
builder.schema({
objectClass {
type ObjectClass.ACCOUNT_NAME
attribute OperationalAttributeInfos.PASSWORD
attribute PredefinedAttributeInfos.DESCRIPTION
attribute 'groups', String.class, EnumSet.of(MULTIVALUED)
attributes {
userName String.class, REQUIRED
email REQUIRED, MULTIVALUED
__ENABLE__ Boolean.class
createDate NOT_CREATABLE, NOT_UPDATEABLE
lastModified Long.class, NOT_CREATABLE, NOT_UPDATEABLE, NOT_RETURNED_BY_DEFAULT
passwordHistory String.class, MULTIVALUED, NOT_UPDATEABLE, NOT_READABLE, NOT_RETURNED_BY_DEFAULT
firstName()
sn()
}
}
}