Search in sources :

Example 1 with CriteriaListResponse

use of org.pmiops.workbench.model.CriteriaListResponse in project workbench by all-of-us.

the class CohortBuilderController method getCriteriaByTypeAndSubtype.

@Override
public ResponseEntity<CriteriaListResponse> getCriteriaByTypeAndSubtype(Long cdrVersionId, String type, String subtype) {
    CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
    final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndSubtypeOrderByNameAsc(type, subtype);
    CriteriaListResponse criteriaResponse = new CriteriaListResponse();
    criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
    return ResponseEntity.ok(criteriaResponse);
}
Also used : Criteria(org.pmiops.workbench.cdr.model.Criteria) ParticipantCriteria(org.pmiops.workbench.cohortbuilder.ParticipantCriteria) CriteriaListResponse(org.pmiops.workbench.model.CriteriaListResponse)

Example 2 with CriteriaListResponse

use of org.pmiops.workbench.model.CriteriaListResponse in project workbench by all-of-us.

the class CohortBuilderControllerMockTest method assertCriteria.

private void assertCriteria(ResponseEntity response, Criteria expectedCriteria) {
    assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    CriteriaListResponse listResponse = (CriteriaListResponse) response.getBody();
    assertThat(listResponse.getItems().get(0)).isEqualTo(expectedCriteria);
}
Also used : CriteriaListResponse(org.pmiops.workbench.model.CriteriaListResponse)

Example 3 with CriteriaListResponse

use of org.pmiops.workbench.model.CriteriaListResponse in project workbench by all-of-us.

the class CohortBuilderController method getCriteriaByTypeAndParentId.

/**
 * This method list any of the criteria trees.
 */
@Override
public ResponseEntity<CriteriaListResponse> getCriteriaByTypeAndParentId(Long cdrVersionId, String type, Long parentId) {
    CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
    final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc(type, parentId);
    CriteriaListResponse criteriaResponse = new CriteriaListResponse();
    criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
    return ResponseEntity.ok(criteriaResponse);
}
Also used : Criteria(org.pmiops.workbench.cdr.model.Criteria) ParticipantCriteria(org.pmiops.workbench.cohortbuilder.ParticipantCriteria) CriteriaListResponse(org.pmiops.workbench.model.CriteriaListResponse)

Example 4 with CriteriaListResponse

use of org.pmiops.workbench.model.CriteriaListResponse in project workbench by all-of-us.

the class CohortBuilderController method getCriteriaTreeQuickSearch.

@Override
public ResponseEntity<CriteriaListResponse> getCriteriaTreeQuickSearch(Long cdrVersionId, String type, String value) {
    CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
    String nameOrCode = value + "*";
    final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndNameOrCode(type, nameOrCode);
    CriteriaListResponse criteriaResponse = new CriteriaListResponse();
    criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
    return ResponseEntity.ok(criteriaResponse);
}
Also used : Criteria(org.pmiops.workbench.cdr.model.Criteria) ParticipantCriteria(org.pmiops.workbench.cohortbuilder.ParticipantCriteria) CriteriaListResponse(org.pmiops.workbench.model.CriteriaListResponse)

Aggregations

CriteriaListResponse (org.pmiops.workbench.model.CriteriaListResponse)4 Criteria (org.pmiops.workbench.cdr.model.Criteria)3 ParticipantCriteria (org.pmiops.workbench.cohortbuilder.ParticipantCriteria)3