當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。