Search in sources :

Example 1 with CohortAnnotationDefinitionListResponse

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);
}
Also used : CohortAnnotationDefinitionListResponse(org.pmiops.workbench.model.CohortAnnotationDefinitionListResponse) CohortAnnotationDefinition(org.pmiops.workbench.model.CohortAnnotationDefinition) Cohort(org.pmiops.workbench.db.model.Cohort)

Aggregations

Cohort (org.pmiops.workbench.db.model.Cohort)1 CohortAnnotationDefinition (org.pmiops.workbench.model.CohortAnnotationDefinition)1 CohortAnnotationDefinitionListResponse (org.pmiops.workbench.model.CohortAnnotationDefinitionListResponse)1