@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorDstu3 searchParamExtractor() { return new SearchParamExtractorDstu3(); }
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<PathAndRef>(); String[] nextPathsSplit = SPLIT.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) { 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<ResourceIndexedSearchParamQuantity>(); 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<ResourceIndexedSearchParamUri>(); 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); }
@PostConstruct public void start() { myWorkerContext = new HapiWorkerContext(getContext(), myValidationSupport); }
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()); } } }
String resourceType = theEntity.getResourceType(); 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); }
/** * Override parent because we're using FHIRPath here */ @Override protected List<Object> extractValues(String thePaths, IBaseResource theResource) { FHIRPathEngine fp = new FHIRPathEngine(myWorkerContext); List<Object> values = new ArrayList<>(); String[] nextPathsSplit = SPLIT.split(thePaths); for (String nextPath : nextPathsSplit) { List<Base> allValues; try { allValues = fp.evaluate((Base) theResource, trim(nextPath)); } catch (FHIRException e) { String msg = getContext().getLocalizer().getMessage(BaseSearchParamExtractor.class, "failedToExtractPaths", nextPath, e.toString()); throw new InternalErrorException(msg, e); } if (allValues.isEmpty() == false) { values.addAll(allValues); } } for (int i = 0; i < values.size(); i++) { Object nextObject = values.get(i); if (nextObject instanceof Extension) { Extension nextExtension = (Extension) nextObject; nextObject = nextExtension.getValue(); values.set(i, nextObject); } } return values; }
@Bean(autowire = Autowire.BY_TYPE) public SearchParamExtractorDstu3 searchParamExtractor() { return new SearchParamExtractorDstu3(); }
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 SearchParamExtractorDstu3 searchParamExtractor() { return new SearchParamExtractorDstu3(); }