use of eu.bcvsolutions.idm.vs.exception.VsException in project CzechIdMng by bcvsolutions.
the class BasicVirtualConnector method loadImplementers.
/**
* Load implementers by UUIDs in connector configuration. Throw exception when
* identity not found.
*
* @param implementersString
* @return
*/
private List<IdmIdentityDto> loadImplementers(UUID[] implementersUUID) {
List<IdmIdentityDto> implementers = new ArrayList<>();
if (implementersUUID == null) {
return implementers;
}
for (UUID implementer : implementersUUID) {
IdmIdentityDto identity = identityService.get(implementer);
if (identity == null) {
throw new VsException(VsResultCode.VS_IMPLEMENTER_WAS_NOT_FOUND, ImmutableMap.of("implementer", implementer));
}
implementers.add(identity);
}
return implementers;
}
use of eu.bcvsolutions.idm.vs.exception.VsException in project CzechIdMng by bcvsolutions.
the class DefaultVsSystemService method loadImplementerRoles.
/**
* Load implementer roles by UUIDs in connector configuration. If none role are
* set and none direct implementers are set, then will be used default role.
* Throw exception when identity not found.
*
* @param implementerRolesUUID
* @param implementersFromConfig
* @return
*/
private List<IdmRoleDto> loadImplementerRoles(UUID[] implementerRolesUUID, List<IdmIdentityDto> implementersFromConfig) {
if ((implementerRolesUUID == null || implementerRolesUUID.length == 0)) {
List<IdmRoleDto> implementerRoles = new ArrayList<>(1);
if (CollectionUtils.isEmpty(implementersFromConfig)) {
// Load default role from configuration
IdmRoleDto defaultRole = vsConfiguration.getDefaultRole();
if (defaultRole != null) {
implementerRoles.add(defaultRole);
}
}
return implementerRoles;
}
List<IdmRoleDto> implementerRoles = new ArrayList<>(implementerRolesUUID.length);
for (UUID implementer : implementerRolesUUID) {
IdmRoleDto role = roleService.get(implementer);
if (role == null) {
throw new VsException(VsResultCode.VS_IMPLEMENTER_ROLE_WAS_NOT_FOUND, ImmutableMap.of("role", implementer));
}
implementerRoles.add(role);
}
return implementerRoles;
}
Aggregations