Tabnine Logo
QualifiedParamList
Code IndexAdd Tabnine to your IDE (free)

How to use
QualifiedParamList
in
ca.uhn.fhir.rest.api

Best Java code snippets using ca.uhn.fhir.rest.api.QualifiedParamList (Showing top 20 results out of 315)

origin: jamesagnew/hapi-fhir

  @Override
  public void setValuesAsQueryTokens(FhirContext theContext, String theParamName,
      QualifiedParamList theParameters) {
    if (theParameters.isEmpty()) {
      return;
    }
    if (theParameters.size() > 1) {
      throw new IllegalArgumentException(
          "Type " + theParam.getClass().getCanonicalName() + " does not support multiple values");
    }
    theParam.setValueAsQueryToken(theContext, theParamName, theParameters.getQualifier(),
        theParameters.get(0));
  }
};
origin: jamesagnew/hapi-fhir

private void parseParams(RequestDetails theRequest, List<QualifiedParamList> paramList, String theQualifiedParamName, String theQualifier) {
  QualifierDetails qualifiers = QualifierDetails.extractQualifiersFromParameterName(theQualifier);
  if (!qualifiers.passes(getQualifierWhitelist(), getQualifierBlacklist())) {
    return;
  }
  String[] value = theRequest.getParameters().get(theQualifiedParamName);
  if (value != null) {
    for (String nextParam : value) {
      if (nextParam.contains(",") == false) {
        paramList.add(QualifiedParamList.singleton(theQualifier, nextParam));
      } else {
        paramList.add(QualifiedParamList.splitQueryStringByCommasIgnoreEscape(theQualifier, nextParam));
      }
    }
  }
}
origin: jamesagnew/hapi-fhir

public static QualifiedParamList splitQueryStringByCommasIgnoreEscape(String theQualifier, String theParams) {
  QualifiedParamList retVal = new QualifiedParamList();
  retVal.setQualifier(theQualifier);
        if (countTrailingSlashes(prev) % 2 == 1) {
          int idx = retVal.size() - 1;
          String existing = retVal.get(idx);
          prev = existing.substring(0, existing.length() - 1) + ',';
          retVal.set(idx, prev);
        } else {
          prev = null;
      int idx = retVal.size() - 1;
      String existing = retVal.get(idx);
      prev = existing + str;
      retVal.set(idx, prev);
    } else {
      retVal.add(str);
      prev = str;
origin: jamesagnew/hapi-fhir

public static QualifiedParamList singleton(String theQualifier, String theParamValue) {
  QualifiedParamList retVal = new QualifiedParamList(1);
  retVal.setQualifier(theQualifier);
  retVal.add(theParamValue);
  return retVal;
}
origin: jamesagnew/hapi-fhir

@Override
public T parse(FhirContext theContext, String theName, List<QualifiedParamList> theParams) throws InternalErrorException, InvalidRequestException {
  if (theParams.size() == 0 || theParams.get(0).size() == 0) {
    return null;
  }
  if (theParams.size() > 1 || theParams.get(0).size() > 1) {
    throw new InvalidRequestException("Multiple values detected for non-repeatable parameter '" + theName + "'. This server is not configured to allow multiple (AND) values for this param.");
  }

  T value = doParse(theParams.get(0).get(0));
  return value;
}
origin: jamesagnew/hapi-fhir

@Override
public IQueryParameterType parse(FhirContext theContext, String theParamName, List<QualifiedParamList> theParams) throws InternalErrorException, InvalidRequestException {
  String value = theParams.get(0).get(0);
  if (StringUtils.isBlank(value)) {
    return null;
  }
  
  IQueryParameterType dt = super.newInstance();
  if (theParams.size() == 0 || theParams.get(0).size() == 0) {
    return dt;
  }
  if (theParams.size() > 1 || theParams.get(0).size() > 1) {
    throw new InvalidRequestException("Multiple values detected for non-repeatable parameter '" + theParamName + "'. This server is not configured to allow multiple (AND/OR) values for this param.");
  }
  dt.setValueAsQueryToken(theContext, theParamName, theParams.get(0).getQualifier(), value);
  return dt;
}
origin: jamesagnew/hapi-fhir

QualifiedParamList paramList = QualifiedParamList.splitQueryStringByCommasIgnoreEscape(qualifier, next.getValue());
nameToParamLists.put(paramName, paramList);
  if (paramList.size() > 0 && paramList.get(0).size() > 0) {
    String intString = paramList.get(0).get(0);
    try {
      paramMap.setCount(Integer.parseInt(intString));
  if (isNotBlank(paramList.get(0).getQualifier()) && paramList.get(0).getQualifier().startsWith(".")) {
    throw new InvalidRequestException("Invalid parameter chain: " + nextParamName + paramList.get(0).getQualifier());
origin: jamesagnew/hapi-fhir

@Override
public Object incomingServer(Object theObject) {
  IPrimitiveType<?> obj = (IPrimitiveType<?>) theObject;
  List<QualifiedParamList> paramList = Collections.singletonList(QualifiedParamList.splitQueryStringByCommasIgnoreEscape(null, obj.getValueAsString()));
  return mySearchParameterBinding.parse(myContext, paramList);
}
origin: jamesagnew/hapi-fhir

public static QualifiedParamList singleton(String theParamValue) {
  return singleton(null, theParamValue);
}
origin: jamesagnew/hapi-fhir

@Override
public void setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters) {
  myList.clear();
  for (String next : theParameters) {
    PT nextParam = newInstance();
    nextParam.setValueAsQueryToken(theContext, theParamName, theParameters.getQualifier(), next);
    myList.add(nextParam);
  }
}
origin: jamesagnew/hapi-fhir

@Override
public List<QualifiedParamList> encode(FhirContext theContext, Object theObject) throws InternalErrorException {
  ArrayList<QualifiedParamList> retVal = new ArrayList<QualifiedParamList>();
  // TODO: declaring method should probably have a generic type..
  @SuppressWarnings("rawtypes")
  IParamBinder paramBinder = myParamBinder;
  @SuppressWarnings("unchecked")
  List<IQueryParameterOr<?>> val = paramBinder.encode(theContext, theObject);
  for (IQueryParameterOr<?> nextOr : val) {
    retVal.add(new QualifiedParamList(nextOr, theContext));
  }
  return retVal;
}
origin: jamesagnew/hapi-fhir

  @Override
  public IQueryParameterOr<?> parse(FhirContext theContext, String theParamName, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException {
    IQueryParameterOr<?> dt;
    try {
      dt = newInstance();
      if (theString.size() == 0 || theString.get(0).size() == 0) {
        return dt;
      }
      if (theString.size() > 1) {
        throw new InvalidRequestException("Multiple values detected for non-repeatable parameter '" + theParamName + "'. This server is not configured to allow multiple (AND/OR) values for this param.");
      }
      
      dt.setValuesAsQueryTokens(theContext, theParamName, theString.get(0));
    } catch (SecurityException e) {
      throw new InternalErrorException(e);
    }
    return dt;
  }
}
origin: jamesagnew/hapi-fhir

@Override
public void setValuesAsQueryTokens(FhirContext theContext, String theParamName, List<QualifiedParamList> theParameters)
  throws InvalidRequestException {
  boolean haveHadUnqualifiedParameter = false;
  for (QualifiedParamList paramList : theParameters) {
    if (paramList.size() == 0) {
      continue;
    }
    if (paramList.size() > 1) {
      throw new InvalidRequestException("DateRange parameter does not suppport OR queries");
    }
    String param = paramList.get(0);
    /*
     * Since ' ' is escaped as '+' we'll be nice to anyone might have accidentally not
     * escaped theirs
     */
    param = param.replace(' ', '+');
    DateParam parsed = new DateParam();
    parsed.setValueAsQueryToken(theContext, theParamName, paramList.getQualifier(), param);
    addParam(parsed);
    if (parsed.getPrefix() == null) {
      if (haveHadUnqualifiedParameter) {
        throw new InvalidRequestException("Multiple date parameters with the same name and no qualifier (>, <, etc.) is not supported");
      }
      haveHadUnqualifiedParameter = true;
    }
  }
}
origin: jamesagnew/hapi-fhir

@Override
public void  setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters) {
  setMissing(null);
  setPrefix(null);
  setValueAsString(null);
  
  if (theParameters.size() == 1) {
    setValueAsString(theParameters.get(0));
  } else if (theParameters.size() > 1) {
    throw new InvalidRequestException("This server does not support multi-valued dates for this parameter: " + theParameters);
  }
  
}
origin: jamesagnew/hapi-fhir

@Override
public Object incomingServer(Object theObject) {
  IPrimitiveType<?> obj = (IPrimitiveType<?>) theObject;
  List<QualifiedParamList> paramList = Collections.singletonList(QualifiedParamList.splitQueryStringByCommasIgnoreEscape(null, obj.getValueAsString()));
  return mySearchParameterBinding.parse(myContext, paramList);
}
origin: jamesagnew/hapi-fhir

private void convertAndAddIncludeToList(ArrayList<QualifiedParamList> retVal, Include include) {
  String qualifier = include.isRecurse() ? Constants.PARAM_INCLUDE_QUALIFIER_RECURSE : null;
  retVal.add(QualifiedParamList.singleton(qualifier, include.getValue()));
}
origin: jamesagnew/hapi-fhir

@Override
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException {
  if (theSourceClientArgument == null) {
    if (isRequired()) {
      throw new NullPointerException("SearchParameter '" + getName() + "' is required and may not be null");
    }
  } else {
    List<QualifiedParamList> value = encode(theContext, theSourceClientArgument);
    for (QualifiedParamList nextParamEntry : value) {
      StringBuilder b = new StringBuilder();
      for (String str : nextParamEntry) {
        if (b.length() > 0) {
          b.append(",");
        }
        b.append(str);
      }
      String qualifier = nextParamEntry.getQualifier();
      String paramName = isNotBlank(qualifier) ? getName() + qualifier : getName();
      List<String> paramValues = theTargetQueryArguments.get(paramName);
      if (paramValues == null) {
        paramValues = new ArrayList<>(value.size());
        theTargetQueryArguments.put(paramName, paramValues);
      }
      paramValues.add(b.toString());
    }
  }
}
origin: ca.uhn.hapi.fhir/hapi-fhir-base

public static QualifiedParamList singleton(String theQualifier, String theParamValue) {
  QualifiedParamList retVal = new QualifiedParamList(1);
  retVal.setQualifier(theQualifier);
  retVal.add(theParamValue);
  return retVal;
}
origin: jamesagnew/hapi-fhir

@Override
public List<QualifiedParamList> encode(FhirContext theContext, Object theObject) throws InternalErrorException {
  ArrayList<QualifiedParamList> retVal = new ArrayList<>();
  // TODO: declaring method should probably have a generic type..
  @SuppressWarnings("rawtypes")
  IParamBinder paramBinder = myParamBinder;
  @SuppressWarnings("unchecked")
  List<IQueryParameterOr<?>> val = paramBinder.encode(theContext, theObject);
  for (IQueryParameterOr<?> nextOr : val) {
    retVal.add(new QualifiedParamList(nextOr, theContext));
  }
  return retVal;
}
origin: ca.uhn.hapi.fhir/hapi-fhir-base

  @Override
  public IQueryParameterOr<?> parse(FhirContext theContext, String theParamName, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException {
    IQueryParameterOr<?> dt;
    try {
      dt = newInstance();
      if (theString.size() == 0 || theString.get(0).size() == 0) {
        return dt;
      }
      if (theString.size() > 1) {
        throw new InvalidRequestException("Multiple values detected for non-repeatable parameter '" + theParamName + "'. This server is not configured to allow multiple (AND/OR) values for this param.");
      }
      
      dt.setValuesAsQueryTokens(theContext, theParamName, theString.get(0));
    } catch (SecurityException e) {
      throw new InternalErrorException(e);
    }
    return dt;
  }
}
ca.uhn.fhir.rest.apiQualifiedParamList

Most used methods

  • get
  • getQualifier
  • size
  • splitQueryStringByCommasIgnoreEscape
  • <init>
  • isEmpty
  • singleton
  • add
  • countTrailingSlashes
  • set
  • setQualifier
  • setQualifier

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now