当前位置: 首页>>代码示例>>Java>>正文


Java IBundleProvider.getResources方法代码示例

本文整理汇总了Java中ca.uhn.fhir.rest.api.server.IBundleProvider.getResources方法的典型用法代码示例。如果您正苦于以下问题:Java IBundleProvider.getResources方法的具体用法?Java IBundleProvider.getResources怎么用?Java IBundleProvider.getResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca.uhn.fhir.rest.api.server.IBundleProvider的用法示例。


在下文中一共展示了IBundleProvider.getResources方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluatePatientListMeasure

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
private MeasureReport evaluatePatientListMeasure(Measure measure, String practitioner) {
        SearchParameterMap map = new SearchParameterMap();
        map.add("general-practitioner", new ReferenceParam(practitioner));
        IBundleProvider patientProvider = ((PatientResourceProvider) provider.resolveResourceProvider("Patient")).getDao().search(map);
        List<IBaseResource> patientList = patientProvider.getResources(0, patientProvider.size());

        if (patientList.isEmpty()) {
            throw new IllegalArgumentException("No patients were found with practitioner reference " + practitioner);
        }

        List<Patient> patients = new ArrayList<>();
        patientList.forEach(x -> patients.add((Patient) x));

//        context.setContextValue("Population", patients);

        report = evaluator.evaluate(context, measure, patients, measurementPeriod, MeasureReport.MeasureReportType.PATIENTLIST);
        validateReport();
        return report;
    }
 
开发者ID:DBCG,项目名称:cqf-ruler,代码行数:20,代码来源:FHIRMeasureResourceProvider.java

示例2: testSearchWithNoResults

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testSearchWithNoResults() {
	Device dev = new Device();
	dev.addIdentifier().setSystem("Foo");
	myDeviceDao.create(dev, mySrd);

	IBundleProvider value = myDeviceDao.search(new SearchParameterMap());
	ourLog.info("Initial size: " + value.size());
	for (IBaseResource next : value.getResources(0, value.size())) {
		ourLog.info("Deleting: {}", next.getIdElement());
		myDeviceDao.delete((IIdType) next.getIdElement(), mySrd);
	}

	value = myDeviceDao.search(new SearchParameterMap());
	if (value.size() > 0) {
		ourLog.info("Found: " + (value.getResources(0, 1).get(0).getIdElement()));
		fail(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(value.getResources(0, 1).get(0)));
	}
	assertEquals(0, value.size().intValue());

	List<IBaseResource> res = value.getResources(0, 0);
	assertTrue(res.isEmpty());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:FhirResourceDaoDstu2SearchNoFtTest.java

示例3: testSynchronousSearchUpTo

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testSynchronousSearchUpTo() {
	SearchParameterMap params = new SearchParameterMap();
	params.setLoadSynchronousUpTo(100);
	params.add("name", new StringParam("ANAME"));

	List<Long> pids = createPidSequence(10, 800);
	when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(pids.iterator());

	pids = createPidSequence(10, 110);
	doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));

	IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
	assertNull(result.getUuid());
	assertEquals(100, result.size().intValue());

	List<IBaseResource> resources = result.getResources(0, 10000);
	assertEquals(100, resources.size());
	assertEquals("10", resources.get(0).getIdElement().getValueAsString());
	assertEquals("109", resources.get(99).getIdElement().getValueAsString());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:22,代码来源:SearchCoordinatorSvcImplTest.java

示例4: testSynchronousSearch

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testSynchronousSearch() {
	SearchParameterMap params = new SearchParameterMap();
	params.setLoadSynchronous(true);
	params.add("name", new StringParam("ANAME"));

	List<Long> pids = createPidSequence(10, 800);
	when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(pids.iterator());

	doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));

	IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
	assertNull(result.getUuid());
	assertEquals(790, result.size().intValue());

	List<IBaseResource> resources = result.getResources(0, 10000);
	assertEquals(790, resources.size());
	assertEquals("10", resources.get(0).getIdElement().getValueAsString());
	assertEquals("799", resources.get(789).getIdElement().getValueAsString());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:SearchCoordinatorSvcImplTest.java

示例5: testReverseIncludes

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testReverseIncludes() {
	String methodName = "testReverseIncludes";
	Organization org = new Organization();
	org.setName("X" + methodName + "X");
	IIdType orgId = myOrganizationDao.create(org, mySrd).getId();

	Patient pat = new Patient();
	pat.addName().addFamily("X" + methodName + "X");
	pat.getManagingOrganization().setReference(orgId.toUnqualifiedVersionless());
	myPatientDao.create(pat, mySrd);

	SearchParameterMap map = new SearchParameterMap();
	map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
	map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
	IBundleProvider resultsP = myOrganizationDao.search(map);
	assertEquals(1, resultsP.size().intValue());

	List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
	assertEquals(2, results.size());
	assertEquals(Organization.class, results.get(0).getClass());
	assertEquals(BundleEntrySearchModeEnum.MATCH, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IResource) results.get(0)));
	assertEquals(Patient.class, results.get(1).getClass());
	assertEquals(BundleEntrySearchModeEnum.INCLUDE, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IResource) results.get(1)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:FhirResourceDaoDstu2Test.java

示例6: testAsyncSearchSmallResultSetSameCoordinator

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testAsyncSearchSmallResultSetSameCoordinator() {
	SearchParameterMap params = new SearchParameterMap();
	params.add("name", new StringParam("ANAME"));

	List<Long> pids = createPidSequence(10, 100);
	SlowIterator<Long> iter = new SlowIterator<Long>(pids.iterator(), 2);
	when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);

	doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));

	IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
	assertNotNull(result.getUuid());
	assertEquals(90, result.size().intValue());

	List<IBaseResource> resources = result.getResources(0, 30);
	assertEquals(30, resources.size());
	assertEquals("10", resources.get(0).getIdElement().getValueAsString());
	assertEquals("39", resources.get(29).getIdElement().getValueAsString());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:22,代码来源:SearchCoordinatorSvcImplTest.java

示例7: testAsyncSearchLargeResultSetSameCoordinator

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testAsyncSearchLargeResultSetSameCoordinator() {
	SearchParameterMap params = new SearchParameterMap();
	params.add("name", new StringParam("ANAME"));

	List<Long> pids = createPidSequence(10, 800);
	SlowIterator<Long> iter = new SlowIterator<Long>(pids.iterator(), 2);
	when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);

	doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));

	IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
	assertNotNull(result.getUuid());
	assertEquals(null, result.size());

	List<IBaseResource> resources;

	resources = result.getResources(0, 30);
	assertEquals(30, resources.size());
	assertEquals("10", resources.get(0).getIdElement().getValueAsString());
	assertEquals("39", resources.get(29).getIdElement().getValueAsString());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:SearchCoordinatorSvcImplTest.java

示例8: testReverseIncludes

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testReverseIncludes() {
	String methodName = "testReverseIncludes";
	Organization org = new Organization();
	org.setName("X" + methodName + "X");
	IIdType orgId = myOrganizationDao.create(org, mySrd).getId();

	Patient pat = new Patient();
	pat.addName().setFamily("X" + methodName + "X");
	pat.getManagingOrganization().setReferenceElement(orgId.toUnqualifiedVersionless());
	myPatientDao.create(pat, mySrd);

	SearchParameterMap map = new SearchParameterMap();
	map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
	map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
	IBundleProvider resultsP = myOrganizationDao.search(map);
	assertEquals(1, resultsP.size().intValue());

	List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
	assertEquals(2, results.size());
	assertEquals(Organization.class, results.get(0).getClass());
	assertEquals(BundleEntrySearchModeEnum.MATCH.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(0)));
	assertEquals(Patient.class, results.get(1).getClass());
	assertEquals(BundleEntrySearchModeEnum.INCLUDE.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(1)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:FhirResourceDaoR4Test.java

示例9: toUnqualifiedVersionlessIds

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
protected List<IIdType> toUnqualifiedVersionlessIds(IBundleProvider theFound) {
	List<IIdType> retVal = new ArrayList<>();
	Integer size = theFound.size();
	StopWatch sw = new StopWatch();
	while (size == null) {
		int timeout = 20000;
		if (sw.getMillis() > timeout) {
			fail("Waited over "+timeout+"ms for search");
		}
		try {
			Thread.sleep(100);
		} catch (InterruptedException theE) {
			//ignore
		}
		size = theFound.size();
	}

	ourLog.info("Found {} results", size);
	List<IBaseResource> resources = theFound.getResources(0, size);
	for (IBaseResource next : resources) {
		retVal.add(next.getIdElement().toUnqualifiedVersionless());
	}
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:BaseJpaTest.java

示例10: evaluatePopulationMeasure

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
private MeasureReport evaluatePopulationMeasure(Measure measure) {
    IBundleProvider patientProvider = ((PatientResourceProvider) provider.resolveResourceProvider("Patient")).getDao().search(new SearchParameterMap());
    List<IBaseResource> population = patientProvider.getResources(0, patientProvider.size());

    if (population.isEmpty()) {
        throw new IllegalArgumentException("No patients were found in the data provider at endpoint " + provider.getEndpoint());
    }

    List<Patient> patients = new ArrayList<>();
    population.forEach(x -> patients.add((Patient) x));

    report = evaluator.evaluate(context, measure, patients, measurementPeriod, MeasureReport.MeasureReportType.SUMMARY);
    validateReport();
    return report;
}
 
开发者ID:DBCG,项目名称:cqf-ruler,代码行数:16,代码来源:FHIRMeasureResourceProvider.java

示例11: extractNames

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
private List<String> extractNames(IBundleProvider theSearch) {
	ArrayList<String> retVal = new ArrayList<String>();
	for (IBaseResource next : theSearch.getResources(0, theSearch.size())) {
		Patient nextPt = (Patient) next;
		retVal.add(nextPt.getName().get(0).getNameAsSingleString());
	}
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:FhirResourceDaoDstu3Test.java

示例12: testHistoryWithDeletedResource

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testHistoryWithDeletedResource() throws Exception {
	String methodName = "testHistoryWithDeletedResource";

	Patient patient = new Patient();
	patient.addName().addFamily(methodName);
	IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();

	myPatientDao.delete(id, mySrd);
	patient.setId(id);
	myPatientDao.update(patient, mySrd);

	IBundleProvider history = myPatientDao.history(id, null, null, mySrd);
	assertEquals(3, history.size().intValue());
	List<IBaseResource> entries = history.getResources(0, 3);
	ourLog.info("" + ResourceMetadataKeyEnum.UPDATED.get((IResource) entries.get(0)));
	ourLog.info("" + ResourceMetadataKeyEnum.UPDATED.get((IResource) entries.get(1)));
	ourLog.info("" + ResourceMetadataKeyEnum.UPDATED.get((IResource) entries.get(2)));

	assertEquals(id.withVersion("3"), entries.get(0).getIdElement());
	assertEquals(id.withVersion("2"), entries.get(1).getIdElement());
	assertEquals(id.withVersion("1"), entries.get(2).getIdElement());

	assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IResource) entries.get(0)));
	assertEquals(BundleEntryTransactionMethodEnum.PUT, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IResource) entries.get(0)));

	assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IResource) entries.get(1)));
	assertEquals(BundleEntryTransactionMethodEnum.DELETE, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IResource) entries.get(1)));

	assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IResource) entries.get(2)));
	assertEquals(BundleEntryTransactionMethodEnum.POST, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IResource) entries.get(2)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:33,代码来源:FhirResourceDaoDstu2Test.java

示例13: testHistoryWithDeletedResource

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
@Test
public void testHistoryWithDeletedResource() {
	String methodName = "testHistoryWithDeletedResource";

	Patient patient = new Patient();
	patient.addName().setFamily(methodName);
	IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();

	myPatientDao.delete(id, mySrd);
	patient.setId(id);
	myPatientDao.update(patient, mySrd);

	IBundleProvider history = myPatientDao.history(id, null, null, mySrd);
	List<IBaseResource> entries = history.getResources(0, 3);
	ourLog.info(entries.get(0).getIdElement() + " - " + entries.get(0).getMeta().getLastUpdated());
	ourLog.info(entries.get(1).getIdElement() + " - " + entries.get(1).getMeta().getLastUpdated());
	ourLog.info(entries.get(2).getIdElement() + " - " + entries.get(2).getMeta().getLastUpdated());
	assertEquals(3, history.size().intValue());

	assertEquals(id.withVersion("3"), entries.get(0).getIdElement());
	assertEquals(id.withVersion("2"), entries.get(1).getIdElement());
	assertEquals(id.withVersion("1"), entries.get(2).getIdElement());

	assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(0)));
	assertEquals(BundleEntryTransactionMethodEnum.PUT.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(0)));

	assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(1)));
	assertEquals(BundleEntryTransactionMethodEnum.DELETE.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(1)));

	assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(2)));
	assertEquals(BundleEntryTransactionMethodEnum.POST.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(2)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:33,代码来源:FhirResourceDaoR4Test.java

示例14: log

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
private String log(IBundleProvider theHistory) {
	StringBuilder b = new StringBuilder(theHistory.size() + " results: ");
	for (IBaseResource next : theHistory.getResources(0, theHistory.size())) {
		b.append("\n ").append(next.getIdElement().toUnqualified().getValue());
	}
	return b.toString();
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:FhirResourceDaoDstu2Test.java

示例15: toBundleR4

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入方法依赖的package包/类
protected org.hl7.fhir.r4.model.Bundle toBundleR4(IBundleProvider theSearch) {
	org.hl7.fhir.r4.model.Bundle bundle = new org.hl7.fhir.r4.model.Bundle();
	for (IBaseResource next : theSearch.getResources(0, theSearch.size())) {
		bundle.addEntry().setResource((org.hl7.fhir.r4.model.Resource) next);
	}
	return bundle;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:BaseJpaTest.java


注:本文中的ca.uhn.fhir.rest.api.server.IBundleProvider.getResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。