mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-17 02:15:22 +00:00
JPA server cleanup and add some tests
This commit is contained in:
parent
b18e71d4f5
commit
0369b7fd70
@ -942,6 +942,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ourLog.info("Encoded {} chars of resource body as {} bytes", encoded.length(), bytes.length);
|
||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
if (theUpdateHash) {
|
if (theUpdateHash) {
|
||||||
@ -963,7 +965,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
|
|
||||||
theEntity.setResource(bytes);
|
theEntity.setResource(bytes);
|
||||||
|
|
||||||
Set<TagDefinition> allDefs = new HashSet<TagDefinition>();
|
Set<TagDefinition> allDefs = new HashSet<>();
|
||||||
|
|
||||||
theEntity.setHasTags(false);
|
theEntity.setHasTags(false);
|
||||||
|
|
||||||
@ -988,7 +990,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ResourceTag> existingTags = new ArrayList<ResourceTag>();
|
ArrayList<ResourceTag> existingTags = new ArrayList<>();
|
||||||
if (theEntity.isHasTags()) {
|
if (theEntity.isHasTags()) {
|
||||||
existingTags.addAll(theEntity.getTags());
|
existingTags.addAll(theEntity.getTags());
|
||||||
}
|
}
|
||||||
@ -1042,8 +1044,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
Collection<? extends BaseTag> tags = theEntity.getTags();
|
Collection<? extends BaseTag> tags = theEntity.getTags();
|
||||||
if (theEntity.isHasTags()) {
|
if (theEntity.isHasTags()) {
|
||||||
TagList tagList = new TagList();
|
TagList tagList = new TagList();
|
||||||
List<IBaseCoding> securityLabels = new ArrayList<IBaseCoding>();
|
List<IBaseCoding> securityLabels = new ArrayList<>();
|
||||||
List<IdDt> profiles = new ArrayList<IdDt>();
|
List<IdDt> profiles = new ArrayList<>();
|
||||||
for (BaseTag next : tags) {
|
for (BaseTag next : tags) {
|
||||||
switch (next.getTag().getTagType()) {
|
switch (next.getTag().getTagType()) {
|
||||||
case PROFILE:
|
case PROFILE:
|
||||||
@ -1171,9 +1173,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
throw new InternalErrorException("No DAO for resource type: " + theResourceType.getName());
|
throw new InternalErrorException("No DAO for resource type: " + theResourceType.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Long> ids = dao.searchForIds(paramMap);
|
return dao.searchForIds(paramMap);
|
||||||
|
|
||||||
return ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
@ -1181,14 +1181,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
throw new NotImplementedException("");
|
throw new NotImplementedException("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntityManager(EntityManager theEntityManager) {
|
|
||||||
myEntityManager = theEntityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatformTransactionManager(PlatformTransactionManager thePlatformTransactionManager) {
|
|
||||||
myPlatformTransactionManager = thePlatformTransactionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpdatedTime(Collection<? extends BaseResourceIndexedSearchParam> theParams, Date theUpdateTime) {
|
private void setUpdatedTime(Collection<? extends BaseResourceIndexedSearchParam> theParams, Date theUpdateTime) {
|
||||||
for (BaseResourceIndexedSearchParam nextSearchParam : theParams) {
|
for (BaseResourceIndexedSearchParam nextSearchParam : theParams) {
|
||||||
nextSearchParam.setUpdated(theUpdateTime);
|
nextSearchParam.setUpdated(theUpdateTime);
|
||||||
@ -1206,7 +1198,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
*
|
*
|
||||||
* @param theEntity The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
* @param theEntity The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
||||||
* @param theTag The tag
|
* @param theTag The tag
|
||||||
* @return Retturns <code>true</code> if the tag should be removed
|
* @return Returns <code>true</code> if the tag should be removed
|
||||||
*/
|
*/
|
||||||
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
||||||
if (theTag.getTag().getTagType() == TagTypeEnum.PROFILE) {
|
if (theTag.getTag().getTagType() == TagTypeEnum.PROFILE) {
|
||||||
@ -1222,14 +1214,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||||||
return toResource(resourceType, theEntity, theForHistoryOperation);
|
return toResource(resourceType, theEntity, theForHistoryOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected ResourceTable toEntity(IResource theResource) {
|
|
||||||
// ResourceTable retVal = new ResourceTable();
|
|
||||||
//
|
|
||||||
// populateResourceIntoEntity(theResource, retVal, true);
|
|
||||||
//
|
|
||||||
// return retVal;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <R extends IBaseResource> R toResource(Class<R> theResourceType, BaseHasResource theEntity, boolean theForHistoryOperation) {
|
public <R extends IBaseResource> R toResource(Class<R> theResourceType, BaseHasResource theEntity, boolean theForHistoryOperation) {
|
||||||
|
@ -1,5 +1,38 @@
|
|||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.ITermConceptDao;
|
||||||
|
import ca.uhn.fhir.jpa.entity.ForcedId;
|
||||||
|
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
||||||
|
import ca.uhn.fhir.jpa.util.ReindexFailureException;
|
||||||
|
import ca.uhn.fhir.jpa.util.StopWatch;
|
||||||
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
|
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||||
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
|
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.TransactionCallback;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
import javax.persistence.Tuple;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
import javax.persistence.criteria.Root;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -21,34 +54,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import javax.persistence.criteria.*;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.transaction.support.TransactionCallback;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.data.*;
|
|
||||||
import ca.uhn.fhir.jpa.entity.ForcedId;
|
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
|
||||||
import ca.uhn.fhir.jpa.util.ReindexFailureException;
|
|
||||||
import ca.uhn.fhir.jpa.util.StopWatch;
|
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
|
||||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
||||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
|
|
||||||
|
|
||||||
public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBaseResource> implements IFhirSystemDao<T, MT> {
|
public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBaseResource> implements IFhirSystemDao<T, MT> {
|
||||||
|
|
||||||
@ -64,32 +69,21 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformTransactionManager myTxManager;
|
private PlatformTransactionManager myTxManager;
|
||||||
|
@Autowired
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
private IResourceTableDao myResourceTableDao;
|
||||||
@Override
|
|
||||||
public void deleteAllTagsOnServer(RequestDetails theRequestDetails) {
|
|
||||||
// Notify interceptors
|
|
||||||
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails);
|
|
||||||
notifyInterceptors(RestOperationTypeEnum.DELETE_TAGS, requestDetails);
|
|
||||||
|
|
||||||
myEntityManager.createQuery("DELETE from ResourceTag t").executeUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int doPerformReindexingPass(final Integer theCount) {
|
private int doPerformReindexingPass(final Integer theCount) {
|
||||||
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
|
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
|
||||||
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
|
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
|
||||||
int retVal = doPerformReindexingPassForResources(theCount, txTemplate);
|
return doPerformReindexingPassForResources(theCount, txTemplate);
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@SuppressWarnings("ConstantConditions")
|
||||||
private IResourceTableDao myResourceTableDao;
|
|
||||||
|
|
||||||
private int doPerformReindexingPassForResources(final Integer theCount, TransactionTemplate txTemplate) {
|
private int doPerformReindexingPassForResources(final Integer theCount, TransactionTemplate txTemplate) {
|
||||||
return txTemplate.execute(new TransactionCallback<Integer>() {
|
return txTemplate.execute(new TransactionCallback<Integer>() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Integer doInTransaction(TransactionStatus theStatus) {
|
public Integer doInTransaction(@Nonnull TransactionStatus theStatus) {
|
||||||
|
|
||||||
int maxResult = 500;
|
int maxResult = 500;
|
||||||
if (theCount != null) {
|
if (theCount != null) {
|
||||||
@ -124,12 +118,11 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
|
|
||||||
final IBaseResource resource = toResource(resourceTable, false);
|
final IBaseResource resource = toResource(resourceTable, false);
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes") final IFhirResourceDao dao = getDao(resource.getClass());
|
||||||
final IFhirResourceDao dao = getDao(resource.getClass());
|
|
||||||
|
|
||||||
dao.reindex(resource, resourceTable);
|
dao.reindex(resource, resourceTable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ourLog.error("Failed to index resource {}: {}", new Object[] { resourceTable.getIdDt(), e.toString(), e });
|
ourLog.error("Failed to index resource {}: {}", new Object[]{resourceTable.getIdDt(), e.toString(), e});
|
||||||
throw new ReindexFailureException(resourceTable.getId());
|
throw new ReindexFailureException(resourceTable.getId());
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
@ -143,7 +136,7 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
long avg;
|
long avg;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
avg = (delay / count);
|
avg = (delay / count);
|
||||||
ourLog.info("Indexed {} resources in {}ms - Avg {}ms / resource", new Object[] { count, delay, avg });
|
ourLog.info("Indexed {} resources in {}ms - Avg {}ms / resource", new Object[]{count, delay, avg});
|
||||||
} else {
|
} else {
|
||||||
ourLog.debug("Indexed 0 resources in {}ms", delay);
|
ourLog.debug("Indexed 0 resources in {}ms", delay);
|
||||||
}
|
}
|
||||||
@ -153,19 +146,7 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
|
||||||
public TagList getAllTags(RequestDetails theRequestDetails) {
|
|
||||||
// Notify interceptors
|
|
||||||
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails);
|
|
||||||
notifyInterceptors(RestOperationTypeEnum.GET_TAGS, requestDetails);
|
|
||||||
|
|
||||||
StopWatch w = new StopWatch();
|
|
||||||
TagList retVal = super.getTags(null, null);
|
|
||||||
ourLog.info("Processed getAllTags in {}ms", w.getMillisAndRestart());
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED, readOnly=true)
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Long> getResourceCounts() {
|
public Map<String, Long> getResourceCounts() {
|
||||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||||
@ -176,7 +157,7 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
|
|
||||||
TypedQuery<Tuple> q = myEntityManager.createQuery(cq);
|
TypedQuery<Tuple> q = myEntityManager.createQuery(cq);
|
||||||
|
|
||||||
Map<String, Long> retVal = new HashMap<String, Long>();
|
Map<String, Long> retVal = new HashMap<>();
|
||||||
for (Tuple next : q.getResultList()) {
|
for (Tuple next : q.getResultList()) {
|
||||||
String resourceName = next.get(0, String.class);
|
String resourceName = next.get(0, String.class);
|
||||||
Long count = next.get(1, Long.class);
|
Long count = next.get(1, Long.class);
|
||||||
@ -185,10 +166,6 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasValue(InstantDt theInstantDt) {
|
|
||||||
return theInstantDt != null && theInstantDt.isEmpty() == false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBundleProvider history(Date theSince, Date theUntil, RequestDetails theRequestDetails) {
|
public IBundleProvider history(Date theSince, Date theUntil, RequestDetails theRequestDetails) {
|
||||||
if (theRequestDetails != null) {
|
if (theRequestDetails != null) {
|
||||||
@ -203,10 +180,6 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ResourceTable loadFirstEntityFromCandidateMatches(Set<Long> candidateMatches) {
|
|
||||||
return myEntityManager.find(ResourceTable.class, candidateMatches.iterator().next());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional()
|
@Transactional()
|
||||||
@Override
|
@Override
|
||||||
public int markAllResourcesForReindexing() {
|
public int markAllResourcesForReindexing() {
|
||||||
@ -226,8 +199,8 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
|
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
|
||||||
txTemplate.execute(new TransactionCallback<Void>() {
|
txTemplate.execute(new TransactionCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void doInTransaction(TransactionStatus theStatus) {
|
public Void doInTransaction(@Nonnull TransactionStatus theStatus) {
|
||||||
ourLog.info("Marking resource with PID {} as indexing_failed", new Object[] { theId });
|
ourLog.info("Marking resource with PID {} as indexing_failed", new Object[]{theId});
|
||||||
Query q = myEntityManager.createQuery("UPDATE ResourceTable t SET t.myIndexStatus = :status WHERE t.myId = :id");
|
Query q = myEntityManager.createQuery("UPDATE ResourceTable t SET t.myIndexStatus = :status WHERE t.myId = :id");
|
||||||
q.setParameter("status", INDEX_STATUS_INDEXING_FAILED);
|
q.setParameter("status", INDEX_STATUS_INDEXING_FAILED);
|
||||||
q.setParameter("id", theId);
|
q.setParameter("id", theId);
|
||||||
@ -295,20 +268,4 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxManager(PlatformTransactionManager theTxManager) {
|
|
||||||
myTxManager = theTxManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ResourceTable tryToLoadEntity(IdDt nextId) {
|
|
||||||
ResourceTable entity;
|
|
||||||
try {
|
|
||||||
Long pid = translateForcedIdToPid(nextId.getResourceType(), nextId.getIdPart());
|
|
||||||
entity = myEntityManager.find(ResourceTable.class, pid);
|
|
||||||
} catch (ResourceNotFoundException e) {
|
|
||||||
entity = null;
|
|
||||||
}
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,6 @@ public class DaoConfig {
|
|||||||
*/
|
*/
|
||||||
private Integer myFetchSizeDefaultMaximum = null;
|
private Integer myFetchSizeDefaultMaximum = null;
|
||||||
private int myHardTagListLimit = 1000;
|
private int myHardTagListLimit = 1000;
|
||||||
private int myIncludeLimit = 2000;
|
|
||||||
/**
|
/**
|
||||||
* update setter javadoc if default changes
|
* update setter javadoc if default changes
|
||||||
*/
|
*/
|
||||||
@ -104,8 +103,8 @@ public class DaoConfig {
|
|||||||
private Long myReuseCachedSearchResultsForMillis = DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS;
|
private Long myReuseCachedSearchResultsForMillis = DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS;
|
||||||
private boolean mySchedulingDisabled;
|
private boolean mySchedulingDisabled;
|
||||||
private boolean mySuppressUpdatesWithNoChange = true;
|
private boolean mySuppressUpdatesWithNoChange = true;
|
||||||
private Set<String> myTreatBaseUrlsAsLocal = new HashSet<String>();
|
private Set<String> myTreatBaseUrlsAsLocal = new HashSet<>();
|
||||||
private Set<String> myTreatReferencesAsLogical = new HashSet<String>(DEFAULT_LOGICAL_BASE_URLS);
|
private Set<String> myTreatReferencesAsLogical = new HashSet<>(DEFAULT_LOGICAL_BASE_URLS);
|
||||||
private boolean myAutoCreatePlaceholderReferenceTargets;
|
private boolean myAutoCreatePlaceholderReferenceTargets;
|
||||||
private Integer myCacheControlNoStoreMaxResultsUpperLimit = 1000;
|
private Integer myCacheControlNoStoreMaxResultsUpperLimit = 1000;
|
||||||
private Integer myCountSearchResultsUpTo = null;
|
private Integer myCountSearchResultsUpTo = null;
|
||||||
@ -129,7 +128,7 @@ public class DaoConfig {
|
|||||||
validateTreatBaseUrlsAsLocal(theTreatReferencesAsLogical);
|
validateTreatBaseUrlsAsLocal(theTreatReferencesAsLogical);
|
||||||
|
|
||||||
if (myTreatReferencesAsLogical == null) {
|
if (myTreatReferencesAsLogical == null) {
|
||||||
myTreatReferencesAsLogical = new HashSet<String>();
|
myTreatReferencesAsLogical = new HashSet<>();
|
||||||
}
|
}
|
||||||
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
|
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
|
||||||
}
|
}
|
||||||
@ -271,7 +270,6 @@ public class DaoConfig {
|
|||||||
* (next/prev links in search response bundles) will become invalid. Defaults to 1 hour.
|
* (next/prev links in search response bundles) will become invalid. Defaults to 1 hour.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* <p>
|
|
||||||
* To disable this feature entirely, see {@link #setExpireSearchResults(boolean)}
|
* To disable this feature entirely, see {@link #setExpireSearchResults(boolean)}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
@ -291,8 +289,6 @@ public class DaoConfig {
|
|||||||
* (next/prev links in search response bundles) will become invalid. Defaults to 1 hour.
|
* (next/prev links in search response bundles) will become invalid. Defaults to 1 hour.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* <p>
|
|
||||||
* <p>
|
|
||||||
* To disable this feature entirely, see {@link #setExpireSearchResults(boolean)}
|
* To disable this feature entirely, see {@link #setExpireSearchResults(boolean)}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
@ -344,17 +340,16 @@ public class DaoConfig {
|
|||||||
myHardTagListLimit = theHardTagListLimit;
|
myHardTagListLimit = theHardTagListLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIncludeLimit() {
|
|
||||||
return myIncludeLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the maximum number of resources that will be added to a single page of returned resources. Because of
|
* This is the maximum number of resources that will be added to a single page of returned resources. Because of
|
||||||
* includes with wildcards and other possibilities it is possible for a client to make requests that include very
|
* includes with wildcards and other possibilities it is possible for a client to make requests that include very
|
||||||
* large amounts of data, so this hard limit can be imposed to prevent runaway requests.
|
* large amounts of data, so this hard limit can be imposed to prevent runaway requests.
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated in HAPI FHIR 3.2.0 as this method doesn't actually do anything
|
||||||
*/
|
*/
|
||||||
public void setIncludeLimit(int theIncludeLimit) {
|
@Deprecated
|
||||||
myIncludeLimit = theIncludeLimit;
|
public void setIncludeLimit(@SuppressWarnings("unused") int theIncludeLimit) {
|
||||||
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum.ResourceMetadataKeySupporti
|
|||||||
|
|
||||||
public interface IDao {
|
public interface IDao {
|
||||||
|
|
||||||
public static final ResourceMetadataKeySupportingAnyResource<Long, Long> RESOURCE_PID = new MetadataKeyResourcePid("RESOURCE_PID");
|
ResourceMetadataKeySupportingAnyResource<Long, Long> RESOURCE_PID = new MetadataKeyResourcePid("RESOURCE_PID");
|
||||||
|
|
||||||
FhirContext getContext();
|
FhirContext getContext();
|
||||||
|
|
||||||
|
@ -20,14 +20,12 @@ package ca.uhn.fhir.jpa.dao;
|
|||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
|
||||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param <T>
|
* @param <T>
|
||||||
@ -37,17 +35,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|||||||
*/
|
*/
|
||||||
public interface IFhirSystemDao<T, MT> extends IDao {
|
public interface IFhirSystemDao<T, MT> extends IDao {
|
||||||
|
|
||||||
/**
|
<R extends IBaseResource> IFhirResourceDao<R> getDao(Class<R> theType);
|
||||||
* Use with caution! This deletes everything!!
|
|
||||||
*
|
|
||||||
* @param theRequestDetails
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
void deleteAllTagsOnServer(RequestDetails theRequestDetails);
|
|
||||||
|
|
||||||
TagList getAllTags(RequestDetails theRequestDetails);
|
|
||||||
|
|
||||||
public <R extends IBaseResource> IFhirResourceDao<R> getDao(Class<R> theType);
|
|
||||||
|
|
||||||
Map<String, Long> getResourceCounts();
|
Map<String, Long> getResourceCounts();
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||||||
import ca.uhn.fhir.jpa.config.TestDstu2Config;
|
import ca.uhn.fhir.jpa.config.TestDstu2Config;
|
||||||
import ca.uhn.fhir.jpa.dao.*;
|
import ca.uhn.fhir.jpa.dao.*;
|
||||||
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao;
|
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao;
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao;
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao;
|
||||||
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
|
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
||||||
@ -112,6 +114,9 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||||||
@Qualifier("myPatientDaoDstu2")
|
@Qualifier("myPatientDaoDstu2")
|
||||||
protected IFhirResourceDaoPatient<Patient> myPatientDao;
|
protected IFhirResourceDaoPatient<Patient> myPatientDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@Qualifier("myGroupDaoDstu2")
|
||||||
|
protected IFhirResourceDao<Group> myGroupDao;
|
||||||
|
@Autowired
|
||||||
@Qualifier("myPractitionerDaoDstu2")
|
@Qualifier("myPractitionerDaoDstu2")
|
||||||
protected IFhirResourceDao<Practitioner> myPractitionerDao;
|
protected IFhirResourceDao<Practitioner> myPractitionerDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -141,6 +146,10 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected IResourceIndexedSearchParamStringDao myResourceIndexedSearchParamStringDao;
|
protected IResourceIndexedSearchParamStringDao myResourceIndexedSearchParamStringDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
protected IResourceIndexedSearchParamTokenDao myResourceIndexedSearchParamTokenDao;
|
||||||
|
@Autowired
|
||||||
|
protected IResourceLinkDao myResourceLinkDao;
|
||||||
|
@Autowired
|
||||||
protected IResourceTableDao myResourceTableDao;
|
protected IResourceTableDao myResourceTableDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("mySystemDaoDstu2")
|
@Qualifier("mySystemDaoDstu2")
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package ca.uhn.fhir.jpa.dao.dstu2;
|
package ca.uhn.fhir.jpa.dao.dstu2;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||||
|
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Appointment;
|
import ca.uhn.fhir.model.dstu2.resource.*;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Practitioner;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.SearchParameter;
|
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.*;
|
import ca.uhn.fhir.model.dstu2.valueset.*;
|
||||||
import ca.uhn.fhir.model.primitive.*;
|
import ca.uhn.fhir.model.primitive.*;
|
||||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||||
@ -21,6 +20,8 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
|||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.mockito.internal.util.collections.ListUtil;
|
||||||
|
import org.thymeleaf.util.ListUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
|
|||||||
@Before
|
@Before
|
||||||
public void beforeDisableResultReuse() {
|
public void beforeDisableResultReuse() {
|
||||||
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
|
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
|
||||||
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(new DaoConfig().isDefaultSearchParamsCanBeOverridden());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -51,6 +53,90 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOverrideAndDisableBuiltInSearchParametersWithOverridingEnabled() {
|
||||||
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(true);
|
||||||
|
|
||||||
|
SearchParameter memberSp = new SearchParameter();
|
||||||
|
memberSp.setCode("member");
|
||||||
|
memberSp.setBase(ResourceTypeEnum.GROUP);
|
||||||
|
memberSp.setType(SearchParamTypeEnum.REFERENCE);
|
||||||
|
memberSp.setXpath("Group.member.entity");
|
||||||
|
memberSp.setXpathUsage(XPathUsageTypeEnum.NORMAL);
|
||||||
|
memberSp.setStatus(ConformanceResourceStatusEnum.RETIRED);
|
||||||
|
mySearchParameterDao.create(memberSp, mySrd);
|
||||||
|
|
||||||
|
SearchParameter identifierSp = new SearchParameter();
|
||||||
|
identifierSp.setCode("identifier");
|
||||||
|
identifierSp.setBase(ResourceTypeEnum.GROUP);
|
||||||
|
identifierSp.setType(SearchParamTypeEnum.TOKEN);
|
||||||
|
identifierSp.setXpath("Group.identifier");
|
||||||
|
identifierSp.setXpathUsage(XPathUsageTypeEnum.NORMAL);
|
||||||
|
identifierSp.setStatus(ConformanceResourceStatusEnum.RETIRED);
|
||||||
|
mySearchParameterDao.create(identifierSp, mySrd);
|
||||||
|
|
||||||
|
mySearchParamRegsitry.forceRefresh();
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().addGiven("G");
|
||||||
|
IIdType pid = myPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
Group g = new Group();
|
||||||
|
g.addIdentifier().setSystem("urn:foo").setValue("bar");
|
||||||
|
g.addMember().getEntity().setReference(pid);
|
||||||
|
myGroupDao.create(g);
|
||||||
|
|
||||||
|
assertThat(myResourceLinkDao.findAll(), empty());
|
||||||
|
assertThat(ListUtil.filter(myResourceIndexedSearchParamTokenDao.findAll(), new ListUtil.Filter<ResourceIndexedSearchParamToken>() {
|
||||||
|
@Override
|
||||||
|
public boolean isOut(ResourceIndexedSearchParamToken object) {
|
||||||
|
return !object.getResourceType().equals("Group") || object.isMissing();
|
||||||
|
}
|
||||||
|
}), empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOverrideAndDisableBuiltInSearchParametersWithOverridingDisabled() {
|
||||||
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(false);
|
||||||
|
|
||||||
|
SearchParameter memberSp = new SearchParameter();
|
||||||
|
memberSp.setCode("member");
|
||||||
|
memberSp.setBase(ResourceTypeEnum.GROUP);
|
||||||
|
memberSp.setType(SearchParamTypeEnum.REFERENCE);
|
||||||
|
memberSp.setXpath("Group.member.entity");
|
||||||
|
memberSp.setXpathUsage(XPathUsageTypeEnum.NORMAL);
|
||||||
|
memberSp.setStatus(ConformanceResourceStatusEnum.RETIRED);
|
||||||
|
mySearchParameterDao.create(memberSp, mySrd);
|
||||||
|
|
||||||
|
SearchParameter identifierSp = new SearchParameter();
|
||||||
|
identifierSp.setCode("identifier");
|
||||||
|
identifierSp.setBase(ResourceTypeEnum.GROUP);
|
||||||
|
identifierSp.setType(SearchParamTypeEnum.TOKEN);
|
||||||
|
identifierSp.setXpath("Group.identifier");
|
||||||
|
identifierSp.setXpathUsage(XPathUsageTypeEnum.NORMAL);
|
||||||
|
identifierSp.setStatus(ConformanceResourceStatusEnum.RETIRED);
|
||||||
|
mySearchParameterDao.create(identifierSp, mySrd);
|
||||||
|
|
||||||
|
mySearchParamRegsitry.forceRefresh();
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().addGiven("G");
|
||||||
|
IIdType pid = myPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
Group g = new Group();
|
||||||
|
g.addIdentifier().setSystem("urn:foo").setValue("bar");
|
||||||
|
g.addMember().getEntity().setReference(pid);
|
||||||
|
myGroupDao.create(g);
|
||||||
|
|
||||||
|
assertThat(myResourceLinkDao.findAll(), not(empty()));
|
||||||
|
assertThat(ListUtil.filter(myResourceIndexedSearchParamTokenDao.findAll(), new ListUtil.Filter<ResourceIndexedSearchParamToken>() {
|
||||||
|
@Override
|
||||||
|
public boolean isOut(ResourceIndexedSearchParamToken object) {
|
||||||
|
return !object.getResourceType().equals("Group") || object.isMissing();
|
||||||
|
}
|
||||||
|
}), not(empty()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateInvalidParamInvalidResourceName() {
|
public void testCreateInvalidParamInvalidResourceName() {
|
||||||
SearchParameter fooSp = new SearchParameter();
|
SearchParameter fooSp = new SearchParameter();
|
||||||
|
@ -162,7 +162,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
* Per the spec, update should preserve tags and security labels but not profiles
|
* Per the spec, update should preserve tags and security labels but not profiles
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateMaintainsTagsAndSecurityLabels() throws InterruptedException {
|
public void testUpdateMaintainsTagsAndSecurityLabels() {
|
||||||
String methodName = "testUpdateMaintainsTagsAndSecurityLabels";
|
String methodName = "testUpdateMaintainsTagsAndSecurityLabels";
|
||||||
|
|
||||||
IIdType p1id;
|
IIdType p1id;
|
||||||
@ -173,10 +173,10 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
TagList tagList = new TagList();
|
TagList tagList = new TagList();
|
||||||
tagList.addTag("tag_scheme1", "tag_term1");
|
tagList.addTag("tag_scheme1", "tag_term1");
|
||||||
ResourceMetadataKeyEnum.TAG_LIST.put(p1, tagList);
|
ResourceMetadataKeyEnum.TAG_LIST.put(p1, tagList);
|
||||||
List<BaseCodingDt> secList = new ArrayList<BaseCodingDt>();
|
List<BaseCodingDt> secList = new ArrayList<>();
|
||||||
secList.add(new CodingDt("sec_scheme1", "sec_term1"));
|
secList.add(new CodingDt("sec_scheme1", "sec_term1"));
|
||||||
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p1, secList);
|
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p1, secList);
|
||||||
List<IdDt> profileList = new ArrayList<IdDt>();
|
List<IdDt> profileList = new ArrayList<>();
|
||||||
profileList.add(new IdDt("http://foo1"));
|
profileList.add(new IdDt("http://foo1"));
|
||||||
ResourceMetadataKeyEnum.PROFILES.put(p1, profileList);
|
ResourceMetadataKeyEnum.PROFILES.put(p1, profileList);
|
||||||
|
|
||||||
@ -190,10 +190,10 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
TagList tagList = new TagList();
|
TagList tagList = new TagList();
|
||||||
tagList.addTag("tag_scheme2", "tag_term2");
|
tagList.addTag("tag_scheme2", "tag_term2");
|
||||||
ResourceMetadataKeyEnum.TAG_LIST.put(p1, tagList);
|
ResourceMetadataKeyEnum.TAG_LIST.put(p1, tagList);
|
||||||
List<BaseCodingDt> secList = new ArrayList<BaseCodingDt>();
|
List<BaseCodingDt> secList = new ArrayList<>();
|
||||||
secList.add(new CodingDt("sec_scheme2", "sec_term2"));
|
secList.add(new CodingDt("sec_scheme2", "sec_term2"));
|
||||||
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p1, secList);
|
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p1, secList);
|
||||||
List<IdDt> profileList = new ArrayList<IdDt>();
|
List<IdDt> profileList = new ArrayList<>();
|
||||||
profileList.add(new IdDt("http://foo2"));
|
profileList.add(new IdDt("http://foo2"));
|
||||||
ResourceMetadataKeyEnum.PROFILES.put(p1, profileList);
|
ResourceMetadataKeyEnum.PROFILES.put(p1, profileList);
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
TagList tagList = ResourceMetadataKeyEnum.TAG_LIST.get(p1);
|
TagList tagList = ResourceMetadataKeyEnum.TAG_LIST.get(p1);
|
||||||
assertThat(tagList, containsInAnyOrder(new Tag("tag_scheme1", "tag_term1"), new Tag("tag_scheme2", "tag_term2")));
|
assertThat(tagList, containsInAnyOrder(new Tag("tag_scheme1", "tag_term1"), new Tag("tag_scheme2", "tag_term2")));
|
||||||
List<BaseCodingDt> secList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(p1);
|
List<BaseCodingDt> secList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(p1);
|
||||||
Set<String> secListValues = new HashSet<String>();
|
Set<String> secListValues = new HashSet<>();
|
||||||
for (BaseCodingDt next : secList) {
|
for (BaseCodingDt next : secList) {
|
||||||
secListValues.add(next.getSystemElement().getValue() + "|" + next.getCodeElement().getValue());
|
secListValues.add(next.getSystemElement().getValue() + "|" + next.getCodeElement().getValue());
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateMaintainsSearchParams() throws InterruptedException {
|
public void testUpdateMaintainsSearchParams() {
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2AAA");
|
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2AAA");
|
||||||
p1.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2AAA");
|
p1.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2AAA");
|
||||||
@ -224,7 +224,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
Patient p2 = new Patient();
|
Patient p2 = new Patient();
|
||||||
p2.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2BBB");
|
p2.addIdentifier().setSystem("urn:system").setValue("testUpdateMaintainsSearchParamsDstu2BBB");
|
||||||
p2.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2BBB");
|
p2.addName().addFamily("Tester").addGiven("testUpdateMaintainsSearchParamsDstu2BBB");
|
||||||
myPatientDao.create(p2, mySrd).getId();
|
myPatientDao.create(p2, mySrd);
|
||||||
|
|
||||||
Set<Long> ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsDstu2AAA")));
|
Set<Long> ids = myPatientDao.searchForIds(new SearchParameterMap(Patient.SP_GIVEN, new StringDt("testUpdateMaintainsSearchParamsDstu2AAA")));
|
||||||
assertEquals(1, ids.size());
|
assertEquals(1, ids.size());
|
||||||
@ -251,7 +251,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateRejectsInvalidTypes() throws InterruptedException {
|
public void testUpdateRejectsInvalidTypes() {
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes");
|
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes");
|
||||||
p1.addName().addFamily("Tester").addGiven("testUpdateRejectsInvalidTypes");
|
p1.addName().addFamily("Tester").addGiven("testUpdateRejectsInvalidTypes");
|
||||||
@ -285,7 +285,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().addFamily(name);
|
patient.addName().addFamily(name);
|
||||||
|
|
||||||
List<IdDt> tl = new ArrayList<IdDt>();
|
List<IdDt> tl = new ArrayList<>();
|
||||||
tl.add(new IdDt("http://foo/bar"));
|
tl.add(new IdDt("http://foo/bar"));
|
||||||
tl.add(new IdDt("http://foo/bar"));
|
tl.add(new IdDt("http://foo/bar"));
|
||||||
tl.add(new IdDt("http://foo/bar"));
|
tl.add(new IdDt("http://foo/bar"));
|
||||||
@ -312,7 +312,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().addFamily(name);
|
patient.addName().addFamily(name);
|
||||||
|
|
||||||
List<IdDt> tl = new ArrayList<IdDt>();
|
List<IdDt> tl = new ArrayList<>();
|
||||||
tl.add(new IdDt("http://foo/bar"));
|
tl.add(new IdDt("http://foo/bar"));
|
||||||
ResourceMetadataKeyEnum.PROFILES.put(patient, tl);
|
ResourceMetadataKeyEnum.PROFILES.put(patient, tl);
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ public class FhirResourceDaoDstu2UpdateTest extends BaseJpaDstu2Test {
|
|||||||
patient.setId(id);
|
patient.setId(id);
|
||||||
patient.addName().addFamily(name);
|
patient.addName().addFamily(name);
|
||||||
|
|
||||||
List<IdDt> tl = new ArrayList<IdDt>();
|
List<IdDt> tl = new ArrayList<>();
|
||||||
tl.add(new IdDt("http://foo/baz"));
|
tl.add(new IdDt("http://foo/baz"));
|
||||||
ResourceMetadataKeyEnum.PROFILES.put(patient, tl);
|
ResourceMetadataKeyEnum.PROFILES.put(patient, tl);
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
|||||||
private static JpaValidationSupportChainR4 ourJpaValidationSupportChainR4;
|
private static JpaValidationSupportChainR4 ourJpaValidationSupportChainR4;
|
||||||
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
|
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected IResourceLinkDao myResourceLinkDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected ISearchParamDao mySearchParamDao;
|
protected ISearchParamDao mySearchParamDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user