Table of Contents

Check whether a value is unique in a system

Sometimes it is necessary to generate attributes like username or email which are unique even in a certain system (e. g., MS AD). However, not every user in the system must be in IdM. In some cases, historical accounts still exist or IdM manages only a part of the system. For these reasons, a service which enables you to search a system and check that an attribute value is unique was created.

How to use it

This is a backend-only implementation that can be used in your scripts. The usage is quite simple. The service DefaultExtrasSystemUniquenessValidationService has two methods to check that a value is unique. The only difference is how you specify the system. One expects the object SysSystemDto, the other uses only the ID of the system.

Let's take a look at an example:

boolean unique = defaultExtrasSystemUniquenessValidationService.isValueUnique(systemId, attributeName, value, "EQUALS");

where:

Multivalued attributes are supported as well.

Only connId connectors are supported. In practice, this only means that the service cannot be used for virtual systems.

Comparison types

The following comparison types are supported:

You can either use the comparison type values directly (as seen above) or use the constants in the ExtrasComparison class.