Sequence generators

Dear community,

could I ask for an explanation of how Sequence Generators work for numbering logins? My HR feed is connected via a JDBC-managed system to an MS SQL database, which contains users with the same names, and I need to assign numbers to them, ideally starting from number 2. Unfortunately, the documentation doesn’t explain very clearly how to use the UI-based variant, and the Groovy option in the Policy Map doesn’t seem to work for me.

Thank you in advance for any advice.
Jan

Hello Jan,

Before we save a user, we usually have a step to check to see if that identity exists. If it does exist, we can add a value like 2 to that user name and look it up again until we find a value that is unique.

private boolean loginExists(final String login, final String sysId) throws BasicDataServiceException {
        final LoginSearchBean sb = new LoginSearchBean();
        sb.setManagedSysId(sysId);
        sb.setUseElasticSearch(true);
        sb.setLoginMatchToken(new SearchParam(login, MatchType.EXACT));
 
        // Send login search request using RabbitMQ and receive the response
        RabbitMQSender mqSender = (RabbitMQSender) context.getBean(RabbitMQSender.class);
        LoginQueue loginQueue = (LoginQueue) context.getBean(LoginQueue.class);
        final BooleanResponse response = mqSender.sendAndReceive(loginQueue, (OpenIAMAPI) LoginAPI.LoginExists, new BaseSearchServiceRequest<>(sb), BooleanResponse.class);
        if (response.isFailure()) {
            throw new BasicDataServiceException(ResponseCode.INTERNAL_ERROR);
        }
        return response.getValue();
    }

There is a sequence generator object that can also be used, but it will be unique across the entire object.

Thanks,
Ameet

Hi Ameet,
Am I understanding correctly that this is already a native feature, and therefore the number should be added automatically?
Thanks for the clarification.
Jan

Hello Jan,

Sorry for the delay in getting back to you. Your understanding is correct.

Thanks.