@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorDstu2 searchParamExtractor() { return new SearchParamExtractorDstu2(); }
private void extractTokensFromCodeableConcept(List<String> theSystems, List<String> theCodes, CodeableConceptDt theCodeableConcept, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef) { for (CodingDt nextCoding : theCodeableConcept.getCoding()) { extractTokensFromCoding(theSystems, theCodes, theEntity, theListToPopulate, theParameterDef, nextCoding); } }
private void addSearchTerm(ResourceTable theEntity, Set<ResourceIndexedSearchParamString> retVal, String resourceName, String searchTerm) { if (isBlank(searchTerm)) { return; } if (searchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) { searchTerm = searchTerm.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); } ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(getModelConfig(), resourceName, StringNormalizer.normalizeString(searchTerm), searchTerm); nextEntity.setResource(theEntity); retVal.add(nextEntity); }
Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) { for (Object nextObject : extractValues(nextPath, theResource)) { addStringParam(theEntity, retVal, nextSpDef, nextValue.getType().getText()); } else if (nextObject instanceof BoundCodeDt) { BoundCodeDt<?> obj = (BoundCodeDt<?>) nextObject; String system = extractSystem(obj); String code = obj.getValue(); if (isNotBlank(code)) { } else if (nextObject instanceof CodingDt) { CodingDt nextValue = (CodingDt) nextObject; extractTokensFromCoding(systems, codes, theEntity, retVal, nextSpDef, nextValue); } else if (nextObject instanceof CodeableConceptDt) { CodeableConceptDt nextCC = (CodeableConceptDt) nextObject; if (!nextCC.getTextElement().isEmpty()) { addStringParam(theEntity, retVal, nextSpDef, nextCC.getTextElement().getValue()); extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef); } else if (nextObject instanceof RestSecurity) { extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef);
String resourceName = getContext().getResourceDefinition(theResource).getName(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.STRING) { Questionnaire q = (Questionnaire) theResource; String title = q.getGroup().getTitle(); addSearchTerm(theEntity, retVal, nextSpName, title); for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IDatatype) nextObject).isEmpty()) { continue; IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject; String searchTerm = nextValue.getValueAsString(); addSearchTerm(theEntity, retVal, nextSpName, searchTerm); } else { if (nextObject instanceof BaseHumanNameDt) { allNames.addAll(nextHumanName.getGiven()); for (StringDt nextName : allNames) { addSearchTerm(theEntity, retVal, nextSpName, nextName.getValue()); allNames.add(nextAddress.getPostalCodeElement()); for (StringDt nextName : allNames) { addSearchTerm(theEntity, retVal, nextSpName, nextName.getValue()); addSearchTerm(theEntity, retVal, nextSpName, nextContact.getValue());
HashSet<ResourceIndexedSearchParamUri> retVal = new HashSet<ResourceIndexedSearchParamUri>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.URI) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IDatatype) nextObject).isEmpty()) { continue;
@Override protected List<Object> extractValues(String thePaths, IBaseResource theResource) { List<Object> values = new ArrayList<>(); String[] nextPathsSplit = SPLIT.split(thePaths); FhirTerser t = getContext().newTerser(); for (String nextPath : nextPathsSplit) { String nextPathTrimmed = nextPath.trim(); List<Object> allValues; try { allValues = t.getValues(theResource, nextPathTrimmed); } catch (Exception e) { String msg = getContext().getLocalizer().getMessage(BaseSearchParamExtractor.class, "failedToExtractPaths", nextPath, e.toString()); throw new InternalErrorException(msg, e); } for (Object next : allValues) { if (next instanceof IBaseExtension) { IBaseDatatype value = ((IBaseExtension) next).getValue(); if (value != null) { values.add(value); } } else { values.add(next); } } } return values; }
private void extractTokensFromCoding(List<String> theSystems, List<String> theCodes, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef, CodingDt nextCoding) { if (nextCoding != null && !nextCoding.isEmpty()) { String nextSystem = nextCoding.getSystemElement().getValueAsString(); String nextCode = nextCoding.getCodeElement().getValue(); if (isNotBlank(nextSystem) || isNotBlank(nextCode)) { theSystems.add(nextSystem); theCodes.add(nextCode); } if (!nextCoding.getDisplayElement().isEmpty()) { addStringParam(theEntity, theListToPopulate, theParameterDef, nextCoding.getDisplayElement().getValue()); } } }
HashSet<ResourceIndexedSearchParamQuantity> retVal = new HashSet<ResourceIndexedSearchParamQuantity>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.QUANTITY) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IDatatype) nextObject).isEmpty()) { continue;
HashSet<ResourceIndexedSearchParamDate> retVal = new HashSet<>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.DATE) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null) { continue;
private void addStringParam(ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> retVal, RuntimeSearchParam nextSpDef, String value) { if (value.length() > ResourceIndexedSearchParamString.MAX_LENGTH) { value = value.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); } ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(getModelConfig(), nextSpDef.getName(), StringNormalizer.normalizeString(value), value); nextEntity.setResource(theEntity); retVal.add(nextEntity); }
@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorDstu2 searchParamExtractor() { return new SearchParamExtractorDstu2(); }
HashSet<ResourceIndexedSearchParamNumber> retVal = new HashSet<ResourceIndexedSearchParamNumber>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.NUMBER) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IDatatype) nextObject).isEmpty()) { continue;