Table of Contents

Synchronization - contractual relationship

Identity (contractual) relationship synchronization works according to the same rules as identity synchronization. In this page we will described only extra behavior specific for this synchronization.

What is contractual relationship

They define the link between the identity and the tree structure. In the application, we advance the logic according to which every identity has at least one contractual relationship. Typically one contractual relationship is equals to one contract in company for the identity.

Fields for sync contractual relationship mapping

Guarantees field

List of leaders, directly linked on the contractual relation. Linked leader must exists in IdM. Output from attribute transformation can be:

If some leader will not found. Then will be synchronization item marked as 'warning' (relation will be created/saved). Detail information will be saved in item log:

.........................
Finding guarantee [temslie7].
.........................
Warning! - Identity [temslie7] was not found for [temslie7]!
.........................

Work position field

Define link to some tree node. Generaly define place in organization structure. Output from attribute transformation can be:

If node will not found. Then will be synchronization item marked as 'warning' (relation will be created/saved). Detail information will be saved in item log:

........................
Work position - try find directly by transformed value [Divanoodle]!
........................
Work position - was not not found directly from transformed value [Divanoodle]!
........................
Work position - try find in default tree type [DEFAULT_ORG] with code [Divanoodle]!
........................
Warning - Work position - none node found for code [Divanoodle]!

State field

State of contract. Output from attribute transformation must be enumeration ContractState or String representation for this enumeration.

ContractState have this values:

In some situations can be informations needed to determine result state in more than once source attributes.

For example we can have attribute 'state' with one of values (10,20,30) and second attribute 'disabled' (with value true/false). In this case states '10' and '30' marks that contractual relation is 'excluded', but when attribute 'disabled' will be 'true', then final state of relation must be 'DISABLED'.

In some situations, we need evaluate values form more source attributes.


In this case you can use attribute 'icAttributes' (in attribute transformation from the system). This attribute contains all object attributes from the system.

For resolve situation discrabed above was created transformation script 'compileIdentityRelationState' (included in ACC module):

/**
* Compiles identity-relation state. Returns final state for the relation
* (contract). Uses input value as relation state and value from defined
* disabled attribute (from whole IC attributes ... comes from source system)
* 
* Result for this script can be one value from [DISABLED, EXCLUDED, null].
*/

Logger log = LoggerFactory.getLogger(
		"compile-identity-relation-state-script");
log.info("Start 'Compile identity-relation state' script.");
/**
 * Name of attribute contains disable information (for identity relation) on the
 * target system.
 */
final String disableAttributeName = "disabled";
/**
 * In this states is relation excluded;
 */
final String[] excludeStates = [ "10", "30" ];
/**
 * Define if is relation disabled;
 */
boolean disabled = false;

/**
 * Define state of relation comes from source system (assumes String value) 
 */ 
String stateValue = null;

if(attributeValue != null) {
	if(!(attributeValue instanceof String))
	{
		throw new SynchronizationException(MessageFormat.format(
				"Value [{0}] for identity-relation state must be String, but is [{1}] (System [{2}])", attributeValue,
				value.getClass(), system.getCode()));
	}
	stateValue = (String) attributeValue;
}

if(icAttributes != null){
	for (IcAttribute icAttribute : icAttributes) {
		if (disableAttributeName.equalsIgnoreCase(icAttribute.getName())) {
			Object disableValue = icAttribute.getValue();
			if (disableValue == null) {
				disabled = false;
			} else {
				if (disableValue instanceof Boolean) {
					disabled = (boolean) disableValue;
				} else if (disableValue instanceof String) {
					disabled = Boolean.parseBoolean((String) disableValue);
				}
			}
		}
	}
}

if(disabled){
	// Relation is disabled
	log.info(MessageFormat.format("'Compile identity-relation state' script - relation is disabled (on system [{0}])", system.getCode()));
	return ContractState.DISABLED.name();
}

for(String excludeState:excludeStates){
	if (excludeState.equals(stateValue)) {
		// Relation is excluded
		return ContractState.EXCLUDED.name();
	}
}

// Relation is maybe active (depends on validity relation attributes too).
return null;

Tutorials