• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MethodOutcome类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MethodOutcome类属于ca.uhn.fhir.rest.api包,在下文中一共展示了MethodOutcome类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updatePatient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Update
public MethodOutcome updatePatient(HttpServletRequest theRequest, @ResourceParam Patient patient, @IdParam IdType theId,@ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) {

    log.debug("Update Patient Provider called");

    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    Patient newPatient = null;
    try {
        newPatient = patientDao.update(ctx, patient, theId, theConditional);
    } catch (Exception ex) {
        log.error(ex.getMessage());
        method.setId(newPatient.getIdElement());
        method.setResource(newPatient);
    }

    log.debug("called update Patient method");

    return method;
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:24,代码来源:PatientProvider.java


示例2: createPatient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Create
public MethodOutcome createPatient(HttpServletRequest theRequest, @ResourceParam Patient patient) {

    log.debug("Update Patient Provider called");

    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    Patient newPatient = null;
    try {
        newPatient = patientDao.update(ctx, patient, null,null);
        method.setId(newPatient.getIdElement());
        method.setResource(newPatient);
    } catch (Exception ex) {
        log.error(ex.getMessage());
    }

    log.debug("called create Patient method");

    return method;
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:24,代码来源:PatientProvider.java


示例3: updatePatient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
/**
 * The "@Update" annotation indicates that this method supports replacing an existing 
 * resource (by ID) with a new instance of that resource.
 * 
 * @param theId
 *            This is the ID of the patient to update
 * @param thePatient
 *            This is the actual resource to save
 * @return This method returns a "MethodOutcome"
 */
@Update()
public MethodOutcome updatePatient(@IdParam IdType theId, @ResourceParam Patient thePatient) {
	validateResource(thePatient);

	Long id;
	try {
		id = theId.getIdPartAsLong();
	} catch (DataFormatException e) {
		throw new InvalidRequestException("Invalid ID " + theId.getValue() + " - Must be numeric");
	}

	/*
	 * Throw an exception (HTTP 404) if the ID is not known
	 */
	if (!myIdToPatientVersions.containsKey(id)) {
		throw new ResourceNotFoundException(theId);
	}

	addNewVersion(thePatient, id);

	return new MethodOutcome();
}
 
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:33,代码来源:PatientResourceProvider.java


示例4: main

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

      Patient pat = new Patient();
      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
      pat.setGender(AdministrativeGender.MALE);

      // Create a context
      FhirContext ctx = FhirContext.forDstu3();

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

      // Use the client to store a new resource instance
      MethodOutcome outcome = client
         .create()
         .resource(pat)
         .execute();

      // Print the ID of the newly created resource
      System.out.println(outcome.getId());
   }
 
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:24,代码来源:Example06_ClientCreate.java


示例5: main

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

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

      // Register some interceptors
      client.registerInterceptor(new CookieInterceptor("mycookie=Chips Ahoy"));
      client.registerInterceptor(new LoggingInterceptor());

      // Read a Patient
      Patient patient = client.read().resource(Patient.class).withId("example").execute();

		// Change the gender
		patient.setGender(patient.getGender() == AdministrativeGender.MALE ? AdministrativeGender.FEMALE : AdministrativeGender.MALE);

		// Update the patient
		MethodOutcome outcome = client.update().resource(patient).execute();
		
		System.out.println("Now have ID: " + outcome.getId());
	}
 
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:21,代码来源:Example09_Interceptors.java


示例6: createPatientConditional

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Create
public MethodOutcome createPatientConditional(
      @ResourceParam Patient thePatient,
      @ConditionalUrlParam String theConditionalUrl) {

   if (theConditionalUrl != null) {
      // We are doing a conditional create

      // populate this with the ID of the existing resource which 
      // matches the conditional URL
      return new MethodOutcome();  
   } else {
      // We are doing a normal create
      
      // populate this with the ID of the newly created resource
      return new MethodOutcome();  
   }
   
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:20,代码来源:RestfulPatientResourceProviderMore.java


示例7: updatePatientConditional

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Update
public MethodOutcome updatePatientConditional(
      @ResourceParam Patient thePatient, 
      @IdParam IdDt theId, 
      @ConditionalUrlParam String theConditional) {

   // Only one of theId or theConditional will have a value and the other will be null,
   // depending on the URL passed into the server. 
   if (theConditional != null) {
      // Do a conditional update. theConditional will have a value like "Patient?identifier=system%7C00001"
   } else {
      // Do a normal update. theId will have the identity of the resource to update
   }
   
   return new MethodOutcome(); // populate this
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:RestfulPatientResourceProviderMore.java


示例8: validatePatient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Validate
public MethodOutcome validatePatient(@ResourceParam Patient thePatient) {

  // Actually do our validation: The UnprocessableEntityException
  // results in an HTTP 422, which is appropriate for business rule failure
  if (thePatient.getIdentifierFirstRep().isEmpty()) {
    /* It is also possible to pass an OperationOutcome resource
     * to the UnprocessableEntityException if you want to return
     * a custom populated OperationOutcome. Otherwise, a simple one
     * is created using the string supplied below. 
     */
    throw new UnprocessableEntityException("No identifier supplied");
  }
	
  // This method returns a MethodOutcome object
  MethodOutcome retVal = new MethodOutcome();

  // You may also add an OperationOutcome resource to return
  // This part is optional though:
  OperationOutcome outcome = new OperationOutcome();
  outcome.addIssue().setSeverity(IssueSeverityEnum.WARNING).setDetails("One minor issue detected");
  retVal.setOperationOutcome(outcome);  

  return retVal;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:RestfulPatientResourceProviderMore.java


示例9: create

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Override
public MethodOutcome create(IResource theResource) {
	BaseHttpClientInvocation invocation = MethodUtil.createCreateInvocation(theResource, myContext);
	if (isKeepResponses()) {
		myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding());
	}

	RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
	final String resourceName = def.getName();

	OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);

	MethodOutcome resp = invokeClient(myContext, binding, invocation, myLogRequestAndResponse);
	return resp;

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


示例10: addLocationHeader

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
private void addLocationHeader(Request theRequest, HttpServletResponse theResponse, MethodOutcome response, String headerLocation) {
	StringBuilder b = new StringBuilder();
	b.append(theRequest.getFhirServerBase());
	b.append('/');
	b.append(getResourceName());
	b.append('/');
	b.append(response.getId().getIdPart());
	if (response.getId().hasVersionIdPart()) {
		b.append("/" + Constants.PARAM_HISTORY + "/");
		b.append(response.getId().getVersionIdPart());
	} else if (response.getVersionId() != null && response.getVersionId().isEmpty() == false) {
		b.append("/" + Constants.PARAM_HISTORY + "/");
		b.append(response.getVersionId().getValue());
	}
	theResponse.addHeader(headerLocation, b.toString());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:BaseOutcomeReturningMethodBinding.java


示例11: invokeClient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Override
public MethodOutcome invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException, BaseServerResponseException {
	switch (theResponseStatusCode) {
	case Constants.STATUS_HTTP_200_OK:
	case Constants.STATUS_HTTP_201_CREATED:
	case Constants.STATUS_HTTP_204_NO_CONTENT:
		if (myReturnVoid) {
			return null;
		}
		MethodOutcome retVal = MethodUtil.process2xxResponse(getContext(), getResourceName(), theResponseStatusCode, theResponseMimeType, theResponseReader, theHeaders);
		return retVal;
	default:
		throw processNon2xxResponseAndReturnExceptionToThrow(theResponseStatusCode, theResponseMimeType, theResponseReader);
	}

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


示例12: parseContentLocation

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
protected static void parseContentLocation(MethodOutcome theOutcomeToPopulate, String theResourceName, String theLocationHeader) {
	if (StringUtils.isBlank(theLocationHeader)) {
		return;
	}

	theOutcomeToPopulate.setId(new IdDt(theLocationHeader));

	String resourceNamePart = "/" + theResourceName + "/";
	int resourceIndex = theLocationHeader.lastIndexOf(resourceNamePart);
	if (resourceIndex > -1) {
		int idIndexStart = resourceIndex + resourceNamePart.length();
		int idIndexEnd = theLocationHeader.indexOf('/', idIndexStart);
		if (idIndexEnd == -1) {
			// nothing
		} else {
			String versionIdPart = "/_history/";
			int historyIdStart = theLocationHeader.indexOf(versionIdPart, idIndexEnd);
			if (historyIdStart != -1) {
				theOutcomeToPopulate.setVersionId(new IdDt(theLocationHeader.substring(historyIdStart + versionIdPart.length())));
			}
		}
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:BaseOutcomeReturningMethodBinding.java


示例13: testCreateWithResourceResponse

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
/**
 * Some servers (older ones?) return the resourcde you created instead of an OperationOutcome. We just need to ignore it.
 */
@Test
public void testCreateWithResourceResponse() throws Exception {

	Patient patient = new Patient();
	patient.addIdentifier("urn:foo", "123");

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
	when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(ctx.newXmlParser().encodeResourceToString(patient)), Charset.forName("UTF-8")));
	when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));

	ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
	MethodOutcome response = client.createPatient(patient);

	assertEquals(HttpPost.class, capt.getValue().getClass());
	HttpPost post = (HttpPost) capt.getValue();
	assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
	assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
	assertEquals("200", response.getId().getVersionIdPart());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:ClientTest.java


示例14: testDelete

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {

	OperationOutcome oo = new OperationOutcome();
	oo.addIssue().setDetails("Hello");
	String resp = new FhirContext().newXmlParser().encodeResourceToString(oo);

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
	when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(resp), Charset.forName("UTF-8")));

	ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
	MethodOutcome response = client.deletePatient(new IdDt("1234"));

	assertEquals(HttpDelete.class, capt.getValue().getClass());
	assertEquals("http://foo/Patient/1234", capt.getValue().getURI().toString());
	assertEquals("Hello", response.getOperationOutcome().getIssueFirstRep().getDetailsElement().getValue());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ClientTest.java


示例15: testUpdate

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {

	Patient patient = new Patient();
	patient.addIdentifier("urn:foo", "123");

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
	when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
	when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));

	ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
	MethodOutcome response = client.updatePatient(new IdDt("100"), patient);

	assertEquals(HttpPut.class, capt.getValue().getClass());
	HttpPut post = (HttpPut) capt.getValue();
	assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
	assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
	assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
	assertEquals("200", response.getId().getVersionIdPart());
	assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ClientTest.java


示例16: testUpdateWithVersion

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testUpdateWithVersion() throws Exception {

	Patient patient = new Patient();
	patient.addIdentifier("urn:foo", "123");

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
	when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
	when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));

	ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
	MethodOutcome response = client.updatePatient(new IdDt("Patient/100/_history/200"), patient);

	assertEquals(HttpPut.class, capt.getValue().getClass());
	HttpPut post = (HttpPut) capt.getValue();
	assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
	assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
	assertThat(post.getFirstHeader("Content-Location").getValue(), StringEndsWith.endsWith("Patient/100/_history/200"));
	assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
	assertEquals("200", response.getId().getVersionIdPart());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ClientTest.java


示例17: testValidate

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testValidate() throws Exception {

	Patient patient = new Patient();
	patient.addIdentifier("urn:foo", "123");

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
	when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
	when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));

	ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
	MethodOutcome response = client.validatePatient(patient);

	assertEquals(HttpPost.class, capt.getValue().getClass());
	HttpPost post = (HttpPost) capt.getValue();
	assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/_validate"));
	assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
	assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
	assertEquals("200", response.getId().getVersionIdPart());

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


示例18: testCreatePopulatesIsCreated

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testCreatePopulatesIsCreated() throws Exception {

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

	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
	when(myHttpResponse.getAllHeaders()).thenReturn(new Header[]{new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22")});
	when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
	when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));

	IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");

	when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	MethodOutcome resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute();
	assertTrue(resp.getCreated());

	when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
	resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute();
	assertNull(resp.getCreated());

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


示例19: testCreate

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
@Test
public void testCreate() throws Exception {
	Binary res = new Binary();
	res.setContent(new byte[] { 1, 2, 3, 4 });
	res.setContentType("text/plain");
	
	ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
	when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
	when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
	when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML));
	when(httpResponse.getEntity().getContent()).thenReturn(new ByteArrayInputStream(new byte[] {}));

	IClient client = ctx.newRestfulClient(IClient.class, "http://foo");
	MethodOutcome resp = client.create(res);

	assertEquals(HttpPost.class, capt.getValue().getClass());
	HttpPost post = (HttpPost) capt.getValue();
	assertEquals("http://foo/Binary", post.getURI().toString());
	
	assertEquals("text/plain", post.getEntity().getContentType().getValue());
	assertArrayEquals(new byte[] { 1, 2, 3, 4 }, IOUtils.toByteArray(post.getEntity().getContent()));

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


示例20: updatePatient

import ca.uhn.fhir.rest.api.MethodOutcome; //导入依赖的package包/类
/**
 * The "@Update" annotation indicates that this method supports replacing an existing 
 * resource (by ID) with a new instance of that resource.
 * 
 * @param theId
 *            This is the ID of the patient to update
 * @param thePatient
 *            This is the actual resource to save
 * @return This method returns a "MethodOutcome"
 */
@Update()
public MethodOutcome updatePatient(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
	validateResource(thePatient);

	Long id;
	try {
		id = theId.getIdPartAsLong();
	} catch (DataFormatException e) {
		throw new InvalidRequestException("Invalid ID " + theId.getValue() + " - Must be numeric");
	}

	/*
	 * Throw an exception (HTTP 404) if the ID is not known
	 */
	if (!myIdToPatientVersions.containsKey(id)) {
		throw new ResourceNotFoundException(theId);
	}

	addNewVersion(thePatient, id);

	return new MethodOutcome();
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:33,代码来源:PatientResourceProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LogHandlerEvent类代码示例发布时间:2022-05-22
下一篇:
Java Session类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap