Work on hapi3 changes
This commit is contained in:
parent
f1d2ee9092
commit
f8e647511b
|
@ -17,6 +17,7 @@ import ca.uhn.fhir.rest.annotation.TagListParam;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.*;
|
import ca.uhn.fhir.rest.server.exceptions.*;
|
||||||
|
|
||||||
abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding<Void> {
|
abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding<Void> {
|
||||||
|
@ -38,9 +39,9 @@ abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding<Void>
|
||||||
|
|
||||||
myResourceName = theContext.getResourceDefinition(myType).getName();
|
myResourceName = theContext.getResourceDefinition(myType).getName();
|
||||||
|
|
||||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
myVersionIdParamIndex = MethodUtil.findVersionIdParameterIndex(theMethod);
|
myVersionIdParamIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
|
||||||
myTagListParamIndex = MethodUtil.findTagListParameterIndex(theMethod);
|
myTagListParamIndex = ParameterUtil.findTagListParameterIndex(theMethod);
|
||||||
|
|
||||||
if (myIdParamIndex == null) {
|
if (myIdParamIndex == null) {
|
||||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' does not have an @" + IdParam.class.getSimpleName() + " parameter.");
|
throw new ConfigurationException("Method '" + theMethod.getName() + "' does not have an @" + IdParam.class.getSimpleName() + " parameter.");
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import ca.uhn.fhir.context.*;
|
import ca.uhn.fhir.context.*;
|
||||||
//TODO Use of a deprecated method should be resolved
|
//TODO Use of a deprecated method should be resolved
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
import ca.uhn.fhir.rest.annotation.*;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
|
|
||||||
public abstract class BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody extends BaseOutcomeReturningMethodBinding {
|
public abstract class BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody extends BaseOutcomeReturningMethodBinding {
|
||||||
|
|
||||||
|
@ -45,12 +46,12 @@ public abstract class BaseOutcomeReturningMethodBindingWithResourceIdButNoResour
|
||||||
"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?");
|
"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 = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
if (myIdParameterIndex == null) {
|
if (myIdParameterIndex == null) {
|
||||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation");
|
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation");
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer versionIdParameterIndex = MethodUtil.findVersionIdParameterIndex(theMethod);
|
Integer versionIdParameterIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
|
||||||
if (versionIdParameterIndex != null) {
|
if (versionIdParameterIndex != null) {
|
||||||
//TODO Use of a deprecated method should be resolved
|
//TODO Use of a deprecated method should be resolved
|
||||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has a parameter annotated with the @" + VersionIdParam.class.getSimpleName() + " annotation but delete methods may not have this annotation");
|
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has a parameter annotated with the @" + VersionIdParam.class.getSimpleName() + " annotation but delete methods may not have this annotation");
|
||||||
|
|
|
@ -19,6 +19,7 @@ import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ public class GetTagsMethodBinding extends BaseMethodBinding<TagList> {
|
||||||
myResourceName = theContext.getResourceDefinition(myType).getName();
|
myResourceName = theContext.getResourceDefinition(myType).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
myVersionIdParamIndex = MethodUtil.findVersionIdParameterIndex(theMethod);
|
myVersionIdParamIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
|
||||||
|
|
||||||
if (myIdParamIndex != null && myType.equals(IResource.class)) {
|
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()
|
throw new ConfigurationException("Method '" + theMethod.getName() + "' does not specify a resource type, but has an @" + IdParam.class.getSimpleName()
|
||||||
|
|
|
@ -37,6 +37,7 @@ import ca.uhn.fhir.rest.annotation.History;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
|
|
||||||
public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
|
public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
|
||||||
|
@ -48,7 +49,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
|
||||||
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
|
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
|
||||||
super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider);
|
super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider);
|
||||||
|
|
||||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
|
|
||||||
History historyAnnotation = theMethod.getAnnotation(History.class);
|
History historyAnnotation = theMethod.getAnnotation(History.class);
|
||||||
Class<? extends IBaseResource> type = historyAnnotation.type();
|
Class<? extends IBaseResource> type = historyAnnotation.type();
|
||||||
|
|
|
@ -25,31 +25,18 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.*;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.*;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
import ca.uhn.fhir.rest.annotation.*;
|
||||||
import ca.uhn.fhir.rest.annotation.Operation;
|
|
||||||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.util.FhirTerser;
|
import ca.uhn.fhir.util.FhirTerser;
|
||||||
|
|
||||||
|
@ -75,7 +62,7 @@ public class OperationMethodBinding extends BaseResourceReturningMethodBinding {
|
||||||
|
|
||||||
myBundleType = theBundleType;
|
myBundleType = theBundleType;
|
||||||
myIdempotent = theIdempotent;
|
myIdempotent = theIdempotent;
|
||||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
if (myIdParamIndex != null) {
|
if (myIdParamIndex != null) {
|
||||||
for (Annotation next : theMethod.getParameterAnnotations()[myIdParamIndex]) {
|
for (Annotation next : theMethod.getParameterAnnotations()[myIdParamIndex]) {
|
||||||
if (next instanceof IdParam) {
|
if (next instanceof IdParam) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
import ca.uhn.fhir.rest.annotation.*;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||||
|
|
||||||
public class ReadMethodBinding extends BaseResourceReturningMethodBinding implements IClientResponseHandlerHandlesBinary<Object> {
|
public class ReadMethodBinding extends BaseResourceReturningMethodBinding implements IClientResponseHandlerHandlesBinary<Object> {
|
||||||
|
@ -51,8 +52,8 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding implem
|
||||||
|
|
||||||
Validate.notNull(theMethod, "Method must not be null");
|
Validate.notNull(theMethod, "Method must not be null");
|
||||||
|
|
||||||
Integer idIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
Integer idIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
Integer versionIdIndex = MethodUtil.findVersionIdParameterIndex(theMethod);
|
Integer versionIdIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
|
||||||
|
|
||||||
Class<?>[] parameterTypes = theMethod.getParameterTypes();
|
Class<?>[] parameterTypes = theMethod.getParameterTypes();
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.rest.annotation.Search;
|
import ca.uhn.fhir.rest.annotation.Search;
|
||||||
import ca.uhn.fhir.rest.api.*;
|
import ca.uhn.fhir.rest.api.*;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
|
||||||
Search search = theMethod.getAnnotation(Search.class);
|
Search search = theMethod.getAnnotation(Search.class);
|
||||||
this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null);
|
this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null);
|
||||||
this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null);
|
this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null);
|
||||||
this.myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
|
|
||||||
Description desc = theMethod.getAnnotation(Description.class);
|
Description desc = theMethod.getAnnotation(Description.class);
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import ca.uhn.fhir.rest.annotation.Update;
|
||||||
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
|
||||||
public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithResourceParam {
|
public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithResourceParam {
|
||||||
|
@ -25,7 +26,7 @@ public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe
|
||||||
public UpdateMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
|
public UpdateMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
|
||||||
super(theMethod, theContext, Update.class, theProvider);
|
super(theMethod, theContext, Update.class, theProvider);
|
||||||
|
|
||||||
myIdParameterIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.rest.annotation.Validate;
|
import ca.uhn.fhir.rest.annotation.Validate;
|
||||||
import ca.uhn.fhir.rest.api.*;
|
import ca.uhn.fhir.rest.api.*;
|
||||||
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
import ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation;
|
||||||
|
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||||
|
|
||||||
public class ValidateMethodBindingDstu1 extends BaseOutcomeReturningMethodBindingWithResourceParam {
|
public class ValidateMethodBindingDstu1 extends BaseOutcomeReturningMethodBindingWithResourceParam {
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public class ValidateMethodBindingDstu1 extends BaseOutcomeReturningMethodBindin
|
||||||
public ValidateMethodBindingDstu1(Method theMethod, FhirContext theContext, Object theProvider) {
|
public ValidateMethodBindingDstu1(Method theMethod, FhirContext theContext, Object theProvider) {
|
||||||
super(theMethod, theContext, Validate.class, theProvider);
|
super(theMethod, theContext, Validate.class, theProvider);
|
||||||
|
|
||||||
myIdParameterIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue