Search in sources :

Example 1 with IdentityRoleValidRequestEvent

use of eu.bcvsolutions.idm.core.model.event.IdentityRoleValidRequestEvent in project CzechIdMng by bcvsolutions.

the class IdentityRoleValidRequestTaskExecutor method process.

@Override
public Boolean process() {
    boolean canContinue = true;
    counter = 0L;
    List<IdmIdentityRoleValidRequestDto> list = validRequestService.findAllValid();
    // init count
    if (count == null) {
        count = Long.valueOf(list.size());
    }
    LOG.info("Account management starts for all newly valid roles from now. Count [{}]", count);
    for (IdmIdentityRoleValidRequestDto request : list) {
        try {
            // after success provisioning is request removed from db
            entityEventManager.process(new IdentityRoleValidRequestEvent(IdentityRoleValidRequestEventType.IDENTITY_ROLE_VALID, request));
        } catch (RuntimeException e) {
            // log failed operation
            request.increaseAttempt();
            request.setResult(new OperationResult.Builder(OperationState.NOT_EXECUTED).setCause(e).build());
            this.validRequestService.save(request);
        }
        counter++;
        canContinue = updateState();
        if (!canContinue) {
            break;
        }
    }
    return Boolean.TRUE;
}
Also used : IdentityRoleValidRequestEvent(eu.bcvsolutions.idm.core.model.event.IdentityRoleValidRequestEvent) IdmIdentityRoleValidRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleValidRequestDto)

Aggregations

IdmIdentityRoleValidRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleValidRequestDto)1 IdentityRoleValidRequestEvent (eu.bcvsolutions.idm.core.model.event.IdentityRoleValidRequestEvent)1