@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorR4 searchParamExtractor() { return new SearchParamExtractorR4(); }
private void extractTokensFromCodeableConcept(List<String> theSystems, List<String> theCodes, CodeableConcept theCodeableConcept, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef) { for (Coding nextCoding : theCodeableConcept.getCoding()) { extractTokensFromCoding(theSystems, theCodes, theEntity, theListToPopulate, theParameterDef, nextCoding); } }
@Override public List<PathAndRef> extractResourceLinks(IBaseResource theResource, RuntimeSearchParam theNextSpDef) { ArrayList<PathAndRef> retVal = new ArrayList<>(); String[] nextPathsSplit = SPLIT_R4.split(theNextSpDef.getPath()); for (String path : nextPathsSplit) { path = path.trim(); if (isNotBlank(path)) { for (Object next : extractValues(path, theResource)) { retVal.add(new PathAndRef(path, next)); } } } return retVal; }
Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) { List<String> codes = new ArrayList<>(); for (Object nextObject : extractValues(nextPath, theResource)) { addStringParam(theEntity, retVal, nextSpDef, nextValue.getType().getText()); } else if (nextObject instanceof Enumeration<?>) { Enumeration<?> obj = (Enumeration<?>) nextObject; String system = extractSystem(obj); String code = obj.getValueAsString(); if (isNotBlank(code)) { } else if (nextObject instanceof Coding) { Coding nextValue = (Coding) nextObject; extractTokensFromCoding(systems, codes, theEntity, retVal, nextSpDef, nextValue); } else if (nextObject instanceof CodeableConcept) { CodeableConcept nextCC = (CodeableConcept) nextObject; if (!nextCC.getTextElement().isEmpty()) { addStringParam(theEntity, retVal, nextSpDef, nextCC.getTextElement().getValue()); extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef); } else if (nextObject instanceof CapabilityStatementRestSecurityComponent) { 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) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IBase) nextObject).isEmpty()) { continue; IPrimitiveType<?> nextValue = (IPrimitiveType<?>) nextObject; String searchTerm = nextValue.getValueAsString(); addSearchTerm(theEntity, retVal, nextSpName, searchTerm); } else { if (nextObject instanceof HumanName) { addSearchTerm(theEntity, retVal, nextSpName, nextName.getValue()); allNames.add(nextAddress.getPostalCodeElement()); for (StringType nextName : allNames) { addSearchTerm(theEntity, retVal, nextSpName, nextName.getValue()); addSearchTerm(theEntity, retVal, nextSpName, nextContact.getValue()); addSearchTerm(theEntity, retVal, nextSpName, value.toPlainString()); BigDecimal value = low.getValue(); if (value != null) { addSearchTerm(theEntity, retVal, nextSpName, value.toPlainString());
HashSet<ResourceIndexedSearchParamQuantity> retVal = new HashSet<>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.QUANTITY) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IBase) nextObject).isEmpty()) { continue; addQuantity(theEntity, retVal, resourceName, nextValue); } else if (nextObject instanceof Range) { Range nextValue = (Range) nextObject; addQuantity(theEntity, retVal, resourceName, nextValue.getLow()); addQuantity(theEntity, retVal, resourceName, nextValue.getHigh()); } else if (nextObject instanceof LocationPositionComponent) { continue;
HashSet<ResourceIndexedSearchParamUri> retVal = new HashSet<>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.URI) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IBase) nextObject).isEmpty()) { continue;
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); }
private void extractTokensFromCoding(List<String> theSystems, List<String> theCodes, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef, Coding 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()); } } }
IWorkerContext worker = new org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext(getContext(), myValidationSupport); FHIRPathEngine fp = new FHIRPathEngine(worker); fp.setHostServices(new SearchParamExtractorR4HostServices()); allValues = fp.evaluate((Base) theResource, nextPath); } catch (FHIRException e) { String msg = getContext().getLocalizer().getMessage(BaseSearchParamExtractor.class, "failedToExtractPaths", nextPath, e.toString()); throw new InternalErrorException(msg, e);
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 SearchParamExtractorR4 searchParamExtractor() { return new SearchParamExtractorR4(); }
HashSet<ResourceIndexedSearchParamNumber> retVal = new HashSet<>(); Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource); for (RuntimeSearchParam nextSpDef : searchParams) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.NUMBER) { for (Object nextObject : extractValues(nextPath, theResource)) { if (nextObject == null || ((IBase) nextObject).isEmpty()) { continue;
@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorR4 searchParamExtractor() { return new SearchParamExtractorR4(); }