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


Java MethodOutcome.getId方法代码示例

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


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

示例1: testUpdateWithClientSuppliedIdWhichDoesntExist

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateWithClientSuppliedIdWhichDoesntExist() {
	deleteToken("Patient", Patient.SP_IDENTIFIER, "urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExist");

	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExist");
	MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExist").execute();
	assertEquals(true, outcome.getCreated().booleanValue());
	IdDt p1Id = outcome.getId();

	assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExist/_history"));

	Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExist")).encodedJson().prettyPrint().execute();
	assertEquals(1, actual.size());
	assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getId().getIdPart());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:18,代码来源:ResourceProviderDstu1Test.java

示例2: testUpdateWithClientSuppliedIdWhichDoesntExist

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateWithClientSuppliedIdWhichDoesntExist() {
	deleteToken("Patient", Patient.SP_IDENTIFIER, "urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2");

	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2");
	MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute();
	assertEquals(true, outcome.getCreated().booleanValue());
	IdDt p1Id = outcome.getId();

	assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history"));

	Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2")).encodedJson().prettyPrint().execute();
	assertEquals(1, actual.size());
	assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getResource().getId().getIdPart());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:18,代码来源:ResourceProviderDstu2Test.java

示例3: testUpdateWithClientSuppliedIdWhichDoesntExist

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateWithClientSuppliedIdWhichDoesntExist() {
	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2");

	MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute();
	assertEquals(true, outcome.getCreated().booleanValue());
	IdType p1Id = (IdType) outcome.getId();

	assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history"));

	//@formatter:off
	Bundle actual = ourClient
			.search()
			.forResource(Patient.class)
			.where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"))
			.encodedJson()
			.prettyPrint()
			.returnBundle(Bundle.class)
			.execute();
	//@formatter:on

	assertEquals(1, actual.getEntry().size());
	assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());

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

示例4: testUpdateWithClientSuppliedIdWhichDoesntExist

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateWithClientSuppliedIdWhichDoesntExist() {
	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2");

	MethodOutcome outcome = myClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute();
	assertEquals(true, outcome.getCreated().booleanValue());
	IdType p1Id = (IdType) outcome.getId();

	assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history"));

	//@formatter:off
	Bundle actual = myClient
		.search()
		.forResource(Patient.class)
		.where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"))
		.encodedJson()
		.prettyPrint()
		.returnBundle(Bundle.class)
		.execute();
	//@formatter:on

	assertEquals(1, actual.getEntry().size());
	assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());

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

示例5: createServerResources

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
private static void createServerResources(IGenericClient client, Iterable<Object> resources, String dataType){
	for(Object obj : resources){
		IBaseResource resource = (IBaseResource) obj;
	
		//attempt to update existing
		MethodOutcome outcome = client.update()
				.resource(resource)
				.conditional()
				.where(new TokenClientParam("identifier").exactly()
					.systemAndCode("http://mcm.usciitg-prep.org", resource.getIdElement().getIdPart()))
				.execute();

		// This will return Boolean.TRUE if the server responded with an HTTP 201 created,
		// otherwise it will return null.
		Boolean created = outcome.getCreated();
		if(created == null){
			//try creating new
			outcome = client.create()
					.resource(resource)
					.conditional()
					.where(new TokenClientParam("identifier").exactly()
							.systemAndCode("http://mcm.usciitg-prep.org", resource.getIdElement().getIdPart()))
					.execute();	
			created = outcome.getCreated();
		}
					
		IIdType id = (IIdType) outcome.getId();
		System.out.println(dataType + ":" + resource.getIdElement().getValue() + " created:" + created + " ID:" + id.getValue());
	}
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:31,代码来源:UsciitgFhirDataProviderHL7IT.java

示例6: uploadOrganisation

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
private void uploadOrganisation() {
 for (Organization organization : orgs) {
        MethodOutcome outcome = client.update().resource(organization)
                .conditionalByUrl("Organization?identifier=" + organization.getIdentifier().get(0).getSystem() + "%7C" +organization.getIdentifier().get(0).getValue())
                .execute();

        if (outcome.getId() != null ) {
            organization.setId(outcome.getId().getIdPart());
            orgMap.put(organization.getIdentifier().get(0).getValue(), organization);
        }
    }
    orgs.clear();
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:14,代码来源:ODSUploader.java

示例7: uploadLocation

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
private void uploadLocation() {
    for (Location location : locs) {
        MethodOutcome outcome = client.update().resource(location)
                .conditionalByUrl("Location?identifier=" + location.getIdentifier().get(0).getSystem() + "%7C" +location.getIdentifier().get(0).getValue())
                .execute();

        if (outcome.getId() != null ) {
            location.setId(outcome.getId().getIdPart());
        }
    }
    locs.clear();
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:13,代码来源:ODSUploader.java

示例8: step3_create_patient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
public static void step3_create_patient() {
	// Create a patient
	Patient newPatient = new Patient();

	// Populate the patient with fake information
	newPatient
		.addName()
			.setFamily("DevDays2015")
			.addGiven("John")
			.addGiven("Q");
	newPatient
		.addIdentifier()
			.setSystem("http://acme.org/mrn")
			.setValue("1234567");
	newPatient.setGender(Enumerations.AdministrativeGender.MALE);
	newPatient.setBirthDateElement(new DateType("2015-11-18"));

	// Create a client
	FhirContext ctx = FhirContext.forDstu3();
	IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3");

	// Create the resource on the server
	MethodOutcome outcome = client
		.create()
		.resource(newPatient)
		.execute();

	// Log the ID that the server assigned
	IIdType id = outcome.getId();
	System.out.println("Created patient, got ID: " + id);
}
 
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:32,代码来源:TestApplicationHints.java

示例9: testUpdateMaintainsSearchParams

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateMaintainsSearchParams() throws InterruptedException {
	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsAAA");
	p1.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsAAA");
	IdDt p1id = ourPatientDao.create(p1).getId();

	Patient p2 = new Patient();
	p2.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsBBB");
	p2.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsBBB");
	ourPatientDao.create(p2).getId();

	Set<Long> ids = ourPatientDao.searchForIds(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsAAA"));
	assertEquals(1, ids.size());
	assertThat(ids, contains(p1id.getIdPartAsLong()));

	// Update the name
	p1.getNameFirstRep().getGivenFirstRep().setValue("testUpdateMaintainsSearchParamsBBB");
	MethodOutcome update2 = ourPatientDao.update(p1);
	IdDt p1id2 = update2.getId();

	ids = ourPatientDao.searchForIds(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsAAA"));
	assertEquals(0, ids.size());

	ids = ourPatientDao.searchForIds(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsBBB"));
	assertEquals(2, ids.size());

	// Make sure vreads work
	p1 = ourPatientDao.read(p1id);
	assertEquals("testUpdateMaintainsSearchParamsAAA", p1.getNameFirstRep().getGivenAsSingleString());

	p1 = ourPatientDao.read(p1id2);
	assertEquals("testUpdateMaintainsSearchParamsBBB", p1.getNameFirstRep().getGivenAsSingleString());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:36,代码来源:FhirResourceDaoDstu2Test.java

示例10: addParametersForServerRequest

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Override
protected void addParametersForServerRequest(RequestDetails theRequest, Object[] theParams) {
	/*
	 * We are being a bit lenient here, since technically the client is supposed to include the version in the
	 * Content-Location header, but we allow it in the PUT URL as well..
	 */
	String locationHeader = theRequest.getHeader(Constants.HEADER_CONTENT_LOCATION);
	IIdType id = theRequest.getId();
	if (isNotBlank(locationHeader)) {
		id.setValue(locationHeader);
		if (isNotBlank(id.getResourceType())) {
			if (!getResourceName().equals(id.getResourceType())) {
				throw new InvalidRequestException(
						"Attempting to update '" + getResourceName() + "' but content-location header specifies different resource type '" + id.getResourceType() + "' - header value: " + locationHeader);
			}
		}
	}

	id = applyETagAsVersion(theRequest, id);

	if (theRequest.getId() != null && theRequest.getId().hasVersionIdPart() == false) {
		if (id != null && id.hasVersionIdPart()) {
			theRequest.getId().setValue(id.getValue());
		}
	}

	if (isNotBlank(locationHeader)) {
		MethodOutcome mo = new MethodOutcome();
		parseContentLocation(getContext(), mo, locationHeader);
		if (mo.getId() == null || mo.getId().isEmpty()) {
			throw new InvalidRequestException("Invalid Content-Location header for resource " + getResourceName() + ": " + locationHeader);
		}
	}

	super.addParametersForServerRequest(theRequest, theParams);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:37,代码来源:UpdateMethodBinding.java

示例11: testUpdateMaintainsSearchParams

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateMaintainsSearchParams() {
	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2AAA");
	p1.addName().setFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2AAA");
	IIdType p1id = myPatientDao.create(p1, mySrd).getId();

	Patient p2 = new Patient();
	p2.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2BBB");
	p2.addName().setFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2BBB");
	myPatientDao.create(p2, mySrd).getId();

	Set<Long> ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringParam("testUpdateMaintainsSearchParamsDstu2AAA")));
	assertEquals(1, ids.size());
	assertThat(ids, contains(p1id.getIdPartAsLong()));

	// Update the name
	p1.getName().get(0).getGiven().get(0).setValue("testUpdateMaintainsSearchParamsDstu2BBB");
	MethodOutcome update2 = myPatientDao.update(p1, mySrd);
	IIdType p1id2 = update2.getId();

	ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringParam("testUpdateMaintainsSearchParamsDstu2AAA")));
	assertEquals(0, ids.size());

	ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringParam("testUpdateMaintainsSearchParamsDstu2BBB")));
	assertEquals(2, ids.size());

	// Make sure vreads work
	p1 = myPatientDao.read(p1id, mySrd);
	assertEquals("testUpdateMaintainsSearchParamsDstu2AAA", p1.getName().get(0).getGivenAsSingleString());

	p1 = myPatientDao.read(p1id2, mySrd);
	assertEquals("testUpdateMaintainsSearchParamsDstu2BBB", p1.getName().get(0).getGivenAsSingleString());

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

示例12: testUpdateMaintainsSearchParams

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
@Test
public void testUpdateMaintainsSearchParams() {
	Patient p1 = new Patient();
	p1.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2AAA");
	p1.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2AAA");
	IIdType p1id = myPatientDao.create(p1, mySrd).getId();

	Patient p2 = new Patient();
	p2.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2BBB");
	p2.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2BBB");
	myPatientDao.create(p2, mySrd);

	Set<Long> ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsDstu2AAA")));
	assertEquals(1, ids.size());
	assertThat(ids, contains(p1id.getIdPartAsLong()));

	// Update the name
	p1.getNameFirstRep().getGivenFirstRep().setValue("testUpdateMaintainsSearchParamsDstu2BBB");
	MethodOutcome update2 = myPatientDao.update(p1, mySrd);
	IIdType p1id2 = update2.getId();

	ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsDstu2AAA")));
	assertEquals(0, ids.size());

	ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsDstu2BBB")));
	assertEquals(2, ids.size());

	// Make sure vreads work
	p1 = myPatientDao.read(p1id, mySrd);
	assertEquals("testUpdateMaintainsSearchParamsDstu2AAA", p1.getNameFirstRep().getGivenAsSingleString());

	p1 = myPatientDao.read(p1id2, mySrd);
	assertEquals("testUpdateMaintainsSearchParamsDstu2BBB", p1.getNameFirstRep().getGivenAsSingleString());

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

示例13: addContentLocationHeaders

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
private void addContentLocationHeaders(Request theRequest, HttpServletResponse servletResponse, MethodOutcome response) {
	if (response != null && response.getId() != null) {
		addLocationHeader(theRequest, servletResponse, response, Constants.HEADER_LOCATION);
		addLocationHeader(theRequest, servletResponse, response, Constants.HEADER_CONTENT_LOCATION);
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:7,代码来源:BaseOutcomeReturningMethodBinding.java

示例14: main

import ca.uhn.fhir.rest.api.MethodOutcome; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

		int myPort = 8888;
		String base = "http://localhost:" + myPort + "/base";

		//		new File("target/testdb").mkdirs();
		System.setProperty("fhir.db.location", "./target/testdb");
		System.setProperty("fhir.baseurl", base);
		
		Server server = new Server(myPort);

		WebAppContext root = new WebAppContext();

		root.setContextPath("/");
		root.setDescriptor("target/hapi-fhir-jpaserver/WEB-INF/web.xml");
		root.setResourceBase("target/hapi-fhir-jpaserver");

		root.setParentLoaderPriority(true);

		server.setHandler(root);

		server.start();

		// base = "http://fhir.healthintersections.com.au/open";
		// base = "http://spark.furore.com/fhir";

		if (true) {
			FhirContext ctx = new FhirContext();
			IGenericClient client = ctx.newRestfulGenericClient(base);
//			client.setLogRequestAndResponse(true);

			Organization o1 = new Organization();
			o1.getName().setValue("Some Org");
			MethodOutcome create = client.create(o1);
			IdDt orgId = create.getId();

			Patient p1 = new Patient();
			p1.addIdentifier("foo:bar", "12345");
			p1.addName().addFamily("Smith").addGiven("John");
			p1.getManagingOrganization().setReference(orgId);

			TagList list = new TagList();
			list.addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource");
			ResourceMetadataKeyEnum.TAG_LIST.put(p1, list);
			client.create(p1);

			List<IResource> resources = ctx.newJsonParser().parseBundle(IOUtils.toString(UhnFhirTestApp.class.getResourceAsStream("/test-server-seed-bundle.json"))).toListOfResources();
			client.transaction(resources);

//			for (int i = 0; i < 1000; i++) {
//				
//				Patient p = (Patient) resources.get(0);
//				p.addName().addFamily("Transaction"+i);
//				
//				ourLog.info("Transaction count {}", i);
//				client.transaction(resources);
//			}

			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);
			client.create(p1);

			client.create(p1);

		}

	}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:79,代码来源:UhnFhirTestApp.java


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