Undid previous re-factoring and fixed a bug introduced in last commit.

This commit is contained in:
ianmarshall 2020-04-13 16:14:38 -04:00
parent af11763dee
commit 0f9bdbd3af
19 changed files with 24 additions and 24 deletions

View File

@ -285,7 +285,8 @@ public abstract class BaseConfig {
public static void configureEntityManagerFactory(LocalContainerEntityManagerFactoryBean theFactory, FhirContext theCtx) { public static void configureEntityManagerFactory(LocalContainerEntityManagerFactoryBean theFactory, FhirContext theCtx) {
theFactory.setJpaDialect(hibernateJpaDialect(theCtx.getLocalizer())); theFactory.setJpaDialect(hibernateJpaDialect(theCtx.getLocalizer()));
theFactory.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity"); // TODO: Looking at moving the lastn entities into jpa.model.entity package.
theFactory.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity", "ca.uhn.fhir.jpa.dao.lastn.entity");
theFactory.setPersistenceProvider(new HibernatePersistenceProvider()); theFactory.setPersistenceProvider(new HibernatePersistenceProvider());
} }

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.dao.data; package ca.uhn.fhir.jpa.dao.data;
import ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity; import ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodeableConceptEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.dao.data; package ca.uhn.fhir.jpa.dao.data;
import ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodingEntity; import ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodingEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.dao.data; package ca.uhn.fhir.jpa.dao.data;
import ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity; import ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedSearchParamLastNEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -44,7 +44,6 @@ import org.hl7.fhir.dstu3.model.Reference;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
@ -93,7 +92,7 @@ public class FhirResourceDaoObservationDstu3 extends BaseHapiFhirResourceDao<Obs
// Update indexes here for LastN operation. // Update indexes here for LastN operation.
Observation observation = (Observation)theResource; Observation observation = (Observation)theResource;
Reference subjectReference = observation.getSubject(); Reference subjectReference = observation.getSubject();
String subjectID = subjectReference.getIdElement().getValue(); String subjectID = subjectReference.getReference();
myObservationLastNIndexPersistDstu3Svc.indexObservation(observation, subjectID); myObservationLastNIndexPersistDstu3Svc.indexObservation(observation, subjectID);
} }

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.lastn;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao;
import ca.uhn.fhir.jpa.model.entity.*; import ca.uhn.fhir.jpa.dao.lastn.entity.*;
import org.hl7.fhir.dstu3.model.CodeableConcept; import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Observation;

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.lastn;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao;
import ca.uhn.fhir.jpa.model.entity.*; import ca.uhn.fhir.jpa.dao.lastn.entity.*;
import org.hl7.fhir.r4.model.CodeableConcept; import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Observation;

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.lastn;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodingSearchParamDao;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao;
import ca.uhn.fhir.jpa.model.entity.*; import ca.uhn.fhir.jpa.dao.lastn.entity.*;
import org.hl7.fhir.r5.model.CodeableConcept; import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding; import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.Observation; import org.hl7.fhir.r5.model.Observation;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.dao.lastn.entity;
import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Field;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.dao.lastn.entity;
import ca.uhn.fhir.jpa.dao.lastn.util.CodeSystemHash; import ca.uhn.fhir.jpa.dao.lastn.util.CodeSystemHash;
import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Analyze;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.dao.lastn.entity;
import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Field;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.dao.lastn.entity;
import ca.uhn.fhir.jpa.dao.lastn.util.CodeSystemHash; import ca.uhn.fhir.jpa.dao.lastn.util.CodeSystemHash;
import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Analyze;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.dao.lastn.entity;
import org.hibernate.search.annotations.*; import org.hibernate.search.annotations.*;

View File

@ -63,7 +63,7 @@ public class FhirResourceDaoObservationR4 extends BaseHapiFhirResourceDao<Observ
// Update indexes here for LastN operation. // Update indexes here for LastN operation.
Observation observation = (Observation)theResource; Observation observation = (Observation)theResource;
Reference subjectReference = observation.getSubject(); Reference subjectReference = observation.getSubject();
String subjectID = subjectReference.getIdElement().getValue(); String subjectID = subjectReference.getReference();
myObservationLastNIndexPersistR4Svc.indexObservation(observation, subjectID); myObservationLastNIndexPersistR4Svc.indexObservation(observation, subjectID);
} }

View File

@ -92,7 +92,7 @@ public class FhirResourceDaoObservationR5 extends BaseHapiFhirResourceDao<Observ
// Update indexes here for LastN operation. // Update indexes here for LastN operation.
Observation observation = (Observation)theResource; Observation observation = (Observation)theResource;
Reference subjectReference = observation.getSubject(); Reference subjectReference = observation.getSubject();
String subjectID = subjectReference.getIdElement().getValue(); String subjectID = subjectReference.getReference();
myObservationLastNIndexPersistR5Svc.indexObservation(observation, subjectID); myObservationLastNIndexPersistR5Svc.indexObservation(observation, subjectID);
} }

View File

@ -38,7 +38,7 @@ public class ElasticsearchBulkIndexSvcImpl {
} }
String observationMapping = "{\n" + String observationMapping = "{\n" +
" \"mappings\" : {\n" + " \"mappings\" : {\n" +
" \"ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity\" : {\n" + " \"ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedSearchParamLastNEntity\" : {\n" +
" \"properties\" : {\n" + " \"properties\" : {\n" +
" \"codeconceptid\" : {\n" + " \"codeconceptid\" : {\n" +
" \"type\" : \"keyword\",\n" + " \"type\" : \"keyword\",\n" +
@ -100,7 +100,7 @@ public class ElasticsearchBulkIndexSvcImpl {
} }
String codeMapping = "{\n" + String codeMapping = "{\n" +
" \"mappings\" : {\n" + " \"mappings\" : {\n" +
" \"ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity\" : {\n" + " \"ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodeableConceptEntity\" : {\n" +
" \"properties\" : {\n" + " \"properties\" : {\n" +
" \"codeable_concept_id\" : {\n" + " \"codeable_concept_id\" : {\n" +
" \"type\" : \"keyword\",\n" + " \"type\" : \"keyword\",\n" +

View File

@ -73,7 +73,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
} }
String observationMapping = "{\n" + String observationMapping = "{\n" +
" \"mappings\" : {\n" + " \"mappings\" : {\n" +
" \"ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity\" : {\n" + " \"ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedSearchParamLastNEntity\" : {\n" +
" \"properties\" : {\n" + " \"properties\" : {\n" +
" \"codeconceptid\" : {\n" + " \"codeconceptid\" : {\n" +
" \"type\" : \"keyword\",\n" + " \"type\" : \"keyword\",\n" +
@ -135,7 +135,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
} }
String codeMapping = "{\n" + String codeMapping = "{\n" +
" \"mappings\" : {\n" + " \"mappings\" : {\n" +
" \"ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity\" : {\n" + " \"ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodeableConceptEntity\" : {\n" +
" \"properties\" : {\n" + " \"properties\" : {\n" +
" \"codeable_concept_id\" : {\n" + " \"codeable_concept_id\" : {\n" +
" \"type\" : \"keyword\",\n" + " \"type\" : \"keyword\",\n" +

View File

@ -4,6 +4,6 @@ public class IndexConstants {
public static final String OBSERVATION_INDEX = "observation_index"; public static final String OBSERVATION_INDEX = "observation_index";
public static final String CODE_INDEX = "code_index"; public static final String CODE_INDEX = "code_index";
public static final String OBSERVATION_DOCUMENT_TYPE = "ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity"; public static final String OBSERVATION_DOCUMENT_TYPE = "ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedSearchParamLastNEntity";
public static final String CODE_DOCUMENT_TYPE = "ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity"; public static final String CODE_DOCUMENT_TYPE = "ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodeableConceptEntity";
} }

View File

@ -2,8 +2,8 @@ package ca.uhn.fhir.jpa.dao.lastn;
import ca.uhn.fhir.jpa.dao.lastn.config.TestObservationIndexSearchConfig; import ca.uhn.fhir.jpa.dao.lastn.config.TestObservationIndexSearchConfig;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedCodeCodeableConceptSearchParamDao;
import ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity; import ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedCodeCodeableConceptEntity;
import ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity; import ca.uhn.fhir.jpa.dao.lastn.entity.ObservationIndexedSearchParamLastNEntity;
import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao; import ca.uhn.fhir.jpa.dao.data.IObservationIndexedSearchParamLastNDao;
import org.hl7.fhir.r4.model.*; import org.hl7.fhir.r4.model.*;
import org.junit.After; import org.junit.After;