public GraphQLMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, theContext); }
public UpdateMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(theMethod, theContext, Update.class, theProvider); myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); }
@SuppressWarnings("unchecked") public ReadMethodBinding(Class<? extends IBaseResource> theAnnotatedResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theAnnotatedResourceType, theMethod, theContext, theProvider); Validate.notNull(theMethod, "Method must not be null"); Integer idIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); Class<?>[] parameterTypes = theMethod.getParameterTypes(); mySupportsVersion = theMethod.getAnnotation(Read.class).version(); myIdIndex = idIndex; if (myIdIndex == null) { throw new ConfigurationException("@" + Read.class.getSimpleName() + " method " + theMethod.getName() + " on type \"" + theMethod.getDeclaringClass().getName() + "\" does not have a parameter annotated with @" + IdParam.class.getSimpleName()); } myIdParameterType = (Class<? extends IIdType>) parameterTypes[myIdIndex]; if (!IIdType.class.isAssignableFrom(myIdParameterType)) { throw new ConfigurationException("ID parameter must be of type IdDt or IdType - Found: " + myIdParameterType); } }
@SuppressWarnings("unchecked") public ReadMethodBinding(Class<? extends IBaseResource> theAnnotatedResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theAnnotatedResourceType, theMethod, theContext, theProvider); Validate.notNull(theMethod, "Method must not be null"); Integer idIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); Class<?>[] parameterTypes = theMethod.getParameterTypes(); mySupportsVersion = theMethod.getAnnotation(Read.class).version(); myIdIndex = idIndex; if (myIdIndex == null) { throw new ConfigurationException("@" + Read.class.getSimpleName() + " method " + theMethod.getName() + " on type \"" + theMethod.getDeclaringClass().getName() + "\" does not have a parameter annotated with @" + IdParam.class.getSimpleName()); } myIdParameterType = (Class<? extends IIdType>) parameterTypes[myIdIndex]; if (!IIdType.class.isAssignableFrom(myIdParameterType)) { throw new ConfigurationException("ID parameter must be of type IdDt or IdType - Found: " + myIdParameterType); } }
public BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody(Method theMethod, FhirContext theContext, Object theProvider, Class<?> theMethodAnnotationType, Class<? extends IBaseResource> theResourceTypeFromAnnotation) { super(theMethod, theContext, theMethodAnnotationType, theProvider); Class<? extends IBaseResource> resourceType = theResourceTypeFromAnnotation; if (resourceType != IBaseResource.class) { RuntimeResourceDefinition def = theContext.getResourceDefinition(resourceType); myResourceName = def.getName(); } else { throw new ConfigurationException( "Can not determine resource type for method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getCanonicalName() + " - Did you forget to include the resourceType() value on the @" + Delete.class.getSimpleName() + " method annotation?"); } myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParameterIndex == null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation"); } }
public BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody(Method theMethod, FhirContext theContext, Object theProvider, Class<?> theMethodAnnotationType, Class<? extends IBaseResource> theResourceTypeFromAnnotation) { super(theMethod, theContext, theMethodAnnotationType, theProvider); Class<? extends IBaseResource> resourceType = theResourceTypeFromAnnotation; if (resourceType != IBaseResource.class) { RuntimeResourceDefinition def = theContext.getResourceDefinition(resourceType); myResourceName = def.getName(); } else { if (theProvider != null && theProvider instanceof IResourceProvider) { RuntimeResourceDefinition def = theContext.getResourceDefinition(((IResourceProvider) theProvider).getResourceType()); myResourceName = def.getName(); } else { throw new ConfigurationException( "Can not determine resource type for method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getCanonicalName() + " - Did you forget to include the resourceType() value on the @" + Delete.class.getSimpleName() + " method annotation?"); } } myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParameterIndex == null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation"); } }
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }
public SearchMethodBinding(Class<? extends IBaseResource> theReturnResourceType, Class<? extends IBaseResource> theResourceProviderResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theReturnResourceType, theMethod, theContext, theProvider); Search search = theMethod.getAnnotation(Search.class); this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); this.myAllowUnknownParams = search.allowUnknownParams(); Description desc = theMethod.getAnnotation(Description.class); if (desc != null) { if (isNotBlank(desc.formalDefinition())) { myDescription = StringUtils.defaultIfBlank(desc.formalDefinition(), null); } else { myDescription = StringUtils.defaultIfBlank(desc.shortDefinition(), null); } } /* * 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); } if (theResourceProviderResourceType != null) { this.myResourceProviderResourceName = theContext.getResourceDefinition(theResourceProviderResourceType).getName(); } else { this.myResourceProviderResourceName = null; } }
this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { if (theProvider instanceof IResourceProvider) { type = ((IResourceProvider) theProvider).getResourceType(); if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParamIndex != null) { myIdParamType = (Class<? extends IIdType>) theMethod.getParameterTypes()[myIdParamIndex];
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (getResourceName() == null) { myOtherOperationType = RestOperationTypeEnum.EXTENDED_OPERATION_SERVER;
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParamIndex != null) { for (Annotation next : theMethod.getParameterAnnotations()[myIdParamIndex]) {
public GraphQLMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, theContext); }
public UpdateMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(theMethod, theContext, Update.class, theProvider); myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); }
@SuppressWarnings("unchecked") public ReadMethodBinding(Class<? extends IBaseResource> theAnnotatedResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theAnnotatedResourceType, theMethod, theContext, theProvider); Validate.notNull(theMethod, "Method must not be null"); Integer idIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); Class<?>[] parameterTypes = theMethod.getParameterTypes(); mySupportsVersion = theMethod.getAnnotation(Read.class).version(); myIdIndex = idIndex; if (myIdIndex == null) { throw new ConfigurationException("@" + Read.class.getSimpleName() + " method " + theMethod.getName() + " on type \"" + theMethod.getDeclaringClass().getName() + "\" does not have a parameter annotated with @" + IdParam.class.getSimpleName()); } myIdParameterType = (Class<? extends IIdType>) parameterTypes[myIdIndex]; if (!IIdType.class.isAssignableFrom(myIdParameterType)) { throw new ConfigurationException("ID parameter must be of type IdDt or IdType - Found: " + myIdParameterType); } }
@SuppressWarnings("unchecked") public ReadMethodBinding(Class<? extends IBaseResource> theAnnotatedResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theAnnotatedResourceType, theMethod, theContext, theProvider); Validate.notNull(theMethod, "Method must not be null"); Integer idIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); Class<?>[] parameterTypes = theMethod.getParameterTypes(); mySupportsVersion = theMethod.getAnnotation(Read.class).version(); myIdIndex = idIndex; if (myIdIndex == null) { throw new ConfigurationException("@" + Read.class.getSimpleName() + " method " + theMethod.getName() + " on type \"" + theMethod.getDeclaringClass().getName() + "\" does not have a parameter annotated with @" + IdParam.class.getSimpleName()); } myIdParameterType = (Class<? extends IIdType>) parameterTypes[myIdIndex]; if (!IIdType.class.isAssignableFrom(myIdParameterType)) { throw new ConfigurationException("ID parameter must be of type IdDt or IdType - Found: " + myIdParameterType); } }
public BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody(Method theMethod, FhirContext theContext, Object theProvider, Class<?> theMethodAnnotationType, Class<? extends IBaseResource> theResourceTypeFromAnnotation) { super(theMethod, theContext, theMethodAnnotationType, theProvider); Class<? extends IBaseResource> resourceType = theResourceTypeFromAnnotation; if (resourceType != IBaseResource.class) { RuntimeResourceDefinition def = theContext.getResourceDefinition(resourceType); myResourceName = def.getName(); } else { throw new ConfigurationException( "Can not determine resource type for method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getCanonicalName() + " - Did you forget to include the resourceType() value on the @" + Delete.class.getSimpleName() + " method annotation?"); } myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParameterIndex == null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation"); } }
public BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody(Method theMethod, FhirContext theContext, Object theProvider, Class<?> theMethodAnnotationType, Class<? extends IBaseResource> theResourceTypeFromAnnotation) { super(theMethod, theContext, theMethodAnnotationType, theProvider); Class<? extends IBaseResource> resourceType = theResourceTypeFromAnnotation; if (resourceType != IBaseResource.class) { RuntimeResourceDefinition def = theContext.getResourceDefinition(resourceType); myResourceName = def.getName(); } else { if (theProvider != null && theProvider instanceof IResourceProvider) { RuntimeResourceDefinition def = theContext.getResourceDefinition(((IResourceProvider) theProvider).getResourceType()); myResourceName = def.getName(); } else { throw new ConfigurationException( "Can not determine resource type for method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getCanonicalName() + " - Did you forget to include the resourceType() value on the @" + Delete.class.getSimpleName() + " method annotation?"); } } myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); if (myIdParameterIndex == null) { throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation"); } }
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }