use of org.pmiops.workbench.model.CohortAnnotationDefinitionListResponse in project workbench by all-of-us.
the class CohortAnnotationDefinitionController method getCohortAnnotationDefinitions.
@Override
public ResponseEntity<CohortAnnotationDefinitionListResponse> getCohortAnnotationDefinitions(String workspaceNamespace, String workspaceId, Long cohortId) {
// This also enforces registered auth domain.
workspaceService.enforceWorkspaceAccessLevel(workspaceNamespace, workspaceId, WorkspaceAccessLevel.READER);
Cohort cohort = findCohort(cohortId);
// this validates that the user is in the proper workspace
validateMatchingWorkspace(workspaceNamespace, workspaceId, cohort.getWorkspaceId());
List<org.pmiops.workbench.db.model.CohortAnnotationDefinition> dbList = cohortAnnotationDefinitionDao.findByCohortId(cohortId);
CohortAnnotationDefinitionListResponse responseList = new CohortAnnotationDefinitionListResponse();
responseList.setItems(dbList.stream().map(TO_CLIENT_COHORT_ANNOTATION_DEFINITION).collect(Collectors.toList()));
return ResponseEntity.ok(responseList);
}
Aggregations