Merge branch 'master' into add-mvnw

This commit is contained in:
Ari Ruotsalainen 2019-01-11 18:05:44 +02:00
commit 6b38773f9a
3345 changed files with 1356159 additions and 1238246 deletions

View File

@ -8,10 +8,12 @@ dist: trusty
language: java language: java
jdk: jdk:
- oraclejdk9 - openjdk11
#- oraclejdk9
env: env:
global: global:
- MAVEN_OPTS="-Xmx1024m" - MAVEN_OPTS="-Xmx10244M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"
cache: cache:
directories: directories:
@ -29,4 +31,4 @@ before_script:
script: script:
# - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report # - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
# - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report # - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
- mvn -Dci=true -e -B -P ALLMODULES,REDUCED_JPA_TESTS,ERRORPRONE,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report; - mvn -Dci=true -e -B -P ALLMODULES,REDUCED_JPA_TESTS,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report;

View File

@ -0,0 +1,11 @@
# Unsupported
Most of the projects in this module are no longer supported.
The test in hapi-fhir-jpaserver-cds-example is @Ignored until Chris Schuler is able to make a change to the pom
this module depends on.
## Supported JPA Example:
The supported HAPI-FHIR JPA example is available in the [hapi-fhir-jpaserver-starter](https://github.com/hapifhir/hapi-fhir-jpaserver-starter)
project within the [hapifhir](https://github.com/hapifhir) GitHub Organization.

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -10,11 +10,7 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.*;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.AfterClass; import org.junit.*;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Ignore;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -26,6 +22,8 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
// TODO Remove @Ignore once Chris Schuler has fixed the external jar this project depends on
@Ignore
public class CdsExampleTests { public class CdsExampleTests {
private static IGenericClient ourClient; private static IGenericClient ourClient;
private static FhirContext ourCtx = FhirContext.forDstu3(); private static FhirContext ourCtx = FhirContext.forDstu3();

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -54,7 +54,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
/** /**
* Configure FHIR properties around the the JPA server via this bean * Configure FHIR properties around the the JPA server via this bean
*/ */
@Bean() @Bean
public DaoConfig daoConfig() { public DaoConfig daoConfig() {
return FhirServerConfigCommon.getDaoConfig(); return FhirServerConfigCommon.getDaoConfig();
} }
@ -71,7 +71,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
} }
@Override @Override
@Bean() @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() { public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
return FhirServerConfigCommon.getEntityManagerFactory(env, dataSource(), fhirContextDstu3()); return FhirServerConfigCommon.getEntityManagerFactory(env, dataSource(), fhirContextDstu3());
} }
@ -99,7 +99,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
return interceptor; return interceptor;
} }
@Bean() @Bean
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
return FhirServerConfigCommon.getTransactionManager(entityManagerFactory); return FhirServerConfigCommon.getTransactionManager(entityManagerFactory);
} }

View File

@ -57,7 +57,7 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
* Configure FHIR properties around the the JPA server via this bean * Configure FHIR properties around the the JPA server via this bean
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Bean() @Bean
public DaoConfig daoConfig() { public DaoConfig daoConfig() {
return FhirServerConfigCommon.getDaoConfig(); return FhirServerConfigCommon.getDaoConfig();
} }
@ -74,7 +74,7 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
} }
@Override @Override
@Bean() @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() { public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
return FhirServerConfigCommon.getEntityManagerFactory(env, dataSource(), fhirContextDstu2()); return FhirServerConfigCommon.getEntityManagerFactory(env, dataSource(), fhirContextDstu2());
} }
@ -103,7 +103,7 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
return interceptor; return interceptor;
} }
@Bean() @Bean
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
return FhirServerConfigCommon.getTransactionManager(entityManagerFactory); return FhirServerConfigCommon.getTransactionManager(entityManagerFactory);
} }

View File

@ -1,16 +1,6 @@
package ca.uhn.fhir.jpa.demo; package ca.uhn.fhir.jpa.demo;
import java.util.Collection;
import java.util.List;
import javax.servlet.ServletException;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.DaoConfig;
@ -20,13 +10,20 @@ import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader;
import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.ETagSupportEnum; import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import javax.servlet.ServletException;
import java.util.List;
public class JpaServerDemo extends RestfulServer { public class JpaServerDemo extends RestfulServer {
@ -129,12 +126,10 @@ public class JpaServerDemo extends RestfulServer {
setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class)); setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class));
/* /*
* Load interceptors for the server from Spring (these are defined in FhirServerConfig.java) * Register interceptors for the server based on DaoConfig.getSupportedSubscriptionTypes()
*/ */
Collection<IServerInterceptor> interceptorBeans = myAppCtx.getBeansOfType(IServerInterceptor.class).values(); SubscriptionInterceptorLoader subscriptionInterceptorLoader = myAppCtx.getBean(SubscriptionInterceptorLoader.class);
for (IServerInterceptor interceptor : interceptorBeans) { subscriptionInterceptorLoader.registerInterceptors();
this.registerInterceptor(interceptor);
}
/* /*
* If you are hosting this server at a specific DNS name, the server will try to * If you are hosting this server at a specific DNS name, the server will try to

View File

@ -1,16 +1,6 @@
package ca.uhn.fhir.jpa.demo; package ca.uhn.fhir.jpa.demo;
import java.util.Collection;
import java.util.List;
import javax.servlet.ServletException;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.DaoConfig;
@ -20,13 +10,20 @@ import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader;
import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.ETagSupportEnum; import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import javax.servlet.ServletException;
import java.util.List;
public class JpaServerDemoDstu2 extends RestfulServer { public class JpaServerDemoDstu2 extends RestfulServer {
@ -129,12 +126,10 @@ public class JpaServerDemoDstu2 extends RestfulServer {
setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class)); setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class));
/* /*
* Load interceptors for the server from Spring (these are defined in FhirServerConfig.java) * Register interceptors for the server based on DaoConfig.getSupportedSubscriptionTypes()
*/ */
Collection<IServerInterceptor> interceptorBeans = myAppCtx.getBeansOfType(IServerInterceptor.class).values(); SubscriptionInterceptorLoader subscriptionInterceptorLoader = myAppCtx.getBean(SubscriptionInterceptorLoader.class);
for (IServerInterceptor interceptor : interceptorBeans) { subscriptionInterceptorLoader.registerInterceptors();
this.registerInterceptor(interceptor);
}
/* /*
* If you are hosting this server at a specific DNS name, the server will try to * If you are hosting this server at a specific DNS name, the server will try to

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -37,7 +37,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
/** /**
* Configure FHIR properties around the the JPA server via this bean * Configure FHIR properties around the the JPA server via this bean
*/ */
@Bean() @Bean
public DaoConfig daoConfig() { public DaoConfig daoConfig() {
DaoConfig retVal = new DaoConfig(); DaoConfig retVal = new DaoConfig();
retVal.setSubscriptionEnabled(true); retVal.setSubscriptionEnabled(true);
@ -64,13 +64,11 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
} }
@Override @Override
@Bean() @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() { public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean(); LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
retVal.setPersistenceUnitName("HAPI_PU"); retVal.setPersistenceUnitName("HAPI_PU");
retVal.setDataSource(dataSource()); retVal.setDataSource(dataSource());
retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity");
retVal.setPersistenceProvider(new HibernatePersistenceProvider());
retVal.setJpaProperties(jpaProperties()); retVal.setJpaProperties(jpaProperties());
return retVal; return retVal;
} }
@ -122,7 +120,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
return retVal; return retVal;
} }
@Bean() @Bean
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
JpaTransactionManager retVal = new JpaTransactionManager(); JpaTransactionManager retVal = new JpaTransactionManager();
retVal.setEntityManagerFactory(entityManagerFactory); retVal.setEntityManagerFactory(entityManagerFactory);

View File

@ -1,14 +1,5 @@
package ca.uhn.fhir.jpa.demo; package ca.uhn.fhir.jpa.demo;
import java.util.Collection;
import java.util.List;
import javax.servlet.ServletException;
import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
@ -16,12 +7,18 @@ import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import org.hl7.fhir.dstu3.model.Meta;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import javax.servlet.ServletException;
import java.util.List;
public class JpaServerDemo extends RestfulServer { public class JpaServerDemo extends RestfulServer {
@ -96,12 +93,10 @@ public class JpaServerDemo extends RestfulServer {
setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class)); setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class));
/* /*
* Load interceptors for the server from Spring (these are defined in FhirServerConfig.java) * Register interceptors for the server based on DaoConfig.getSupportedSubscriptionTypes()
*/ */
Collection<IServerInterceptor> interceptorBeans = myAppCtx.getBeansOfType(IServerInterceptor.class).values(); SubscriptionInterceptorLoader subscriptionInterceptorLoader = myAppCtx.getBean(SubscriptionInterceptorLoader.class);
for (IServerInterceptor interceptor : interceptorBeans) { subscriptionInterceptorLoader.registerInterceptors();
this.registerInterceptor(interceptor);
}
/* /*
* If you are hosting this server at a specific DNS name, the server will try to * If you are hosting this server at a specific DNS name, the server will try to

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>hapi-fhir-standalone-overlay-example</artifactId> <artifactId>hapi-fhir-standalone-overlay-example</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -106,7 +106,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId> <artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven_project_info_plugin_version}</version>
<configuration> <configuration>
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>

View File

@ -1,15 +1,11 @@
package example; package example;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.List;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.annotation.ConditionalUrlParam;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.annotation.Update;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -17,6 +13,12 @@ import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.exceptions.AuthenticationException; import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.interceptor.auth.*; import ca.uhn.fhir.rest.server.interceptor.auth.*;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.instance.model.api.IBaseResource;
import java.util.List;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class AuthorizationInterceptors { public class AuthorizationInterceptors {
@ -158,4 +160,47 @@ public class AuthorizationInterceptors {
//END SNIPPET: patchAll //END SNIPPET: patchAll
} }
//START SNIPPET: narrowing
public class MyPatientSearchNarrowingInterceptor extends SearchNarrowingInterceptor {
/**
* This method must be overridden to provide the list of compartments
* and/or resources that the current user should have access to
*/
@Override
protected AuthorizedList buildAuthorizedList(RequestDetails theRequestDetails) {
// Process authorization header - The following is a fake
// implementation. Obviously we'd want something more real
// for a production scenario.
//
// In this basic example we have two hardcoded bearer tokens,
// one which is for a user that has access to one patient, and
// another that has full access.
String authHeader = theRequestDetails.getHeader("Authorization");
if ("Bearer dfw98h38r".equals(authHeader)) {
// This user will have access to two compartments
return new AuthorizedList()
.addCompartment("Patient/123")
.addCompartment("Patient/456");
} else if ("Bearer 39ff939jgg".equals(authHeader)) {
// This user has access to everything
return new AuthorizedList();
} else {
throw new AuthenticationException("Unknown bearer token");
}
}
}
//END SNIPPET: narrowing
} }

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -99,6 +99,10 @@
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId> <artifactId>javax.mail-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.helger</groupId> <groupId>com.helger</groupId>
<artifactId>ph-schematron</artifactId> <artifactId>ph-schematron</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.android;
* #%L * #%L
* HAPI FHIR - Android * HAPI FHIR - Android
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>3.6.0</version> <version>3.7.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -48,6 +48,12 @@
<groupId>com.helger</groupId> <groupId>com.helger</groupId>
<artifactId>ph-schematron</artifactId> <artifactId>ph-schematron</artifactId>
<optional>true</optional> <optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.helger</groupId> <groupId>com.helger</groupId>
@ -183,7 +189,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId> <artifactId>maven-jxr-plugin</artifactId>
<version>${maven_jxr_plugin_version}</version>
<reportSets> <reportSets>
<reportSet> <reportSet>
<id>normal</id> <id>normal</id>

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -9,7 +9,7 @@ import java.lang.reflect.Modifier;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -73,12 +73,12 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseRuntimeElementCompositeDefinition.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseRuntimeElementCompositeDefinition.class);
private Map<String, Integer> forcedOrder = null; private Map<String, Integer> forcedOrder = null;
private List<BaseRuntimeChildDefinition> myChildren = new ArrayList<BaseRuntimeChildDefinition>(); private List<BaseRuntimeChildDefinition> myChildren = new ArrayList<>();
private List<BaseRuntimeChildDefinition> myChildrenAndExtensions; private List<BaseRuntimeChildDefinition> myChildrenAndExtensions;
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinitions; private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinitions;
private FhirContext myContext; private final FhirContext myContext;
private Map<String, BaseRuntimeChildDefinition> myNameToChild = new HashMap<String, BaseRuntimeChildDefinition>(); private Map<String, BaseRuntimeChildDefinition> myNameToChild = new HashMap<>();
private List<ScannedField> myScannedFields = new ArrayList<BaseRuntimeElementCompositeDefinition.ScannedField>(); private List<ScannedField> myScannedFields = new ArrayList<>();
private volatile boolean mySealed; private volatile boolean mySealed;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -92,12 +92,12 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
* We scan classes for annotated fields in the class but also all of its superclasses * We scan classes for annotated fields in the class but also all of its superclasses
*/ */
Class<? extends IBase> current = theImplementingClass; Class<? extends IBase> current = theImplementingClass;
LinkedList<Class<? extends IBase>> classes = new LinkedList<Class<? extends IBase>>(); LinkedList<Class<? extends IBase>> classes = new LinkedList<>();
do { do {
if (forcedOrder == null) { if (forcedOrder == null) {
ChildOrder childOrder = current.getAnnotation(ChildOrder.class); ChildOrder childOrder = current.getAnnotation(ChildOrder.class);
if (childOrder != null) { if (childOrder != null) {
forcedOrder = new HashMap<String, Integer>(); forcedOrder = new HashMap<>();
for (int i = 0; i < childOrder.names().length; i++) { for (int i = 0; i < childOrder.names().length; i++) {
String nextName = childOrder.names()[i]; String nextName = childOrder.names()[i];
if (nextName.endsWith("[x]")) { if (nextName.endsWith("[x]")) {
@ -115,7 +115,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
} }
} while (current != null); } while (current != null);
Set<Field> fields = new HashSet<Field>(); Set<Field> fields = new HashSet<>();
for (Class<? extends IBase> nextClass : classes) { for (Class<? extends IBase> nextClass : classes) {
int fieldIndexInClass = 0; int fieldIndexInClass = 0;
for (Field next : nextClass.getDeclaredFields()) { for (Field next : nextClass.getDeclaredFields()) {
@ -192,9 +192,9 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
} }
private void scanCompositeElementForChildren() { private void scanCompositeElementForChildren() {
Set<String> elementNames = new HashSet<String>(); Set<String> elementNames = new HashSet<>();
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToElementDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>(); TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToElementDef = new TreeMap<>();
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToExtensionDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>(); TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToExtensionDef = new TreeMap<>();
scanCompositeElementForChildren(elementNames, orderToElementDef, orderToExtensionDef); scanCompositeElementForChildren(elementNames, orderToElementDef, orderToExtensionDef);
@ -203,7 +203,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
* Find out how many elements don't match any entry in the list * Find out how many elements don't match any entry in the list
* for forced order. Those elements come first. * for forced order. Those elements come first.
*/ */
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> newOrderToExtensionDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>(); TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> newOrderToExtensionDef = new TreeMap<>();
int unknownCount = 0; int unknownCount = 0;
for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) { for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) {
if (!forcedOrder.containsKey(nextEntry.getElementName())) { if (!forcedOrder.containsKey(nextEntry.getElementName())) {
@ -220,7 +220,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
orderToElementDef = newOrderToExtensionDef; orderToElementDef = newOrderToExtensionDef;
} }
TreeSet<Integer> orders = new TreeSet<Integer>(); TreeSet<Integer> orders = new TreeSet<>();
orders.addAll(orderToElementDef.keySet()); orders.addAll(orderToElementDef.keySet());
orders.addAll(orderToExtensionDef.keySet()); orders.addAll(orderToExtensionDef.keySet());
@ -329,7 +329,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
* Anything that's marked as unknown is given a new ID that is <0 so that it doesn't conflict with any given IDs and can be figured out later * Anything that's marked as unknown is given a new ID that is <0 so that it doesn't conflict with any given IDs and can be figured out later
*/ */
if (order == Child.ORDER_UNKNOWN) { if (order == Child.ORDER_UNKNOWN) {
order = Integer.valueOf(0); order = 0;
while (orderMap.containsKey(order)) { while (orderMap.containsKey(order)) {
order++; order++;
} }
@ -386,7 +386,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
/* /*
* Child is a resource reference * Child is a resource reference
*/ */
List<Class<? extends IBaseResource>> refTypesList = new ArrayList<Class<? extends IBaseResource>>(); List<Class<? extends IBaseResource>> refTypesList = new ArrayList<>();
for (Class<? extends IElement> nextType : childAnnotation.type()) { for (Class<? extends IElement> nextType : childAnnotation.type()) {
if (IBaseReference.class.isAssignableFrom(nextType)) { if (IBaseReference.class.isAssignableFrom(nextType)) {
refTypesList.add(myContext.getVersion().getVersion().isRi() ? IAnyResource.class : IResource.class); refTypesList.add(myContext.getVersion().getVersion().isRi() ? IAnyResource.class : IResource.class);
@ -469,10 +469,10 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
next.sealAndInitialize(theContext, theClassToElementDefinitions); next.sealAndInitialize(theContext, theClassToElementDefinitions);
} }
myNameToChild = new HashMap<String, BaseRuntimeChildDefinition>(); myNameToChild = new HashMap<>();
for (BaseRuntimeChildDefinition next : myChildren) { for (BaseRuntimeChildDefinition next : myChildren) {
if (next instanceof RuntimeChildChoiceDefinition) { if (next instanceof RuntimeChildChoiceDefinition) {
String key = ((RuntimeChildChoiceDefinition) next).getElementName()+"[x]"; String key = next.getElementName()+"[x]";
myNameToChild.put(key, next); myNameToChild.put(key, next);
} }
for (String nextName : next.getValidChildNames()) { for (String nextName : next.getValidChildNames()) {
@ -486,7 +486,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
myChildren = Collections.unmodifiableList(myChildren); myChildren = Collections.unmodifiableList(myChildren);
myNameToChild = Collections.unmodifiableMap(myNameToChild); myNameToChild = Collections.unmodifiableMap(myNameToChild);
List<BaseRuntimeChildDefinition> children = new ArrayList<BaseRuntimeChildDefinition>(); List<BaseRuntimeChildDefinition> children = new ArrayList<>();
children.addAll(myChildren); children.addAll(myChildren);
/* /*
@ -554,11 +554,11 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
private static class ScannedField { private static class ScannedField {
private Child myChildAnnotation; private Child myChildAnnotation;
private List<Class<? extends IBase>> myChoiceTypes = new ArrayList<Class<? extends IBase>>(); private List<Class<? extends IBase>> myChoiceTypes = new ArrayList<>();
private Class<?> myElementType; private Class<?> myElementType;
private Field myField; private Field myField;
private boolean myFirstFieldInNewClass; private boolean myFirstFieldInNewClass;
public ScannedField(Field theField, Class<?> theClass, boolean theFirstFieldInNewClass) { ScannedField(Field theField, Class<?> theClass, boolean theFirstFieldInNewClass) {
myField = theField; myField = theField;
myFirstFieldInNewClass = theFirstFieldInNewClass; myFirstFieldInNewClass = theFirstFieldInNewClass;
@ -575,9 +575,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
myChildAnnotation = childAnnotation; myChildAnnotation = childAnnotation;
myElementType = ModelScanner.determineElementType(theField); myElementType = ModelScanner.determineElementType(theField);
for (Class<? extends IBase> nextChoiceType : childAnnotation.type()) { Collections.addAll(myChoiceTypes, childAnnotation.type());
myChoiceTypes.add(nextChoiceType);
}
} }
public Child getChildAnnotation() { public Child getChildAnnotation() {

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -34,7 +34,7 @@ import java.util.Map.Entry;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -7,7 +7,7 @@ import org.hl7.fhir.instance.model.api.IBaseDatatype;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,17 +19,6 @@ package ca.uhn.fhir.context;
* limitations under the License. * limitations under the License.
* #L% * #L%
*/ */
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.util.*;
import java.util.Map.Entry;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.instance.model.api.*;
import ca.uhn.fhir.context.RuntimeSearchParam.RuntimeSearchParamStatusEnum; import ca.uhn.fhir.context.RuntimeSearchParam.RuntimeSearchParamStatusEnum;
import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.api.*;
@ -38,6 +27,19 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.XhtmlDt; import ca.uhn.fhir.model.primitive.XhtmlDt;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.util.ReflectionUtil; import ca.uhn.fhir.util.ReflectionUtil;
import org.hl7.fhir.instance.model.api.*;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
import static org.apache.commons.lang3.StringUtils.isBlank;
class ModelScanner { class ModelScanner {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class);
@ -67,32 +69,6 @@ class ModelScanner {
init(theExistingDefinitions, toScan); init(theExistingDefinitions, toScan);
} }
static Class<?> determineElementType(Field next) {
Class<?> nextElementType = next.getType();
if (List.class.equals(nextElementType)) {
nextElementType = ReflectionUtil.getGenericCollectionTypeOfField(next);
} else if (Collection.class.isAssignableFrom(nextElementType)) {
throw new ConfigurationException("Field '" + next.getName() + "' in type '" + next.getClass().getCanonicalName() + "' is a Collection - Only java.util.List curently supported");
}
return nextElementType;
}
@SuppressWarnings("unchecked")
static IValueSetEnumBinder<Enum<?>> getBoundCodeBinder(Field theNext) {
Class<?> bound = getGenericCollectionTypeOfCodedField(theNext);
if (bound == null) {
throw new ConfigurationException("Field '" + theNext + "' has no parameter for " + BoundCodeDt.class.getSimpleName() + " to determine enum type");
}
String fieldName = "VALUESET_BINDER";
try {
Field bindingField = bound.getField(fieldName);
return (IValueSetEnumBinder<Enum<?>>) bindingField.get(null);
} catch (Exception e) {
throw new ConfigurationException("Field '" + theNext + "' has type parameter " + bound.getCanonicalName() + " but this class has no valueset binding field (must have a field called " + fieldName + ")", e);
}
}
public Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> getClassToElementDefinitions() { public Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> getClassToElementDefinitions() {
return myClassToElementDefinitions; return myClassToElementDefinitions;
} }
@ -137,11 +113,7 @@ class ModelScanner {
for (Class<? extends IBase> nextClass : typesToScan) { for (Class<? extends IBase> nextClass : typesToScan) {
scan(nextClass); scan(nextClass);
} }
for (Iterator<Class<? extends IBase>> iter = myScanAlso.iterator(); iter.hasNext();) { myScanAlso.removeIf(theClass -> myClassToElementDefinitions.containsKey(theClass));
if (myClassToElementDefinitions.containsKey(iter.next())) {
iter.remove();
}
}
typesToScan.clear(); typesToScan.clear();
typesToScan.addAll(myScanAlso); typesToScan.addAll(myScanAlso);
myScanAlso.clear(); myScanAlso.clear();
@ -177,16 +149,6 @@ class ModelScanner {
return retVal; return retVal;
} }
/**
* There are two implementations of all of the annotations (e.g. {@link Child} since the HL7.org ones will eventually replace the HAPI
* ones. Annotations can't extend each other or implement interfaces or anything like that, so rather than duplicate all of the annotation processing code this method just creates an interface
* Proxy to simulate the HAPI annotations if the HL7.org ones are found instead.
*/
static <T extends Annotation> T pullAnnotation(AnnotatedElement theTarget, Class<T> theAnnotationType) {
T retVal = theTarget.getAnnotation(theAnnotationType);
return retVal;
}
private void scan(Class<? extends IBase> theClass) throws ConfigurationException { private void scan(Class<? extends IBase> theClass) throws ConfigurationException {
BaseRuntimeElementDefinition<?> existingDef = myClassToElementDefinitions.get(theClass); BaseRuntimeElementDefinition<?> existingDef = myClassToElementDefinitions.get(theClass);
if (existingDef != null) { if (existingDef != null) {
@ -246,7 +208,16 @@ class ModelScanner {
throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName()); throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName());
} }
// Just in case someone messes up when upgrading from DSTU2
if (myContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
if (BaseIdentifiableElement.class.isAssignableFrom(theClass)) {
throw new ConfigurationException("@Block class for version " + myContext.getVersion().getVersion().name() + " should not extend " + BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName());
}
}
RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(resourceName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions); RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(resourceName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
blockDef.populateScanAlso(myScanAlso);
myClassToElementDefinitions.put(theClass, blockDef); myClassToElementDefinitions.put(theClass, blockDef);
} }
@ -272,14 +243,6 @@ class ModelScanner {
elementDef.populateScanAlso(myScanAlso); elementDef.populateScanAlso(myScanAlso);
} }
static Class<? extends Enum<?>> determineEnumTypeForBoundField(Field next) {
@SuppressWarnings("unchecked")
Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
return enumType;
}
private String scanPrimitiveDatatype(Class<? extends IPrimitiveType<?>> theClass, DatatypeDef theDatatypeDefinition) { private String scanPrimitiveDatatype(Class<? extends IPrimitiveType<?>> theClass, DatatypeDef theDatatypeDefinition) {
ourLog.debug("Scanning resource class: {}", theClass.getName()); ourLog.debug("Scanning resource class: {}", theClass.getName());
@ -466,6 +429,48 @@ class ModelScanner {
return retVal; return retVal;
} }
static Class<?> determineElementType(Field next) {
Class<?> nextElementType = next.getType();
if (List.class.equals(nextElementType)) {
nextElementType = ReflectionUtil.getGenericCollectionTypeOfField(next);
} else if (Collection.class.isAssignableFrom(nextElementType)) {
throw new ConfigurationException("Field '" + next.getName() + "' in type '" + next.getClass().getCanonicalName() + "' is a Collection - Only java.util.List curently supported");
}
return nextElementType;
}
@SuppressWarnings("unchecked")
static IValueSetEnumBinder<Enum<?>> getBoundCodeBinder(Field theNext) {
Class<?> bound = getGenericCollectionTypeOfCodedField(theNext);
if (bound == null) {
throw new ConfigurationException("Field '" + theNext + "' has no parameter for " + BoundCodeDt.class.getSimpleName() + " to determine enum type");
}
String fieldName = "VALUESET_BINDER";
try {
Field bindingField = bound.getField(fieldName);
return (IValueSetEnumBinder<Enum<?>>) bindingField.get(null);
} catch (Exception e) {
throw new ConfigurationException("Field '" + theNext + "' has type parameter " + bound.getCanonicalName() + " but this class has no valueset binding field (must have a field called " + fieldName + ")", e);
}
}
/**
* There are two implementations of all of the annotations (e.g. {@link Child} since the HL7.org ones will eventually replace the HAPI
* ones. Annotations can't extend each other or implement interfaces or anything like that, so rather than duplicate all of the annotation processing code this method just creates an interface
* Proxy to simulate the HAPI annotations if the HL7.org ones are found instead.
*/
static <T extends Annotation> T pullAnnotation(AnnotatedElement theTarget, Class<T> theAnnotationType) {
T retVal = theTarget.getAnnotation(theAnnotationType);
return retVal;
}
static Class<? extends Enum<?>> determineEnumTypeForBoundField(Field next) {
@SuppressWarnings("unchecked")
Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
return enumType;
}
private static Class<?> getGenericCollectionTypeOfCodedField(Field next) { private static Class<?> getGenericCollectionTypeOfCodedField(Field next) {
Class<?> type; Class<?> type;
ParameterizedType collectionType = (ParameterizedType) next.getGenericType(); ParameterizedType collectionType = (ParameterizedType) next.getGenericType();

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -49,9 +49,8 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
myResourceTypes = theResourceTypes; myResourceTypes = theResourceTypes;
if (theResourceTypes == null || theResourceTypes.isEmpty()) { if (theResourceTypes == null || theResourceTypes.isEmpty()) {
myResourceTypes = new ArrayList<Class<? extends IBaseResource>>(); myResourceTypes = new ArrayList<>();
myResourceTypes.add(IBaseResource.class); myResourceTypes.add(IBaseResource.class);
// throw new ConfigurationException("Field '" + theField.getName() + "' on type '" + theField.getDeclaringClass().getCanonicalName() + "' has no resource types noted");
} }
} }

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -149,9 +149,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
@Override @Override
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>(); Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<>();
myDatatypeToAttributeName = new HashMap<Class<? extends IBase>, String>(); myDatatypeToAttributeName = new HashMap<>();
myDatatypeToDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>(); myDatatypeToDefinition = new HashMap<>();
for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) { for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) {
if (next instanceof IRuntimeDatatypeDefinition) { if (next instanceof IRuntimeDatatypeDefinition) {

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.Map;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -17,7 +17,7 @@ import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import ca.uhn.fhir.context.FhirContext;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.context.support;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.fluentpath;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.fluentpath;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,6 +21,7 @@ package ca.uhn.fhir.fluentpath;
*/ */
import java.util.List; import java.util.List;
import java.util.Optional;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
@ -36,6 +37,15 @@ public interface IFluentPath {
*/ */
<T extends IBase> List<T> evaluate(IBase theInput, String thePath, Class<T> theReturnType); <T extends IBase> List<T> evaluate(IBase theInput, String thePath, Class<T> theReturnType);
/**
* Apply the given FluentPath expression against the given input and return
* the first match (if any)
*
* @param theInput The input object (generally a resource or datatype)
* @param thePath The fluent path expression
* @param theReturnType The type to return (in order to avoid casting)
*/
<T extends IBase> Optional<T> evaluateFirst(IBase theInput, String thePath, Class<T> theReturnType);
} }

View File

@ -13,7 +13,7 @@ import static org.apache.commons.lang3.StringUtils.trim;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import org.hl7.fhir.instance.model.api.ICompositeType;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import org.hl7.fhir.instance.model.api.IBaseDatatype;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import org.hl7.fhir.instance.model.api.IBase;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.io.Serializable;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.io.Serializable;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -8,7 +8,7 @@ import ca.uhn.fhir.context.FhirContext;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,7 +60,7 @@ public interface IQueryParameterType extends Serializable {
public String getValueAsQueryToken(FhirContext theContext); public String getValueAsQueryToken(FhirContext theContext);
/** /**
* This method will return any qualifier that should be appended to the parameter name (e.g ":exact") * This method will return any qualifier that should be appended to the parameter name (e.g ":exact"). Returns null if none are present.
*/ */
public String getQueryParameterQualifier(); public String getQueryParameterQualifier();

View File

@ -6,7 +6,7 @@ import org.hl7.fhir.instance.model.api.IBaseMetaType;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -11,7 +11,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.model.api.annotation;
* #%L * #%L
* HAPI FHIR - Core Library * HAPI FHIR - Core Library
* %% * %%
* Copyright (C) 2014 - 2018 University Health Network * Copyright (C) 2014 - 2019 University Health Network
* %% * %%
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More