@Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { boolean retVal = super.incomingServerRequestMatchesMethod(theRequest); if (retVal) { PatchTypeParameter.getTypeForRequestOrThrowInvalidRequestException(theRequest); } return retVal; }
/** * Determine which operation is being fired for a specific request * * @param theRequestDetails * The request */ public RestOperationTypeEnum getRestOperationType(RequestDetails theRequestDetails) { return getRestOperationType(); }
@Override public Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding<?> theMethodBinding) throws InternalErrorException, InvalidRequestException { return getTypeForRequestOrThrowInvalidRequestException(theRequest); }
@Override public int compare(SearchParameter theO1, SearchParameter theO2) { if (theO1.isRequired() == theO2.isRequired()) { return theO1.getName().compareTo(theO2.getName()); } if (theO1.isRequired()) { return -1; } return 1; } });
public BaseMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { assert theMethod != null; assert theContext != null; myMethod = theMethod; myContext = theContext; myProvider = theProvider; myParameters = MethodUtil.getResourceParameters(theContext, theMethod, theProvider, getRestOperationType()); for (IParameter next : myParameters) { if (next instanceof ConditionalParamBinder) { mySupportsConditional = true; if (((ConditionalParamBinder) next).isSupportsMultiple()) { mySupportsConditionalMultiple = true; } break; } } // This allows us to invoke methods on private classes myMethod.setAccessible(true); }
public String getSearchParamType() { if (mySearchParameterBinding != null) { return mySearchParameterBinding.getParamType().getCode(); } return null; }
public static Reader createRequestReader(RequestDetails theRequest) { return createRequestReader(theRequest, determineRequestCharset(theRequest)); }
@Override protected void populateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, ActionRequestDetails theDetails, Object[] theMethodParams) { super.populateActionRequestDetailsForInterceptor(theRequestDetails, theDetails, theMethodParams); /* * If the method has no parsed resource parameter, we parse here in order to have something for the interceptor. */ if (myTransactionParamIndex != -1) { theDetails.setResource((IBaseResource) theMethodParams[myTransactionParamIndex]); } else { Class<? extends IBaseResource> resourceType = getContext().getResourceDefinition("Bundle").getImplementingClass(); theDetails.setResource(ResourceParameter.parseResourceFromRequest(theRequestDetails, this, resourceType)); } }
protected Object[] createParametersForServerRequest(RequestDetails theRequest) { Object[] params = new Object[getParameters().size()]; for (int i = 0; i < getParameters().size(); i++) { IParameter param = getParameters().get(i); if (param == null) { continue; } params[i] = param.translateQueryParametersIntoServerArgument(theRequest, this); } return params; }
@Override protected void addParametersForServerRequest(RequestDetails theRequest, Object[] theParams) { IIdType id = theRequest.getId(); id = UpdateMethodBinding.applyETagAsVersion(theRequest, id); theParams[getIdParameterIndex()] = id; }
@Override public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException { if (myIdParamIndex != null) { theMethodParams[myIdParamIndex] = theRequest.getId(); } Object response = invokeServerMethod(theServer, theRequest, theMethodParams); return toResourceList(response); }
@Override protected void populateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, ActionRequestDetails theDetails, Object[] theMethodParams) { super.populateActionRequestDetailsForInterceptor(theRequestDetails, theDetails, theMethodParams); /* * If the method has no parsed resource parameter, we parse here in order to have something for the interceptor. */ if (myResourceParameterIndex != -1) { theDetails.setResource((IBaseResource) theMethodParams[myResourceParameterIndex]); } else { theDetails.setResource(ResourceParameter.parseResourceFromRequest(theRequestDetails, this, myResourceType)); } }
@Override public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException { if (theRequest.getRequestType() == RequestTypeEnum.POST) { IBaseResource requestContents = ResourceParameter.loadResourceFromRequest(theRequest, this, null); theRequest.getUserData().put(OperationParameter.REQUEST_CONTENTS_USERDATA_KEY, requestContents); } return super.invokeServer(theServer, theRequest); }
@Override public Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding<?> theMethodBinding) throws InternalErrorException, InvalidRequestException { return getTypeForRequestOrThrowInvalidRequestException(theRequest); }
@Override public String toString() { return getMethod().toString(); } public static QualifierDetails extractQualifiersFromParameterName(String theParamName) {
@Nonnull @Override public RestOperationTypeEnum getRestOperationType() { return isVread() ? RestOperationTypeEnum.VREAD : RestOperationTypeEnum.READ; }
@Override public RestOperationTypeEnum getRestOperationType(RequestDetails theRequestDetails) { RestOperationTypeEnum retVal = super.getRestOperationType(theRequestDetails); if (retVal == RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE) { if (theRequestDetails.getId() == null) { retVal = RestOperationTypeEnum.EXTENDED_OPERATION_TYPE; } } return retVal; }
@Override public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException { IBaseResource conf = (IBaseResource) invokeServerMethod(theServer, theRequest, theMethodParams); return new SimpleBundleProvider(conf); }
@Override public int compare(SearchParameter theO1, SearchParameter theO2) { if (theO1.isRequired() == theO2.isRequired()) { return theO1.getName().compareTo(theO2.getName()); } if (theO1.isRequired()) { return -1; } return 1; } });
protected Object[] createMethodParams(RequestDetails theRequest) { Object[] params = new Object[getParameters().size()]; for (int i = 0; i < getParameters().size(); i++) { IParameter param = getParameters().get(i); if (param != null) { params[i] = param.translateQueryParametersIntoServerArgument(theRequest, this); } } return params; }