OLMIS-5383 Automatically load reference data demo data
Load test data on demo-data Spring profile. Some notes: * Geographic zones are sorted by level, lower (country) levels first, so that higher levels can refer to them, when saving. * Call to the FHIR service is done in a transaction, so a bunch of resources can be saved at once, instead of saving each one individually. * Zones and facilities are chunked so that the request body that is POSTed to the FHIR service is not too large. * When configuring the FHIR client, the socket timeout has been raised from 10 seconds to 30 seconds, because sometimes the client times out before the FHIR service responds. * An Auth interceptor is used to add an access token to the call.
Some additional things are added in order to get this to work: * FHIR service is now wrapping the request in a transaction, but since the demo data loading is using a transaction as well and HAPI FHIR transactions are set to Propagation never (https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java#L82), this causes an error. The workaround is to check if the HTTP request is a transaction (request body has XML Bundle of type "transaction"). If so, do not try to wrap the request in a transaction. * Since you cannot read the request body without consuming the contents, a custom HttpServletRequestWrapper is added to make a copy of the body. * For some reason, the JTS Point class cannot be deserialized properly, so a custom deserializer is added to do so.