Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.ConfigurationException


  }

  @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 annotated with @" + TransactionParam.class.getName() + " but can not be a collection of collections");
    }
    if (theParameterType.equals(Bundle.class)) {
      myParamIsBundle=true;
      if (theInnerCollectionType!=null) {
        throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
            + "> or Bundle");
      }
    } else {
      myParamIsBundle=false;
      if (theInnerCollectionType.equals(List.class) == false) {
        throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
            + "> or Bundle");
      }
      if (theParameterType.equals(IResource.class) == false) {
        throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
            + "> or Bundle");
      }
    }
  }
View Full Code Here


      SearchParameter sp = (SearchParameter) next;
      if (sp.getName().startsWith("_")) {
        if (ALLOWED_PARAMS.contains(sp.getName())) {
          String msg = getContext().getLocalizer().getMessage(getClass().getName() + ".invalidSpecialParamName", theMethod.getName(), theMethod.getDeclaringClass().getSimpleName(),
              sp.getName());
          throw new ConfigurationException(msg);
        }
      }

      // searchParameters.add(sp);
    }
    // for (int i = 0; i < searchParameters.size(); i++) {
    // SearchParameter next = searchParameters.get(i);
    // // next.
    // }

    /*
     * Only compartment searching methods may have an ID parameter
     */
    if (isBlank(myCompartmentName) && myIdParamIndex != null) {
      String msg = theContext.getLocalizer().getMessage(getClass().getName() + ".idWithoutCompartment", theMethod.getName(), theMethod.getDeclaringClass());
      throw new ConfigurationException(msg);
    }

  }
View Full Code Here

    Validate.notNull(theLeftType);
    Validate.notNull(theRightType);
    try {
      myLeftType = theLeftType.newInstance();
    } catch (InstantiationException e) {
      throw new ConfigurationException("Failed to instantiate type: " + myLeftType, e);
    } catch (IllegalAccessException e) {
      throw new ConfigurationException("Failed to instantiate type: " + myLeftType, e);
    }
    try {
      myRightType = theRightType.newInstance();
    } catch (InstantiationException e) {
      throw new ConfigurationException("Failed to instantiate type: " + myRightType, e);
    } catch (IllegalAccessException e) {
      throw new ConfigurationException("Failed to instantiate type: " + myRightType, e);
    }
  }
View Full Code Here

        theEventWriter.writeEnd();
      } else {
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(value.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(value.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName);
      }
View Full Code Here

    myIdIndex = idIndex;
    myVersionIdIndex = versionIdIndex;

    Class<?>[] parameterTypes = theMethod.getParameterTypes();
    if (!IdDt.class.equals(parameterTypes[myIdIndex])) {
      throw new ConfigurationException("ID parameter must be of type: " + IdDt.class.getCanonicalName() + " - Found: " + parameterTypes[myIdIndex]);
    }
    if (myVersionIdIndex != null && !IdDt.class.equals(parameterTypes[myVersionIdIndex])) {
      throw new ConfigurationException("Version ID parameter must be of type: " + IdDt.class.getCanonicalName() + " - Found: " + parameterTypes[myVersionIdIndex]);
    }

  }
View Full Code Here

    myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod);
    myVersionIdParamIndex = MethodUtil.findVersionIdParameterIndex(theMethod);

    if (myIdParamIndex != null && myType.equals(IResource.class)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' does not specify a resource type, but has an @" + IdParam.class.getSimpleName() + " parameter. Please specity a resource type in the @" + GetTags.class.getSimpleName() + " annotation");
    }
  }
View Full Code Here

      }
      index++;
    }

    if (myTransactionParamIndex == -1) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type " + theMethod.getDeclaringClass().getCanonicalName() + " does not have a parameter annotated with the @" + TransactionParam.class + " annotation");
    }
  }
View Full Code Here

    BaseRuntimeElementCompositeDefinition<?> currentDef = def;

    List<String> parts = Arrays.asList(thePath.split("\\."));
    List<String> subList = parts.subList(1, parts.size());
    if (subList.size() < 1) {
      throw new ConfigurationException("Invalid path: " + thePath);
    }
    return getDefinition(currentDef, subList);

  }
View Full Code Here

    Object currentObj = theResource;

    List<String> parts = Arrays.asList(thePath.split("\\."));
    List<String> subList = parts.subList(1, parts.size());
    if (subList.size() < 1) {
      throw new ConfigurationException("Invalid path: " + thePath);
    }
    return getValues(currentDef, currentObj, subList);

  }
View Full Code Here

  public ConformanceMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
    super(Conformance.class, theMethod, theContext, theProvider);

    if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || theMethod.getReturnType() != Conformance.class) {
      throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return type " + Conformance.class);
    }

  }
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.context.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.