Merge branch 'master' of github.com:jamesagnew/hapi-fhir into hl7org_structs
This commit is contained in:
commit
496333b5e0
|
@ -106,6 +106,9 @@ public class StringParam extends BaseParam implements IQueryParameterType {
|
||||||
if (myExact) {
|
if (myExact) {
|
||||||
builder.append("exact", myExact);
|
builder.append("exact", myExact);
|
||||||
}
|
}
|
||||||
|
if (getMissing() != null) {
|
||||||
|
builder.append("missing", getMissing().booleanValue());
|
||||||
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1044,6 +1044,9 @@ public abstract class BaseFhirDao implements IDao {
|
||||||
quantityParams = extractSearchParamQuantity(entity, theResource);
|
quantityParams = extractSearchParamQuantity(entity, theResource);
|
||||||
dateParams = extractSearchParamDates(entity, theResource);
|
dateParams = extractSearchParamDates(entity, theResource);
|
||||||
|
|
||||||
|
ourLog.info("Indexing resource: {}", entity.getId());
|
||||||
|
ourLog.info("Storing string indexes: {}", stringParams);
|
||||||
|
|
||||||
tokenParams = new ArrayList<ResourceIndexedSearchParamToken>();
|
tokenParams = new ArrayList<ResourceIndexedSearchParamToken>();
|
||||||
for (BaseResourceIndexedSearchParam next : extractSearchParamTokens(entity, theResource)) {
|
for (BaseResourceIndexedSearchParam next : extractSearchParamTokens(entity, theResource)) {
|
||||||
if (next instanceof ResourceIndexedSearchParamToken) {
|
if (next instanceof ResourceIndexedSearchParamToken) {
|
||||||
|
|
|
@ -366,25 +366,32 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Long> addPredicateParamMissing(Set<Long> thePids, String joinName, String theParamName, Class<? extends BaseResourceIndexedSearchParam> theParamTable) {
|
private Set<Long> addPredicateParamMissing(Set<Long> thePids, String joinName, String theParamName, Class<? extends BaseResourceIndexedSearchParam> theParamTable) {
|
||||||
|
String resourceType = getContext().getResourceDefinition(getResourceType()).getName();
|
||||||
|
|
||||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||||
CriteriaQuery<Long> cq = builder.createQuery(Long.class);
|
CriteriaQuery<Long> cq = builder.createQuery(Long.class);
|
||||||
Root<ResourceTable> from = cq.from(ResourceTable.class);
|
Root<ResourceTable> from = cq.from(ResourceTable.class);
|
||||||
cq.select(from.get("myId").as(Long.class));
|
cq.select(from.get("myId").as(Long.class));
|
||||||
|
|
||||||
Subquery<Long> subQ = cq.subquery(Long.class);
|
Subquery<Long> subQ = cq.subquery(Long.class);
|
||||||
Root<? extends BaseResourceIndexedSearchParam> subQfrom = subQ.from(theParamTable);
|
Root<? extends BaseResourceIndexedSearchParam> subQfrom = subQ.from(theParamTable);
|
||||||
subQ.select(subQfrom.get("myResourcePid").as(Long.class));
|
subQ.select(subQfrom.get("myResourcePid").as(Long.class));
|
||||||
subQ.where(builder.equal(subQfrom.get("myParamName"), theParamName));
|
Predicate subQname = builder.equal(subQfrom.get("myParamName"), theParamName);
|
||||||
|
Predicate subQtype = builder.equal(subQfrom.get("myResourceType"), resourceType);
|
||||||
|
subQ.where(builder.and(subQtype, subQname));
|
||||||
|
|
||||||
Predicate joinPredicate = builder.not(builder.in(from.get("myId")).value(subQ));
|
Predicate joinPredicate = builder.not(builder.in(from.get("myId")).value(subQ));
|
||||||
|
Predicate typePredicate = builder.equal(from.get("myResourceType"), resourceType);
|
||||||
|
|
||||||
if (thePids.size() > 0) {
|
if (thePids.size() > 0) {
|
||||||
Predicate inPids = (from.get("myId").in(thePids));
|
Predicate inPids = (from.get("myId").in(thePids));
|
||||||
cq.where(builder.and(inPids, joinPredicate));
|
cq.where(builder.and(inPids, typePredicate, joinPredicate));
|
||||||
} else {
|
} else {
|
||||||
cq.where(joinPredicate);
|
cq.where(builder.and(typePredicate, joinPredicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ourLog.info("Adding :missing qualifier for parameter '{}'", theParamName);
|
||||||
|
|
||||||
TypedQuery<Long> q = myEntityManager.createQuery(cq);
|
TypedQuery<Long> q = myEntityManager.createQuery(cq);
|
||||||
List<Long> resultList = q.getResultList();
|
List<Long> resultList = q.getResultList();
|
||||||
HashSet<Long> retVal = new HashSet<Long>(resultList);
|
HashSet<Long> retVal = new HashSet<Long>(resultList);
|
||||||
|
|
|
@ -355,7 +355,7 @@ public class ResourceProviderDstu2Test {
|
||||||
List<IdDt> list = toIdListUnqualifiedVersionless(found);
|
List<IdDt> list = toIdListUnqualifiedVersionless(found);
|
||||||
ourLog.info(methodName + ": " + list.toString());
|
ourLog.info(methodName + ": " + list.toString());
|
||||||
assertThat(list, not(containsInRelativeOrder(orgNotMissing)));
|
assertThat(list, not(containsInRelativeOrder(orgNotMissing)));
|
||||||
assertThat(list, containsInRelativeOrder(orgMissing));
|
assertThat("Wanted " + orgMissing + " but found: " + list, list, containsInRelativeOrder(orgMissing));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue