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


Java OperationOutcome类代码示例

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


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

示例1: deleteDiagnosticReportBySpecimen

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteDiagnosticReportBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticReport")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticReport.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例2: deleteObservationBySpecimen

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteObservationBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("Observation")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(Observation.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例3: deleteDiagnosticOrderBySpecimen

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteDiagnosticOrderBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticOrder")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticOrder.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例4: deletePractitioner

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deletePractitioner(FhirContext oContext,List<IdDt> listIdsPractitioner, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsPractitioner)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java

示例5: deleteSpecimen

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteSpecimen(FhirContext oContext,List<IdDt> listIdsSpecimen, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsSpecimen)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java

示例6: deleteBundle

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteBundle(FhirContext oContext, IdDt idBundle, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete().resourceById(idBundle)
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:21,代码来源:FhirResourceValidator.java

示例7: validatePatient

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的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

示例8: testSchemaBundleValidatorFails

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Test
public void testSchemaBundleValidatorFails() throws IOException {
	String res = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("bundle-example.json"));
	Bundle b = ourCtx.newJsonParser().parseBundle(res);

	FhirValidator val = createFhirValidator();

	ValidationResult validationResult = val.validateWithResult(b);
	assertTrue(validationResult.isSuccessful());

	MedicationPrescription p = (MedicationPrescription) b.getEntries().get(0).getResource();
	TimingDt timing = new TimingDt();
	timing.getRepeat().setDuration(123);
	timing.getRepeat().setDurationUnits((UnitsOfTimeEnum)null);
	p.getDosageInstructionFirstRep().setScheduled(timing);
	
	validationResult = val.validateWithResult(b);
	assertFalse(validationResult.isSuccessful());
	OperationOutcome operationOutcome = (OperationOutcome) validationResult.getOperationOutcome();
	String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(operationOutcome);
	ourLog.info(encoded);
	assertThat(encoded, containsString("if there's a duration, there needs to be"));
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:ResourceValidatorDstu2Test.java

示例9: testSchemaBundleValidatorIsSuccessful

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Test
public void testSchemaBundleValidatorIsSuccessful() throws IOException {
	String res = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("bundle-example.json"));
	Bundle b = ourCtx.newJsonParser().parseBundle(res);

	ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b));
	
	FhirValidator val = createFhirValidator();

	ValidationResult result = val.validateWithResult(b);

	OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
	
	assertTrue(result.toString(), result.isSuccessful());
	assertNotNull(operationOutcome);
	assertEquals(0, operationOutcome.getIssue().size());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:18,代码来源:ResourceValidatorDstu2Test.java

示例10: testSchematronResourceValidator

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Test
public void testSchematronResourceValidator() throws IOException {
	String res = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("patient-example-dicom.json"));
	Patient p = ourCtx.newJsonParser().parseResource(Patient.class, res);

	FhirValidator val = ourCtx.newValidator();
	val.setValidateAgainstStandardSchema(false);
	val.setValidateAgainstStandardSchematron(true);

	ValidationResult validationResult = val.validateWithResult(p);
	assertTrue(validationResult.isSuccessful());

	p.getTelecomFirstRep().setValue("123-4567");
	validationResult = val.validateWithResult(p);
	assertFalse(validationResult.isSuccessful());
	OperationOutcome operationOutcome = (OperationOutcome) validationResult.getOperationOutcome();
	ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(operationOutcome));
	assertEquals(1, operationOutcome.getIssue().size());
	assertThat(operationOutcome.getIssueFirstRep().getDetails(), containsString("A system is required if a value is provided."));

	p.getTelecomFirstRep().setSystem(ContactPointSystemEnum.EMAIL);
	validationResult = val.validateWithResult(p);
	assertTrue(validationResult.isSuccessful());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ResourceValidatorDstu2Test.java

示例11: transaction

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Transaction
public Bundle transaction(@TransactionParam Bundle theResources) {
	Bundle retVal = new Bundle();

	if (ourReturnOperationOutcome) {
		OperationOutcome oo = new OperationOutcome();
		oo.addIssue().setDetails("AAAAA");
		retVal.addEntry().setResource(oo);
	}

	int index = 1;
	for (Entry nextEntry : theResources.getEntry()) {
		String newId = "8" + Integer.toString(index);
		if (nextEntry.getTransaction().getMethodElement().getValueAsEnum() == HTTPVerbEnum.DELETE) {
			newId = new IdDt(nextEntry.getTransaction().getUrlElement()).getIdPart();
		}
		IdDt newIdDt = (new IdDt("Patient", newId, "9" + Integer.toString(index)));
		retVal.addEntry().getTransactionResponse().setLocation(newIdDt.getValue());
		index++;
	}

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

示例12: testTransactionFromBundle

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Test
public void testTransactionFromBundle() throws Exception {

	InputStream bundleRes = SystemProviderTest.class.getResourceAsStream("/transaction_link_patient_eve.xml");
	String bundleStr = IOUtils.toString(bundleRes);
	Bundle bundle = ourFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr);
	
	Bundle resp = ourSystemDao.transaction(bundle);
	
	ourLog.info(ourFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp));
	
	OperationOutcome oo = (OperationOutcome) resp.getEntry().get(0).getResource();
	assertThat(oo.getIssue().get(0).getDetailsElement().getValue(), containsString("Transaction completed"));
	
	assertThat(resp.getEntry().get(1).getTransactionResponse().getLocation(), startsWith("Patient/a555-44-4444/_history/"));
	assertThat(resp.getEntry().get(2).getTransactionResponse().getLocation(), startsWith("Patient/temp6789/_history/"));
	assertThat(resp.getEntry().get(3).getTransactionResponse().getLocation(), startsWith("Organization/GHH/_history/"));
	
	Patient p = ourPatientDao.read(new IdDt("Patient/a555-44-4444/_history/1"));
	assertEquals("Patient/temp6789", p.getLink().get(0).getOther().getReference().getValue());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:FhirSystemDaoDstu2Test.java

示例13: deleteListResourceSpecimen

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
public static void deleteListResourceSpecimen(FhirContext oContext,List<String> listIdsSpecimen, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(String idToDelete:listIdsSpecimen)
        {
            //First search for List resource that refers to the specimen
            ca.uhn.fhir.model.api.Bundle oBundle = client.search().forResource(ListResource.class)
                    .where(new StringClientParam("item").matches().value(idToDelete))
                    .execute();

            List<ListResource> listExtractedResource= FhirResourceValidator.extractListResourceFromApiBundleObject(oBundle,oContext,serverUrl);
            for(ListResource oListResource:listExtractedResource)
            {
                IBaseOperationOutcome resp=client.delete()
                        .resourceById(oListResource.getId())
                        .execute();
                if(resp!=null)
                {
                    OperationOutcome outcome = (OperationOutcome) resp;
                    System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
                }
            }

        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:36,代码来源:FhirResourceValidator.java

示例14: read

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Read
public Patient read(@IdParam IdDt theId) {
   if (databaseIsDown) {
      OperationOutcome oo = new OperationOutcome();
      oo.addIssue().setSeverity(IssueSeverityEnum.FATAL).setDetails("Database is down");
      throw new InternalErrorException("Database is down", oo);
   }
   
   Patient patient = new Patient(); // populate this
   return patient;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:12,代码来源:ServerExceptionsExample.java

示例15: createPatient

import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; //导入依赖的package包/类
@Create
public MethodOutcome createPatient(@ResourceParam Patient thePatient) {

  /* 
   * First we might want to do business 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");
  }
	
  // Save this patient to the database...
  savePatientToDatabase(thePatient);

  // This method returns a MethodOutcome object which contains
  // the ID (composed of the type Patient, the logical ID 3746, and the
  // version ID 1)
  MethodOutcome retVal = new MethodOutcome();
  retVal.setId(new IdDt("Patient", "3746", "1"));
  
  // You can also add an OperationOutcome resource to return
  // This part is optional though:
  OperationOutcome outcome = new OperationOutcome();
  outcome.addIssue().setDetails("One minor issue detected");
  retVal.setOperationOutcome(outcome);  
  
  return retVal;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:34,代码来源:RestfulPatientResourceProviderMore.java


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