Java Code Examples for ca.uhn.fhir.context.FhirVersionEnum#R4

The following examples show how to use ca.uhn.fhir.context.FhirVersionEnum#R4 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationContext.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 5 votes vote down vote up
public ApplicationContext() {
  FhirVersionEnum fhirVersion = HapiProperties.getFhirVersion();
  if (fhirVersion == FhirVersionEnum.DSTU2) {
    register(FhirServerConfigDstu2.class, FhirServerConfigCommon.class);
  } else if (fhirVersion == FhirVersionEnum.DSTU3) {
    register(FhirServerConfigDstu3.class, FhirServerConfigCommon.class);
  } else if (fhirVersion == FhirVersionEnum.R4) {
    register(FhirServerConfigR4.class, FhirServerConfigCommon.class);
  } else if (fhirVersion == FhirVersionEnum.R5) {
    register(FhirServerConfigR5.class, FhirServerConfigCommon.class);
  } else {
    throw new IllegalStateException();
  }

  if (HapiProperties.getSubscriptionWebsocketEnabled()) {
    register(WebsocketDispatcherConfig.class);
  }

  if (HapiProperties.getSubscriptionEmailEnabled()
  || HapiProperties.getSubscriptionRestHookEnabled()
  || HapiProperties.getSubscriptionWebsocketEnabled()) {
    register(SubscriptionSubmitterConfig.class);
    register(SubscriptionProcessorConfig.class);
    register(SubscriptionChannelConfig.class);
  }

}
 
Example 2
Source File: ValueSets.java    From bunsen with Apache License 2.0 5 votes vote down vote up
private ValueSets(SparkSession spark,
    Dataset<UrlAndVersion> members,
    Dataset<ValueSet> valueSets,
    Dataset<Value> values) {

  super(spark, FhirVersionEnum.R4, members, valueSets,values, VALUE_SET_ENCODER);
}
 
Example 3
Source File: ConceptMaps.java    From bunsen with Apache License 2.0 5 votes vote down vote up
protected ConceptMaps(SparkSession spark,
    Dataset<UrlAndVersion> members,
    Dataset<ConceptMap> conceptMaps,
    Dataset<Mapping> mappings) {

  super(spark, FhirVersionEnum.R4, members, conceptMaps, mappings, CONCEPT_MAP_ENCODER);
}
 
Example 4
Source File: R4FhirModelResolver.java    From cql_engine with Apache License 2.0 5 votes vote down vote up
private R4FhirModelResolver(FhirContext fhirContext) {
    super(fhirContext);
    this.setPackageName("org.hl7.fhir.r4.model");
    if (fhirContext.getVersion().getVersion() != FhirVersionEnum.R4) {
        throw new IllegalArgumentException("The supplied context is not configured for R4");
    }
}
 
Example 5
Source File: HapiProperties.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public static FhirVersionEnum getFhirVersion() {
    String fhirVersionString = HapiProperties.getProperty(FHIR_VERSION);

    if (fhirVersionString != null && fhirVersionString.length() > 0) {
        return FhirVersionEnum.valueOf(fhirVersionString);
    }

    return FhirVersionEnum.R4;
}
 
Example 6
Source File: BaseResource.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
	return FhirVersionEnum.R4;
}
 
Example 7
Source File: JpaRestfulServerR4.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void initialize() throws ServletException {
    super.initialize();
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

    // Get the spring context from the web container (it's declared in web.xml)
    FhirVersionEnum fhirVersion = FhirVersionEnum.R4;
    setFhirContext(new FhirContext(fhirVersion));
    String serverBase = HapiProperties.getServerAddress();
    if (serverBase != null && !serverBase.isEmpty()) {
        setServerAddressStrategy(new HardcodedServerAddressStrategy(serverBase));
    }

    if (applicationContext == null ) log.info("Context is null");

    AutowireCapableBeanFactory autowireCapableBeanFactory = applicationContext.getAutowireCapableBeanFactory();
    autowireCapableBeanFactory.autowireBean(this);

    List<IResourceProvider> permissionlist = new ArrayList<>();
    Class<?> classType = null;
    try {
        classType = Class.forName("uk.nhs.careconnect.ccri.fhirserver.r4.provider.ObservationDefinitionProvider");
        log.info("class methods " + classType.getMethods()[4].getName() );
    } catch (ClassNotFoundException  e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception ex) {
        log.error(ex.getMessage());
    }

    permissionlist.add((IResourceProvider) applicationContext.getBean(classType));
    setResourceProviders(permissionlist);

    // Replace built in conformance provider (CapabilityStatement)
    setServerConformanceProvider(new CareConnectServerConformanceR4Provider());

    setServerName(HapiProperties.getServerName());
    setServerVersion(HapiProperties.getSoftwareVersion());
    setImplementationDescription(HapiProperties.getSoftwareImplementationDesc());


    ServerInterceptor loggingInterceptor = new ServerInterceptor(log);
    registerInterceptor(loggingInterceptor);




    CorsConfiguration config = new CorsConfiguration();
    config.addAllowedHeader("x-fhir-starter");
    config.addAllowedHeader("Origin");
    config.addAllowedHeader("Accept");
    config.addAllowedHeader("X-Requested-With");
    config.addAllowedHeader("Content-Type");

    config.addAllowedOrigin("*");

    config.addExposedHeader("Location");
    config.addExposedHeader("Content-Location");
    config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));

    // Create the interceptor and register it
    CorsInterceptor interceptor = new CorsInterceptor(config);
    registerInterceptor(interceptor);

    ServerInterceptor gatewayInterceptor = new ServerInterceptor(log);
    if (HapiProperties.getSecurityOauth()) {
        registerInterceptor(new OAuth2Interceptor());  // Add OAuth2 Security Filter
    }
    registerInterceptor(gatewayInterceptor);

    FifoMemoryPagingProvider pp = new FifoMemoryPagingProvider(10);
    pp.setDefaultPageSize(10);
    pp.setMaximumPageSize(100);
    setPagingProvider(pp);

    setDefaultPrettyPrint(true);
    setDefaultResponseEncoding(EncodingEnum.JSON);

    ctx = getFhirContext();


    registerInterceptor( new ResponseHighlighterInterceptor());

    // Remove as believe due to issues on docker ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
}
 
Example 8
Source File: Bundles.java    From bunsen with Apache License 2.0 2 votes vote down vote up
public static Bundles forR4() {

    return new Bundles(FhirVersionEnum.R4);
  }