@Override public Object parse(FhirContext theContext, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { return myParamBinder.parse(theContext, getName(), theString); }
@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; }
throw new UnsupportedOperationException(); case DATE: binder = new QueryParameterAndBinder(DateAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case NUMBER: binder = new QueryParameterAndBinder(NumberAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case QUANTITY: binder = new QueryParameterAndBinder(QuantityAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case REFERENCE: binder = new QueryParameterAndBinder(ReferenceAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case STRING: binder = new QueryParameterAndBinder(StringAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case TOKEN: binder = new QueryParameterAndBinder(TokenAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break; case URI: binder = new QueryParameterAndBinder(UriAndListParam.class, Collections.<Class<? extends IQueryParameterType>> emptyList()); break;
myParamBinder = new QueryParameterTypeBinder((Class<? extends IQueryParameterType>) type, myCompositeTypes); } else if (IQueryParameterOr.class.isAssignableFrom(type)) { myParamBinder = new QueryParameterOrBinder((Class<? extends IQueryParameterOr<?>>) type, myCompositeTypes); } else if (IQueryParameterAnd.class.isAssignableFrom(type)) { myParamBinder = new QueryParameterAndBinder((Class<? extends IQueryParameterAnd<?>>) type, myCompositeTypes); } else if (String.class.equals(type)) { myParamBinder = new StringBinder(); myParamType = RestSearchParameterTypeEnum.STRING; } else if (Date.class.equals(type)) { myParamBinder = new DateBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (Calendar.class.equals(type)) { myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;
@Override public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) { if (theOuterCollectionType != null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is of type " + SummaryEnum.class + " but can not be a collection of collections"); } if (theInnerCollectionType != null) { myInnerCollectionType = CollectionBinder.getInstantiableCollectionType(theInnerCollectionType, SummaryEnum.class.getSimpleName()); } }
@Override public IQueryParameterAnd<?> parse(FhirContext theContext, String theParamName, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { IQueryParameterAnd<?> dt; try { dt = newInstance(); dt.setValuesAsQueryTokens(theContext, theParamName, theString); } catch (SecurityException e) { throw new InternalErrorException(e); } return dt; } }
@SuppressWarnings("unchecked") @Override public List<IQueryParameterOr<?>> encode(FhirContext theContext, T theString) throws InternalErrorException { String retVal = doEncode(theString); if (isBlank(retVal)) { return Collections.emptyList(); } List<?> retValList = Collections.singletonList(ParameterUtil.singleton(new StringParam(retVal), null)); return (List<IQueryParameterOr<?>>) retValList; }
@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; }
@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; }
@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; } }
myParamBinder = new QueryParameterTypeBinder((Class<? extends IQueryParameterType>) type, myCompositeTypes); } else if (IQueryParameterOr.class.isAssignableFrom(type)) { myParamBinder = new QueryParameterOrBinder((Class<? extends IQueryParameterOr<?>>) type, myCompositeTypes); } else if (IQueryParameterAnd.class.isAssignableFrom(type)) { myParamBinder = new QueryParameterAndBinder((Class<? extends IQueryParameterAnd<?>>) type, myCompositeTypes); } else if (String.class.equals(type)) { myParamBinder = new StringBinder(); myParamType = RestSearchParameterTypeEnum.STRING; } else if (Date.class.equals(type)) { myParamBinder = new DateBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (Calendar.class.equals(type)) { myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;
@Override public Object parse(FhirContext theContext, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { return myParamBinder.parse(theContext, getName(), theString); }
@Override public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) { if (theOuterCollectionType != null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is of type " + SummaryEnum.class + " but can not be a collection of collections"); } if (theInnerCollectionType != null) { myInnerCollectionType = CollectionBinder.getInstantiableCollectionType(theInnerCollectionType, SummaryEnum.class.getSimpleName()); } }
@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; }
@Override public IQueryParameterAnd<?> parse(FhirContext theContext, String theParamName, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { IQueryParameterAnd<?> dt; try { dt = newInstance(); dt.setValuesAsQueryTokens(theContext, theParamName, theString); } catch (SecurityException e) { throw new InternalErrorException(e); } return dt; } }
@Override public Object parse(FhirContext theContext, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { return myParamBinder.parse(theContext, getName(), theString); }
myInnerCollectionType = CollectionBinder.getInstantiableCollectionType(theInnerCollectionType, myName); if (myMax == OperationParam.MAX_DEFAULT) { myMax = OperationParam.MAX_UNLIMITED;
@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; }
@Override public Object parse(FhirContext theContext, List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException { return myParamBinder.parse(theContext, getName(), theString); }
} else { instantiableCollectionType = (Class<? extends Collection<Include>>) CollectionBinder .getInstantiableCollectionType(innerCollectionType, "Method '" + theMethod.getName() + "'"); specType = parameterType;