/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU3} * * @since 3.0.0 */ public static FhirContext forR4() { return new FhirContext(FhirVersionEnum.R4); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU2} */ public static FhirContext forDstu2() { return new FhirContext(FhirVersionEnum.DSTU2); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2_HL7ORG DSTU2} (using the Reference * Implementation Structures) */ public static FhirContext forDstu2Hl7Org() { return new FhirContext(FhirVersionEnum.DSTU2_HL7ORG); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU2} (2016 May DSTU3 Snapshot) */ public static FhirContext forDstu2_1() { return new FhirContext(FhirVersionEnum.DSTU2_1); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU3} * * @since 1.4 */ public static FhirContext forDstu3() { return new FhirContext(FhirVersionEnum.DSTU3); }
/** * Gets the {@link FhirContext} associated with this server. For efficient processing, resource providers and plain * providers should generally use this context if one is needed, as opposed to * creating their own. */ @Override public FhirContext getFhirContext() { if (myFhirContext == null) { //TODO: Use of a deprecated method should be resolved. myFhirContext = new FhirContext(); } return myFhirContext; }
public FhirContext getContext(FhirVersionEnum theVersion) { Validate.notNull(theVersion, "theVersion must not be null"); synchronized (ourRetrievalContexts) { FhirContext retVal = ourRetrievalContexts.get(theVersion); if (retVal == null) { retVal = new FhirContext(theVersion); ourRetrievalContexts.put(theVersion, retVal); } return retVal; } }
@Bean @ConditionalOnMissingBean public FhirContext fhirContext() { FhirContext fhirContext = new FhirContext(properties.getVersion()); return fhirContext; }
public void fluent() throws DataFormatException { FhirContext ctx = new FhirContext(Patient.class, Observation.class); String encoded; //START SNIPPET: encodeMsgFluent Patient patient = new Patient(); patient.addIdentifier().setSystem("http://example.com/fictitious-mrns").setValue("MRN001"); patient.addName().setUse(NameUseEnum.OFFICIAL).addFamily("Tester").addGiven("John").addGiven("Q"); encoded = ctx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); System.out.println(encoded); //END SNIPPET: encodeMsgFluent }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2_HL7ORG DSTU2} (using the Reference * Implementation Structures) */ public static FhirContext forDstu2Hl7Org() { return new FhirContext(FhirVersionEnum.DSTU2_HL7ORG); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU2} (2016 May DSTU3 Snapshot) */ public static FhirContext forDstu2_1() { return new FhirContext(FhirVersionEnum.DSTU2_1); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU2} */ public static FhirContext forDstu2() { return new FhirContext(FhirVersionEnum.DSTU2); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU3} * * @since 3.0.0 */ public static FhirContext forR4() { return new FhirContext(FhirVersionEnum.R4); }
/** * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU3} * * @since 1.4 */ public static FhirContext forDstu3() { return new FhirContext(FhirVersionEnum.DSTU3); }
public void encodeMsg() throws DataFormatException { FhirContext ctx = new FhirContext(Patient.class, Observation.class);
public FhirContext getContext(FhirVersionEnum theVersion) { Validate.notNull(theVersion, "theVersion must not be null"); synchronized (ourRetrievalContexts) { FhirContext retVal = ourRetrievalContexts.get(theVersion); if (retVal == null) { retVal = new FhirContext(theVersion); ourRetrievalContexts.put(theVersion, retVal); } return retVal; } }
@Override protected void doStart() throws Exception { if (fhirContext == null && fhirVersion != null) { FhirVersionEnum version = FhirVersionEnum.valueOf(fhirVersion); fhirContext = new FhirContext(version); } else if (fhirContext == null) { fhirContext = FhirContext.forDstu3(); } if (ObjectHelper.isNotEmpty(parserOptions)) { fhirContext.setParserOptions(parserOptions); } }
@Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { String fhirVersion = (String) options.get("fhirVersion"); // checkout https://github.com/syndesisio/syndesis/issues/3719 FhirVersionEnum fhirVersionEnum = fhirVersion == null ? FhirVersionEnum.DSTU3 : FhirVersionEnum.valueOf(fhirVersion); this.fhirContext = new FhirContext(fhirVersionEnum); setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(this::afterProducer); }
// Create a client (only needed once) FhirContext ctx = new FhirContext(); IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/base"); // Invoke the client Bundle bundle = client.search() .forResource(Patient.class) .execute(); System.out.println("patients count=" + bundle.size()); List<Patient> list = bundle.getResources(Patient.class); for (Patient p : list) { System.out.println("name=" + p.getName()); }
private static FhirContext getFhirContext(FhirConfiguration endpointConfiguration) { FhirContext context = endpointConfiguration.getFhirContext(); if (context != null) { return context; } if (ObjectHelper.isEmpty(endpointConfiguration.getServerUrl())) { throw new RuntimeCamelException("The FHIR URL must be set!"); } FhirVersionEnum fhirVersion = endpointConfiguration.getFhirVersion(); return new FhirContext(fhirVersion); } }