private void extractResourceLinks(ResourceIndexedSearchParams theParams, ResourceTable theEntity, IBaseResource theResource, Date theUpdateTime, IResourceLinkResolver theResourceLinkResolver, String theResourceType, RuntimeSearchParam nextSpDef, boolean theFailOnInvalidReference) { if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.REFERENCE) { return; } String nextPathsUnsplit = nextSpDef.getPath(); if (isBlank(nextPathsUnsplit)) { return; } boolean multiType = false; if (nextPathsUnsplit.endsWith("[x]")) { multiType = true; } List<PathAndRef> refs = mySearchParamExtractor.extractResourceLinks(theResource, nextSpDef); for (PathAndRef nextPathAndRef : refs) { extractResourceLinks(theParams, theEntity, theUpdateTime, theResourceLinkResolver, theResourceType, nextSpDef, nextPathsUnsplit, multiType, nextPathAndRef, theFailOnInvalidReference); } }
public void extractResourceLinks(ResourceIndexedSearchParams theParams, ResourceTable theEntity, IBaseResource theResource, Date theUpdateTime, IResourceLinkResolver theResourceLinkResolver, boolean theFailOnInvalidReference) { String resourceType = theEntity.getResourceType(); /* * For now we don't try to load any of the links in a bundle if it's the actual bundle we're storing.. */ if (theResource instanceof IBaseBundle) { return; } Map<String, RuntimeSearchParam> searchParams = mySearchParamRegistry.getActiveSearchParams(toResourceName(theResource.getClass())); for (RuntimeSearchParam nextSpDef : searchParams.values()) { extractResourceLinks(theParams, theEntity, theResource, theUpdateTime, theResourceLinkResolver, resourceType, nextSpDef, theFailOnInvalidReference); } theEntity.setHasLinks(theParams.links.size() > 0); }
ResourceLink resourceLink = createResourceLink(theEntity, theUpdateTime, theResourceLinkResolver, nextSpDef, theNextPathsUnsplit, nextPathAndRef, nextId, typeString, type, id); if (resourceLink == null) return; theParams.links.add(resourceLink);
public void populateFromResource(ResourceIndexedSearchParams theParams, IDao theCallingDao, Date theUpdateTime, ResourceTable theEntity, IBaseResource theResource, ResourceIndexedSearchParams existingParams) { mySearchParamExtractorService.extractFromResource(theParams, theEntity, theResource); Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet(); if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) { theParams.findMissingSearchParams(myDaoConfig.getModelConfig(), theEntity, activeSearchParams); } theParams.setUpdatedTime(theUpdateTime); extractInlineReferences(theResource); myResourceLinkExtractor.extractResourceLinks(theParams, theEntity, theResource, theUpdateTime, myDaoResourceLinkResolver, true); /* * If the existing resource already has links and those match links we still want, use them instead of removing them and re adding them */ for (Iterator<ResourceLink> existingLinkIter = existingParams.getResourceLinks().iterator(); existingLinkIter.hasNext(); ) { ResourceLink nextExisting = existingLinkIter.next(); if (theParams.links.remove(nextExisting)) { existingLinkIter.remove(); theParams.links.add(nextExisting); } } /* * Handle composites */ extractCompositeStringUniques(theEntity, theParams); }
SubscriptionMatchResult match(String criteria, IBaseResource resource) { ResourceTable entity = new ResourceTable(); String resourceType = myContext.getResourceDefinition(resource).getName(); entity.setResourceType(resourceType); ResourceIndexedSearchParams searchParams = new ResourceIndexedSearchParams(); mySearchParamExtractorService.extractFromResource(searchParams, entity, resource); myResourceLinkExtractor.extractResourceLinks(searchParams, entity, resource, resource.getMeta().getLastUpdated(), myInlineResourceLinkResolver, false); return myCriteriaResourceMatcher.match(criteria, resource, searchParams); } }
public void populateFromResource(ResourceIndexedSearchParams theParams, IDao theCallingDao, Date theUpdateTime, ResourceTable theEntity, IBaseResource theResource, ResourceIndexedSearchParams existingParams) { mySearchParamExtractorService.extractFromResource(theParams, theEntity, theResource); Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet(); if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) { theParams.findMissingSearchParams(myDaoConfig.getModelConfig(), theEntity, activeSearchParams); } theParams.setUpdatedTime(theUpdateTime); extractInlineReferences(theResource); myResourceLinkExtractor.extractResourceLinks(theParams, theEntity, theResource, theUpdateTime, myDaoResourceLinkResolver, true); /* * If the existing resource already has links and those match links we still want, use them instead of removing them and re adding them */ for (Iterator<ResourceLink> existingLinkIter = existingParams.getResourceLinks().iterator(); existingLinkIter.hasNext(); ) { ResourceLink nextExisting = existingLinkIter.next(); if (theParams.links.remove(nextExisting)) { existingLinkIter.remove(); theParams.links.add(nextExisting); } } /* * Handle composites */ extractCompositeStringUniques(theEntity, theParams); }