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);
}
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);
}
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);
}
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);
}
Aggregations