getParticipantRoleName method

String getParticipantRoleName(
  1. String? roleName
)

Resolve role name of a participant.

Returns roleName if not null. Otherwise returns the role name specified in the service's deployment, if available. Throws an error if the role name cannot be resolved.

Implementation

String getParticipantRoleName(String? roleName) {
  if (roleName != null) {
    return roleName;
  } else if (service.study != null &&
      service.study?.participantRoleName != null) {
    return service.study!.participantRoleName!;
  } else {
    throw CarpServiceException(
        message: 'No participant role name specified for CAWS endpoint.');
  }
}