@Override public IQuery withTag(String theSystem, String theCode) { Validate.notBlank(theCode, "theCode must not be null or empty"); myTags.add(new TokenParam(theSystem, theCode)); return this; }
@Override public IQuery withSecurity(String theSystem, String theCode) { Validate.notBlank(theCode, "theCode must not be null or empty"); mySecurity.add(new TokenParam(theSystem, theCode)); return this; }
/** * Add a new token to this list * @param theSystem * The system to use for the one token to pre-populate in this list */ public TokenOrListParam add(String theSystem, String theValue) { add(new TokenParam(theSystem, theValue)); return this; }
/** * Convenience method which adds a token to this OR list using the system and code from a coding */ public void add(BaseCodingDt theCodingDt) { add(new TokenParam(theCodingDt)); }
/** * Convenience method which adds a token to this OR list using the system and value from an identifier */ public void add(BaseIdentifierDt theIdentifierDt) { add(new TokenParam(theIdentifierDt)); }
@CoverageIgnore @Override TokenParam newInstance() { return new TokenParam(); }
@Override public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem) { List<IIdType> valueSetIds; Set<Long> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode))); valueSetIds = new ArrayList<>(); for (Long next : ids) { valueSetIds.add(new IdType("CodeSystem", next)); } return valueSetIds; }
@Override public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem) { List<IIdType> valueSetIds; Set<Long> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode))); valueSetIds = new ArrayList<>(); for (Long next : ids) { valueSetIds.add(new IdType("CodeSystem", next)); } return valueSetIds; }
@Override public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem) { if (theSystem != null && theSystem.startsWith("http://hl7.org/fhir/")) { return Collections.singletonList((IIdType) new IdDt(theSystem)); } List<IIdType> valueSetIds; Set<Long> ids = searchForIds(new SearchParameterMap(ValueSet.SP_CODE, new TokenParam(theSystem, theCode))); valueSetIds = new ArrayList<IIdType>(); for (Long next : ids) { valueSetIds.add(new IdDt("ValueSet", next)); } return valueSetIds; }
@Override public IQueryParameterType toQueryParameterType() { return new TokenParam(getSystem(), getValue()); }
/** * Returns a new param containing the same value as this param, but with the type copnverted * to {@link TokenParam}. This is useful if you are using reference parameters and want to handle * chained parameters of different types in a single method. * <p> * See <a href="http://jamesagnew.github.io/hapi-fhir/doc_rest_operations.html#dynamic_chains">Dynamic Chains</a> * in the HAPI FHIR documentation for an example of how to use this method. * </p> */ public TokenParam toTokenParam(FhirContext theContext) { TokenParam retVal = new TokenParam(); retVal.setValueAsQueryToken(theContext, null, null, getValueAsQueryToken(theContext)); return retVal; } }
private int doSyncSubscriptions() { synchronized (mySyncSubscriptionsLock) { ourLog.debug("Starting sync subscriptions"); SearchParameterMap map = new SearchParameterMap(); map.add(Subscription.SP_STATUS, new TokenOrListParam() // TODO KHS perhaps we should only be requesting ACTIVE subscriptions here?... .addOr(new TokenParam(null, Subscription.SubscriptionStatus.REQUESTED.toCode())) .addOr(new TokenParam(null, Subscription.SubscriptionStatus.ACTIVE.toCode()))); map.setLoadSynchronousUpTo(SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS); IBundleProvider subscriptionBundleList = mySubscriptionProvidor.search(map); if (subscriptionBundleList.size() >= SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS) { ourLog.error("Currently over " + SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS + " subscriptions. Some subscriptions have not been loaded."); } List<IBaseResource> resourceList = subscriptionBundleList.getResources(0, subscriptionBundleList.size()); Set<String> allIds = new HashSet<>(); int changesCount = 0; for (IBaseResource resource : resourceList) { String nextId = resource.getIdElement().getIdPart(); allIds.add(nextId); boolean changed = mySubscriptionProvidor.loadSubscription(resource); if (changed) { changesCount++; } } mySubscriptionRegistry.unregisterAllSubscriptionsNotInCollection(allIds); ourLog.debug("Finished sync subscriptions - found {}", resourceList.size()); return changesCount; } }
break; case TOKEN: qp = new TokenParam(); break; case COMPOSITE:
valueSetIds = Collections.singletonList(theId); } else if (haveIdentifierParam) { Set<Long> ids = searchForIds(new SearchParameterMap(ValueSet.SP_IDENTIFIER, new TokenParam(null, theValueSetIdentifier.getValue()))); valueSetIds = new ArrayList<IIdType>(); for (Long next : ids) {
search = myStructureDefinitionDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ca.uhn.fhir.model.dstu2.resource.StructureDefinition.SP_URL, new UriParam(theUri))); } else if ("Questionnaire".equals(resourceName)) { search = myQuestionnaireDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Questionnaire.SP_RES_ID, new TokenParam(null, theUri))); } else { throw new IllegalArgumentException("Can't fetch resource type: " + resourceName); if ("ValueSet".equals(resourceName)) { SearchParameterMap params = new SearchParameterMap(); params.add(ca.uhn.fhir.model.dstu2.resource.ValueSet.SP_RES_ID, new TokenParam(null, uriAsId.toUnqualifiedVersionless().getValue())); params.setLoadSynchronousUpTo(10); search = myValueSetDao.search(params);
/** * Convenience method which adds a token to this OR list using the system and code from a coding */ public void add(BaseCodingDt theCodingDt) { add(new TokenParam(theCodingDt)); }
@CoverageIgnore @Override TokenParam newInstance() { return new TokenParam(); }
/** * Add a new token to this list * @param theSystem * The system to use for the one token to pre-populate in this list */ public TokenOrListParam add(String theSystem, String theValue) { add(new TokenParam(theSystem, theValue)); return this; }
break; case TOKEN: param = new TokenParam(null, value); break; case REFERENCE:
@Override public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem) { List<IIdType> valueSetIds; Set<Long> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode))); valueSetIds = new ArrayList<>(); for (Long next : ids) { valueSetIds.add(new IdType("CodeSystem", next)); } return valueSetIds; }