/** * Creates a copy of this include with recurse behaviour */ public Include asRecursive() { return new Include(myValue, true); }
if (nextInclude.isRecurse() == false) { iter.remove(); boolean matchAll = "*".equals(nextInclude.getValue()); if (matchAll) { String sql; String resType = nextInclude.getParamType(); if (isBlank(resType)) { continue; ourLog.warn("Unknown resource type in include/revinclude=" + nextInclude.getValue()); continue; String paramName = nextInclude.getParamName(); if (isNotBlank(paramName)) { param = mySearchParamRegistry.getSearchParamByName(def, paramName); ourLog.warn("Unknown param name in include/revinclude=" + nextInclude.getValue()); continue; String targetResourceType = defaultString(nextInclude.getParamTargetType(), null); for (String nextPath : paths) { String sql;
@Override public int compare(Include theO1, Include theO2) { int retVal = StringUtils.compare(theO1.getParamType(), theO2.getParamType()); if (retVal == 0) { retVal = StringUtils.compare(theO1.getParamName(), theO2.getParamName()); } if (retVal == 0) { retVal = StringUtils.compare(theO1.getParamTargetType(), theO2.getParamTargetType()); } return retVal; }
StringBuilder b = new StringBuilder(); String paramType = getParamType(); String paramName = getParamName(); if (isBlank(paramType) || isBlank(paramName)) { throw new IllegalStateException("This include does not contain a value in the format [ResourceType]:[paramName]"); b.append(theResourceType); Include retVal = new Include(b.toString(), myRecurse, myImmutable); return retVal;
public boolean matchesInclude(Include theInclude) { if (theInclude.getValue().equals("*")) { return true; } int colonIndex = theInclude.getValue().indexOf(':'); if (colonIndex != -1) { // DSTU2+ style String resourceName = theInclude.getValue().substring(0, colonIndex); String paramName = theInclude.getValue().substring(colonIndex + 1); RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(resourceName); if (resourceDef != null) { RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName); if (searchParamDef!=null) { final String completeName = myOwningResource + "." + myName; boolean matched = false; for (String s : searchParamDef.getPathsSplit()) { if (s.equals(completeName) || s.startsWith(completeName + ".")) { matched = true; break; } } return matched; } } return false; } // DSTU1 style return (theInclude.getValue().equals(myOwningResource + '.' + myName)); } }
@Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { SearchParameterMap paramMap = new SearchParameterMap(); if (theCount != null) { paramMap.setCount(theCount.getValue()); } paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive())); paramMap.setSort(theSort); paramMap.setLastUpdated(theLastUpdate); if (theId != null) { paramMap.add("_id", new StringParam(theId.getIdPart())); } IBundleProvider bundleProvider = search(paramMap); return bundleProvider; } }
.and(Patient.BIRTHDATE.after().day("2011-01-01")) .withTag("http://acme.org/codes", "needs-review") .include(Patient.INCLUDE_ORGANIZATION.asRecursive()) .include(Patient.INCLUDE_CAREPROVIDER.asNonRecursive()) .revInclude(Provenance.INCLUDE_TARGET) .lastUpdated(new DateRangeParam("2011-01-01", null))
StringBuilder b = new StringBuilder(); String paramType = getParamType(); String paramName = getParamName(); if (isBlank(paramType) || isBlank(paramName)) { throw new IllegalStateException("This include does not contain a value in the format [ResourceType]:[paramName]"); b.append(theResourceType); Include retVal = new Include(b.toString(), myRecurse, myImmutable); return retVal;
private void addUrlIncludeParams(StringBuilder b, String paramName, Set<Include> theList) { ArrayList<Include> list = new ArrayList<>(theList); list.sort(new IncludeComparator()); for (Include nextInclude : list) { addUrlParamSeparator(b); b.append(paramName); b.append('='); b.append(UrlUtil.escapeUrlParam(nextInclude.getParamType())); b.append(':'); b.append(UrlUtil.escapeUrlParam(nextInclude.getParamName())); if (isNotBlank(nextInclude.getParamTargetType())) { b.append(':'); b.append(nextInclude.getParamTargetType()); } } }
@Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { SearchParameterMap paramMap = new SearchParameterMap(); if (theCount != null) { paramMap.setCount(theCount.getValue()); } paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive())); paramMap.setSort(theSort); paramMap.setLastUpdated(theLastUpdate); if (theId != null) { paramMap.add("_id", new StringParam(theId.getIdPart())); } IBundleProvider bundleProvider = search(paramMap); return bundleProvider; } }
if (nextInclude.isRecurse() == false) { iter.remove(); boolean matchAll = "*".equals(nextInclude.getValue()); if (matchAll) { String sql; String resType = nextInclude.getParamType(); if (isBlank(resType)) { continue; ourLog.warn("Unknown resource type in include/revinclude=" + nextInclude.getValue()); continue; String paramName = nextInclude.getParamName(); if (isNotBlank(paramName)) { param = mySearchParamRegistry.getSearchParamByName(def, paramName); ourLog.warn("Unknown param name in include/revinclude=" + nextInclude.getValue()); continue; String targetResourceType = defaultString(nextInclude.getParamTargetType(), null); for (String nextPath : paths) { String sql;
/** * Return a new */ public Include toLocked() { Include retVal = new Include(myValue, myRecurse, true); return retVal; }
public boolean matchesInclude(Include theInclude) { if (theInclude.getValue().equals("*")) { return true; } int colonIndex = theInclude.getValue().indexOf(':'); if (colonIndex != -1) { // DSTU2+ style String resourceName = theInclude.getValue().substring(0, colonIndex); String paramName = theInclude.getValue().substring(colonIndex + 1); RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(resourceName); if (resourceDef != null) { RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName); if (searchParamDef!=null) { final String completeName = myOwningResource + "." + myName; boolean matched = false; for (String s : searchParamDef.getPathsSplit()) { if (s.equals(completeName) || s.startsWith(completeName + ".")) { matched = true; break; } } return matched; } } return false; } // DSTU1 style return (theInclude.getValue().equals(myOwningResource + '.' + myName)); } }
@Override public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort) { SearchParameterMap paramMap = new SearchParameterMap(); if (theCount != null) { paramMap.setCount(theCount.getValue()); } // paramMap.setRevIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive())); paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive())); paramMap.setEverythingMode(theId != null ? EverythingModeEnum.ENCOUNTER_INSTANCE : EverythingModeEnum.ENCOUNTER_TYPE); paramMap.setSort(theSort); paramMap.setLastUpdated(theLastUpdated); if (theId != null) { paramMap.add("_id", new StringParam(theId.getIdPart())); } IBundleProvider retVal = search(paramMap); return retVal; }
public static void populateSearchEntity(SearchParameterMap theParams, String theResourceType, String theSearchUuid, String theQueryString, Search theSearch) { theSearch.setDeleted(false); theSearch.setUuid(theSearchUuid); theSearch.setCreated(new Date()); theSearch.setSearchLastReturned(new Date()); theSearch.setTotalCount(null); theSearch.setNumFound(0); theSearch.setPreferredPageSize(theParams.getCount()); theSearch.setSearchType(theParams.getEverythingMode() != null ? SearchTypeEnum.EVERYTHING : SearchTypeEnum.SEARCH); theSearch.setLastUpdated(theParams.getLastUpdated()); theSearch.setResourceType(theResourceType); theSearch.setStatus(SearchStatusEnum.LOADING); theSearch.setSearchQueryString(theQueryString); theSearch.setSearchQueryStringHash(theQueryString.hashCode()); for (Include next : theParams.getIncludes()) { theSearch.addInclude(new SearchInclude(theSearch, next.getValue(), false, next.isRecurse())); } for (Include next : theParams.getRevIncludes()) { theSearch.addInclude(new SearchInclude(theSearch, next.getValue(), true, next.isRecurse())); } }
/** * Creates a copy of this include with non-recurse behaviour */ public Include asNonRecursive() { return new Include(myValue, false); }