/** * {@inheritDoc} */ @Override String doGetValueAsQueryToken(FhirContext theContext) { if (getSystem() != null) { if (getValue() != null) { return ParameterUtil.escape(StringUtils.defaultString(getSystem())) + '|' + ParameterUtil.escape(getValue()); } else { return ParameterUtil.escape(StringUtils.defaultString(getSystem())) + '|'; } } return ParameterUtil.escape(getValue()); }
@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; }
if (nextOrParams instanceof TokenParam) { TokenParam param = (TokenParam) nextOrParams; if (param.getModifier() == TokenParamModifier.NOT) { if (isNotBlank(param.getSystem()) || isNotBlank(param.getValue())) { notTags.add(Pair.of(param.getSystem(), param.getValue())); if (nextParamUncasted instanceof TokenParam) { TokenParam nextParam = (TokenParam) nextParamUncasted; if (isNotBlank(nextParam.getValue())) { haveTags = true; } else if (isNotBlank(nextParam.getSystem())) { throw new InvalidRequestException("Invalid " + theParamName + " parameter (must supply a value/code and not just a system): " + nextParam.getValueAsQueryToken(myContext)); if (nextOrParams instanceof TokenParam) { TokenParam nextParam = (TokenParam) nextOrParams; code = nextParam.getValue(); system = nextParam.getSystem(); if (nextParam.getModifier() == TokenParamModifier.NOT) { paramInverted = true;
@Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); builder.append("system", defaultString(getSystem())); if (myModifier != null) { builder.append(":" + myModifier.getValue()); } builder.append("value", getValue()); if (getMissing() != null) { builder.append(":missing", getMissing()); } return builder.toString(); }
/** * 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; } }
if (theParameter instanceof TokenParam) { TokenParam id = (TokenParam) theParameter; system = id.getSystem(); code = (id.getValue()); modifier = id.getModifier(); } else if (theParameter instanceof BaseIdentifierDt) { BaseIdentifierDt id = (BaseIdentifierDt) theParameter;
@Override public List<Long> everything(String theResourceName, SearchParameterMap theParams) { Long pid = null; if (theParams.get(IAnyResource.SP_RES_ID) != null) { String idParamValue; IQueryParameterType idParam = theParams.get(IAnyResource.SP_RES_ID).get(0).get(0); if (idParam instanceof TokenParam) { TokenParam idParm = (TokenParam) idParam; idParamValue = idParm.getValue(); } else { StringParam idParm = (StringParam) idParam; idParamValue = idParm.getValue(); } pid = myIdHelperService.translateForcedIdToPid(theResourceName, idParamValue); } Long referencingPid = pid; List<Long> retVal = doSearch(null, theParams, referencingPid); if (referencingPid != null) { retVal.add(referencingPid); } return retVal; }
if (theParameter instanceof TokenParam) { TokenParam id = (TokenParam) theParameter; if (!id.isText()) { throw new IllegalStateException("Trying to process a text search on a non-text token parameter"); rawSearchTerm = id.getValue(); } else if (theParameter instanceof StringParam) { StringParam id = (StringParam) theParameter;
addParam(params, Constants.PARAM_TAG, next.getValueAsQueryToken(myContext)); addParam(params, Constants.PARAM_SECURITY, next.getValueAsQueryToken(myContext));
@Override String doGetQueryParameterQualifier() { if (getModifier() != null) { return getModifier().getValue(); } return null; }
if (theParameter instanceof TokenParam) { TokenParam id = (TokenParam) theParameter; system = id.getSystem(); code = (id.getValue()); modifier = id.getModifier(); } else if (theParameter instanceof BaseIdentifierDt) { BaseIdentifierDt id = (BaseIdentifierDt) theParameter;
@Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); builder.append("system", defaultString(getSystem())); if (myModifier != null) { builder.append(":" + myModifier.getValue()); } builder.append("value", getValue()); if (getMissing() != null) { builder.append(":missing", getMissing()); } return builder.toString(); }
@Search public List<IBaseResource> searchById( @RequiredParam(name = "_id") TokenAndListParam theIds) { List<IBaseResource> retVal = new ArrayList<>(); for (TreeMap<Long, T> next : myIdToVersionToResourceMap.values()) { if (next.isEmpty() == false) { T nextResource = next.lastEntry().getValue(); boolean matches = true; if (theIds != null && theIds.getValuesAsQueryTokens().size() > 0) { for (TokenOrListParam nextIdAnd : theIds.getValuesAsQueryTokens()) { matches = false; for (TokenParam nextOr : nextIdAnd.getValuesAsQueryTokens()) { if (nextOr.getValue().equals(nextResource.getIdElement().getIdPart())) { matches = true; } } if (!matches) { break; } } } if (!matches) { continue; } retVal.add(nextResource); } } mySearchCount.incrementAndGet(); return retVal; }
if (theParameter instanceof TokenParam) { TokenParam id = (TokenParam) theParameter; if (!id.isText()) { throw new IllegalStateException("Trying to process a text search on a non-text token parameter"); rawSearchTerm = id.getValue(); } else if (theParameter instanceof StringParam) { StringParam id = (StringParam) theParameter;
dataset.getPatientIds().addAll( tokenParams.stream() .map(t -> t.getValueAsQueryToken(searchParameter.getFhirContext())) .collect(Collectors.toList()));
/** * 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; } }
@Override String doGetQueryParameterQualifier() { if (getModifier() != null) { return getModifier().getValue(); } return null; }
@Search() public List<Patient> searchByIdentifier(@RequiredParam(name=Patient.SP_IDENTIFIER) TokenParam theId) { String identifierSystem = theId.getSystem(); String identifier = theId.getValue(); List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchIdentifierParam
if (nextOrParams instanceof TokenParam) { TokenParam param = (TokenParam) nextOrParams; if (param.getModifier() == TokenParamModifier.NOT) { if (isNotBlank(param.getSystem()) || isNotBlank(param.getValue())) { notTags.add(Pair.of(param.getSystem(), param.getValue())); if (nextParamUncasted instanceof TokenParam) { TokenParam nextParam = (TokenParam) nextParamUncasted; if (isNotBlank(nextParam.getValue())) { haveTags = true; } else if (isNotBlank(nextParam.getSystem())) { throw new InvalidRequestException("Invalid " + theParamName + " parameter (must supply a value/code and not just a system): " + nextParam.getValueAsQueryToken(myContext)); if (nextOrParams instanceof TokenParam) { TokenParam nextParam = (TokenParam) nextOrParams; code = nextParam.getValue(); system = nextParam.getSystem(); if (nextParam.getModifier() == TokenParamModifier.NOT) { paramInverted = true;
@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; }