use of eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto in project CzechIdMng by bcvsolutions.
the class DefaultTestHelper method assignRoles.
@Override
public IdmRoleRequestDto assignRoles(IdmIdentityContractDto contract, boolean startInNewTransaction, IdmRoleDto... roles) {
IdmRoleRequestDto roleRequest = new IdmRoleRequestDto();
roleRequest.setApplicant(contract.getIdentity());
roleRequest.setRequestedByType(RoleRequestedByType.MANUALLY);
roleRequest.setExecuteImmediately(true);
roleRequest = roleRequestService.save(roleRequest);
//
for (IdmRoleDto role : roles) {
IdmConceptRoleRequestDto conceptRoleRequest = new IdmConceptRoleRequestDto();
conceptRoleRequest.setRoleRequest(roleRequest.getId());
conceptRoleRequest.setIdentityContract(contract.getId());
conceptRoleRequest.setValidFrom(contract.getValidFrom());
conceptRoleRequest.setValidTill(contract.getValidTill());
conceptRoleRequest.setRole(role.getId());
//
conceptRoleRequest.setOperation(ConceptRoleRequestOperation.ADD);
//
conceptRoleRequestService.save(conceptRoleRequest);
}
//
if (startInNewTransaction) {
return roleRequestService.startRequest(roleRequest.getId(), false);
}
return roleRequestService.startRequestInternal(roleRequest.getId(), false);
}
Aggregations