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; } }
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; } }