More perf work
This commit is contained in:
parent
e32d6bb56e
commit
04468c8352
|
@ -308,7 +308,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
}
|
}
|
||||||
|
|
||||||
retVal.add(nextSpDef.getName());
|
retVal.add(nextSpDef.getName());
|
||||||
|
|
||||||
if (isLogicalReference(nextId)) {
|
if (isLogicalReference(nextId)) {
|
||||||
ResourceLink resourceLink = new ResourceLink(nextPathAndRef.getPath(), theEntity, nextId, theUpdateTime);
|
ResourceLink resourceLink = new ResourceLink(nextPathAndRef.getPath(), theEntity, nextId, theUpdateTime);
|
||||||
if (theLinks.add(resourceLink)) {
|
if (theLinks.add(resourceLink)) {
|
||||||
|
@ -970,9 +970,9 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* Subclasses may override to provide behaviour. Called when a resource has been inserted into the database for the first time.
|
* Subclasses may override to provide behaviour. Called when a resource has been inserted into the database for the first time.
|
||||||
*
|
*
|
||||||
* @param theEntity
|
* @param theEntity
|
||||||
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
||||||
* @param theTag
|
* @param theTag
|
||||||
* The tag
|
* The tag
|
||||||
*/
|
*/
|
||||||
protected void postPersist(ResourceTable theEntity, T theResource) {
|
protected void postPersist(ResourceTable theEntity, T theResource) {
|
||||||
// nothing
|
// nothing
|
||||||
|
@ -982,9 +982,9 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* Subclasses may override to provide behaviour. Called when a pre-existing resource has been updated in the database
|
* Subclasses may override to provide behaviour. Called when a pre-existing resource has been updated in the database
|
||||||
*
|
*
|
||||||
* @param theEntity
|
* @param theEntity
|
||||||
* The resource
|
* The resource
|
||||||
* @param theResource
|
* @param theResource
|
||||||
* The resource being persisted
|
* The resource being persisted
|
||||||
*/
|
*/
|
||||||
protected void postUpdate(ResourceTable theEntity, T theResource) {
|
protected void postUpdate(ResourceTable theEntity, T theResource) {
|
||||||
// nothing
|
// nothing
|
||||||
|
@ -1045,9 +1045,9 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param theEntity
|
* @param theEntity
|
||||||
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
||||||
* @param theTag
|
* @param theTag
|
||||||
* The tag
|
* The tag
|
||||||
* @return Retturns <code>true</code> if the tag should be removed
|
* @return Retturns <code>true</code> if the tag should be removed
|
||||||
*/
|
*/
|
||||||
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
||||||
|
@ -1283,7 +1283,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.QUANTITY, quantityParams);
|
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.QUANTITY, quantityParams);
|
||||||
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.DATE, dateParams);
|
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.DATE, dateParams);
|
||||||
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.URI, uriParams);
|
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.URI, uriParams);
|
||||||
|
findMissingSearchParams(theEntity, activeSearchParams, RestSearchParameterTypeEnum.TOKEN, tokenParams);
|
||||||
|
|
||||||
setUpdatedTime(stringParams, theUpdateTime);
|
setUpdatedTime(stringParams, theUpdateTime);
|
||||||
setUpdatedTime(numberParams, theUpdateTime);
|
setUpdatedTime(numberParams, theUpdateTime);
|
||||||
setUpdatedTime(quantityParams, theUpdateTime);
|
setUpdatedTime(quantityParams, theUpdateTime);
|
||||||
|
@ -1383,7 +1384,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
theEntity.setIndexStatus(INDEX_STATUS_INDEXED);
|
theEntity.setIndexStatus(INDEX_STATUS_INDEXED);
|
||||||
populateFullTextFields(theResource, theEntity);
|
populateFullTextFields(theResource, theEntity);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
populateResourceIntoEntity(theResource, theEntity);
|
populateResourceIntoEntity(theResource, theEntity);
|
||||||
|
@ -1422,22 +1422,17 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
for (String nextKey : populatedResourceLinkParameters) {
|
for (String nextKey : populatedResourceLinkParameters) {
|
||||||
presentSearchParams.put(nextKey, Boolean.TRUE);
|
presentSearchParams.put(nextKey, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
updateSearchParamPresent(presentSearchParams, stringParams);
|
Set<Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet();
|
||||||
updateSearchParamPresent(presentSearchParams, tokenParams);
|
for (Entry<String, RuntimeSearchParam> nextSpEntry : activeSearchParams) {
|
||||||
updateSearchParamPresent(presentSearchParams, numberParams);
|
if (nextSpEntry.getValue().getParamType() == RestSearchParameterTypeEnum.REFERENCE) {
|
||||||
updateSearchParamPresent(presentSearchParams, quantityParams);
|
if (!presentSearchParams.containsKey(nextSpEntry.getKey())) {
|
||||||
updateSearchParamPresent(presentSearchParams, dateParams);
|
presentSearchParams.put(nextSpEntry.getKey(), Boolean.FALSE);
|
||||||
updateSearchParamPresent(presentSearchParams, uriParams);
|
}
|
||||||
updateSearchParamPresent(presentSearchParams, coordsParams);
|
|
||||||
Set<String> activeSearchParamNames = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).keySet();
|
|
||||||
for (String nextSpName : activeSearchParamNames) {
|
|
||||||
if (!presentSearchParams.containsKey(nextSpName)) {
|
|
||||||
presentSearchParams.put(nextSpName, Boolean.FALSE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySearchParamPresenceSvc.updatePresence(theEntity, presentSearchParams);
|
mySearchParamPresenceSvc.updatePresence(theEntity, presentSearchParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create history entry
|
* Create history entry
|
||||||
*/
|
*/
|
||||||
|
@ -1541,7 +1536,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!haveParam) {
|
if (!haveParam) {
|
||||||
BaseResourceIndexedSearchParam param;
|
BaseResourceIndexedSearchParam param;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1676,9 +1671,9 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* "subsetted" tag and rejects resources which have it. Subclasses should call the superclass implementation to preserve this check.
|
* "subsetted" tag and rejects resources which have it. Subclasses should call the superclass implementation to preserve this check.
|
||||||
*
|
*
|
||||||
* @param theResource
|
* @param theResource
|
||||||
* The resource that is about to be persisted
|
* The resource that is about to be persisted
|
||||||
* @param theEntityToSave
|
* @param theEntityToSave
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
protected void validateResourceForStorage(T theResource, ResourceTable theEntityToSave) {
|
protected void validateResourceForStorage(T theResource, ResourceTable theEntityToSave) {
|
||||||
Object tag = null;
|
Object tag = null;
|
||||||
|
|
|
@ -140,13 +140,13 @@ public class SearchBuilder {
|
||||||
|
|
||||||
private void addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamDate> join = myResourceTableRoot.join("myParamsDate", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamDate> join = myResourceTableRoot.join("myParamsDate", JoinType.LEFT);
|
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
IQueryParameterType params = nextOr;
|
IQueryParameterType params = nextOr;
|
||||||
|
@ -266,13 +266,13 @@ public class SearchBuilder {
|
||||||
|
|
||||||
private void addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamNumber> join = myResourceTableRoot.join("myParamsNumber", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamNumber> join = myResourceTableRoot.join("myParamsNumber", JoinType.LEFT);
|
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
IQueryParameterType params = nextOr;
|
IQueryParameterType params = nextOr;
|
||||||
|
@ -302,6 +302,13 @@ public class SearchBuilder {
|
||||||
myPredicates.add(myBuilder.or(toArray(codePredicates)));
|
myPredicates.add(myBuilder.or(toArray(codePredicates)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addPredicateParamMissing(String theParamName, boolean theMissing, Join<ResourceTable, ? extends BaseResourceIndexedSearchParam> theJoin) {
|
||||||
|
|
||||||
|
myPredicates.add(myBuilder.equal(theJoin.get("myResourceType"), myResourceName));
|
||||||
|
myPredicates.add(myBuilder.equal(theJoin.get("myParamName"), theParamName));
|
||||||
|
myPredicates.add(myBuilder.equal(theJoin.get("myMissing"), theMissing));
|
||||||
|
}
|
||||||
|
|
||||||
private void addPredicateParamMissing(String theParamName, boolean theMissing) {
|
private void addPredicateParamMissing(String theParamName, boolean theMissing) {
|
||||||
Join<ResourceTable, SearchParamPresent> paramPresentJoin = myResourceTableRoot.join("mySearchParamPresents", JoinType.LEFT);
|
Join<ResourceTable, SearchParamPresent> paramPresentJoin = myResourceTableRoot.join("mySearchParamPresents", JoinType.LEFT);
|
||||||
Join<SearchParamPresent, SearchParam> paramJoin = paramPresentJoin.join("mySearchParam", JoinType.LEFT);
|
Join<SearchParamPresent, SearchParam> paramJoin = paramPresentJoin.join("mySearchParam", JoinType.LEFT);
|
||||||
|
@ -312,13 +319,13 @@ public class SearchBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamQuantity> join = myResourceTableRoot.join("myParamsQuantity", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamQuantity> join = myResourceTableRoot.join("myParamsQuantity", JoinType.LEFT);
|
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
|
|
||||||
|
@ -331,12 +338,12 @@ public class SearchBuilder {
|
||||||
|
|
||||||
private void addPredicateReference(String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateReference(String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
assert theParamName.contains(".") == false;
|
assert theParamName.contains(".") == false;
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceLink> join = myResourceTableRoot.join("myResourceLinks", JoinType.LEFT);
|
Join<ResourceTable, ResourceLink> join = myResourceTableRoot.join("myResourceLinks", JoinType.LEFT);
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
|
@ -514,13 +521,14 @@ public class SearchBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamString> join = myResourceTableRoot.join("myParamsString", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamString> join = myResourceTableRoot.join("myParamsString", JoinType.LEFT);
|
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
IQueryParameterType theParameter = nextOr;
|
IQueryParameterType theParameter = nextOr;
|
||||||
|
@ -661,14 +669,14 @@ public class SearchBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamToken> join = myResourceTableRoot.join("myParamsToken", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamToken> join = myResourceTableRoot.join("myParamsToken", JoinType.LEFT);
|
|
||||||
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
|
|
||||||
|
@ -693,12 +701,14 @@ public class SearchBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateUri(String theParamName, List<? extends IQueryParameterType> theList) {
|
private void addPredicateUri(String theParamName, List<? extends IQueryParameterType> theList) {
|
||||||
|
|
||||||
|
Join<ResourceTable, ResourceIndexedSearchParamUri> join = myResourceTableRoot.join("myParamsUri", JoinType.LEFT);
|
||||||
|
|
||||||
if (theList.get(0).getMissing() != null) {
|
if (theList.get(0).getMissing() != null) {
|
||||||
addPredicateParamMissing(theParamName, theList.get(0).getMissing());
|
addPredicateParamMissing(theParamName, theList.get(0).getMissing(), join);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Join<ResourceTable, ResourceIndexedSearchParamUri> join = myResourceTableRoot.join("myParamsUri", JoinType.LEFT);
|
|
||||||
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
List<Predicate> codePredicates = new ArrayList<Predicate>();
|
||||||
for (IQueryParameterType nextOr : theList) {
|
for (IQueryParameterType nextOr : theList) {
|
||||||
IQueryParameterType params = nextOr;
|
IQueryParameterType params = nextOr;
|
||||||
|
@ -759,7 +769,7 @@ public class SearchBuilder {
|
||||||
* just add a predicate that can never match
|
* just add a predicate that can never match
|
||||||
*/
|
*/
|
||||||
if (codePredicates.isEmpty()) {
|
if (codePredicates.isEmpty()) {
|
||||||
Predicate predicate = myBuilder.isNull(join.<Object> get("myUri").as(String.class));
|
Predicate predicate = myBuilder.isNull(join.<Object> get("myMissing").as(String.class));
|
||||||
myPredicates.add(predicate);
|
myPredicates.add(predicate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1116,9 +1126,8 @@ public class SearchBuilder {
|
||||||
if (codes.isEmpty()) {
|
if (codes.isEmpty()) {
|
||||||
|
|
||||||
// This will never match anything
|
// This will never match anything
|
||||||
Predicate systemPredicate = theBuilder.isNull(theFrom.get("mySystem"));
|
Predicate codePredicate = theBuilder.isNull(theFrom.get("myMissing"));
|
||||||
Predicate codePredicate = theBuilder.isNull(theFrom.get("myValue"));
|
singleCodePredicates.add(codePredicate);
|
||||||
singleCodePredicates.add(theBuilder.and(systemPredicate, codePredicate));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
List<Predicate> orPredicates = new ArrayList<Predicate>();
|
List<Predicate> orPredicates = new ArrayList<Predicate>();
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_RES_PARAM_PRESENT", indexes = {
|
@Table(name = "HFJ_RES_PARAM_PRESENT", indexes = {
|
||||||
@Index(name = "IDX_RESPARMPRESENT_RESID", columnList = "RES_ID")
|
@Index(name = "IDX_RESPARMPRESENT_RESID", columnList = "RES_ID")
|
||||||
|
@ -55,4 +58,14 @@ public class SearchParamPresent implements Serializable {
|
||||||
mySearchParam = theSearchParam;
|
mySearchParam = theSearchParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||||
|
|
||||||
|
b.append("res_pid", myResource.getIdDt().toUnqualifiedVersionless().getValue());
|
||||||
|
b.append("param", mySearchParam.getParamName());
|
||||||
|
b.append("present", myPresent);
|
||||||
|
return b.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,7 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
|
||||||
List<SearchParamPresent> entitiesToDelete = new ArrayList<SearchParamPresent>();
|
List<SearchParamPresent> entitiesToDelete = new ArrayList<SearchParamPresent>();
|
||||||
|
|
||||||
Collection<SearchParamPresent> existing;
|
Collection<SearchParamPresent> existing;
|
||||||
// if (theResource.getId() != null) {
|
existing = mySearchParamPresentDao.findAllForResource(theResource);
|
||||||
existing = mySearchParamPresentDao.findAllForResource(theResource);
|
|
||||||
// } else {
|
|
||||||
// existing = Collections.emptyList();
|
|
||||||
// }
|
|
||||||
|
|
||||||
for (SearchParamPresent nextExistingEntity : existing) {
|
for (SearchParamPresent nextExistingEntity : existing) {
|
||||||
String nextSearchParamName = nextExistingEntity.getSearchParam().getParamName();
|
String nextSearchParamName = nextExistingEntity.getSearchParam().getParamName();
|
||||||
|
@ -69,19 +65,19 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
|
||||||
mySearchParamDao.save(searchParam);
|
mySearchParamDao.save(searchParam);
|
||||||
// Don't add the newly saved entity to the map in case the save fails
|
// Don't add the newly saved entity to the map in case the save fails
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchParamPresent present = new SearchParamPresent();
|
|
||||||
present.setResource(theResource);
|
|
||||||
present.setSearchParam(searchParam);
|
|
||||||
present.setPresent(next.getValue());
|
|
||||||
entitiesToSave.add(present);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SearchParamPresent present = new SearchParamPresent();
|
||||||
|
present.setResource(theResource);
|
||||||
|
present.setSearchParam(searchParam);
|
||||||
|
present.setPresent(next.getValue());
|
||||||
|
entitiesToSave.add(present);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mySearchParamPresentDao.deleteInBatch(entitiesToDelete);
|
mySearchParamPresentDao.deleteInBatch(entitiesToDelete);
|
||||||
mySearchParamPresentDao.save(entitiesToSave);
|
mySearchParamPresentDao.save(entitiesToSave);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
|
||||||
|
|
||||||
private Properties jpaProperties() {
|
private Properties jpaProperties() {
|
||||||
Properties extraProperties = new Properties();
|
Properties extraProperties = new Properties();
|
||||||
extraProperties.put("hibernate.format_sql", "false");
|
extraProperties.put("hibernate.format_sql", "true");
|
||||||
extraProperties.put("hibernate.show_sql", "false");
|
extraProperties.put("hibernate.show_sql", "false");
|
||||||
extraProperties.put("hibernate.hbm2ddl.auto", "update");
|
extraProperties.put("hibernate.hbm2ddl.auto", "update");
|
||||||
extraProperties.put("hibernate.dialect", "org.hibernate.dialect.DerbyTenSevenDialect");
|
extraProperties.put("hibernate.dialect", "org.hibernate.dialect.DerbyTenSevenDialect");
|
||||||
|
|
|
@ -29,9 +29,11 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
||||||
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
|
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
|
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity;
|
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity;
|
||||||
|
@ -170,7 +172,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
assertThat(actual, contains(id));
|
assertThat(actual, contains(id));
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamDate> type = ResourceIndexedSearchParamDate.class;
|
Class<ResourceIndexedSearchParamDate> type = ResourceIndexedSearchParamDate.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
}
|
}
|
||||||
|
@ -256,7 +258,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamString> type = ResourceIndexedSearchParamString.class;
|
Class<ResourceIndexedSearchParamString> type = ResourceIndexedSearchParamString.class;
|
||||||
List<ResourceIndexedSearchParamString> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<ResourceIndexedSearchParamString> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
|
@ -275,7 +277,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
IIdType id = myPatientDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myPatientDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamToken> type = ResourceIndexedSearchParamToken.class;
|
Class<ResourceIndexedSearchParamToken> type = ResourceIndexedSearchParamToken.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
|
@ -294,7 +296,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
IIdType id = myConceptMapDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myConceptMapDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamUri> type = ResourceIndexedSearchParamUri.class;
|
Class<ResourceIndexedSearchParamUri> type = ResourceIndexedSearchParamUri.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
|
@ -1268,6 +1270,9 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISearchParamPresentDao mySearchParamPresentDao;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test
|
@Test
|
||||||
public void testSearchResourceReferenceMissing() {
|
public void testSearchResourceReferenceMissing() {
|
||||||
|
@ -1305,8 +1310,10 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
pid4 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
pid4 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchParameterMap params;
|
ourLog.info("" + mySearchParamPresentDao.findAll());
|
||||||
|
|
||||||
|
SearchParameterMap params;
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.add(Patient.SP_ORGANIZATION, new ReferenceParam().setMissing(true));
|
params.add(Patient.SP_ORGANIZATION, new ReferenceParam().setMissing(true));
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(pid1, pid3));
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(pid1, pid3));
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
assertThat(actual, contains(id));
|
assertThat(actual, contains(id));
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamDate> type = ResourceIndexedSearchParamDate.class;
|
Class<ResourceIndexedSearchParamDate> type = ResourceIndexedSearchParamDate.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamString> type = ResourceIndexedSearchParamString.class;
|
Class<ResourceIndexedSearchParamString> type = ResourceIndexedSearchParamString.class;
|
||||||
List<ResourceIndexedSearchParamString> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<ResourceIndexedSearchParamString> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
IIdType id = myPatientDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myPatientDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamToken> type = ResourceIndexedSearchParamToken.class;
|
Class<ResourceIndexedSearchParamToken> type = ResourceIndexedSearchParamToken.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
|
|
||||||
// This is 3 for now because the FluentPath for Patient:deceased adds a value.. this should
|
// This is 3 for now because the FluentPath for Patient:deceased adds a value.. this should
|
||||||
|
@ -492,7 +492,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
IIdType id = myValueSetDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id = myValueSetDao.create(res, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Class<ResourceIndexedSearchParamUri> type = ResourceIndexedSearchParamUri.class;
|
Class<ResourceIndexedSearchParamUri> type = ResourceIndexedSearchParamUri.class;
|
||||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||||
ourLog.info(toStringMultiline(results));
|
ourLog.info(toStringMultiline(results));
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
<!-- Set to 'trace' to enable SQL Value logging -->
|
<!-- Set to 'trace' to enable SQL Value logging -->
|
||||||
<logger name="org.hibernate.type" additivity="false" level="info">
|
<logger name="org.hibernate.type" additivity="false" level="trace">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue