protected void validateRequest ( ApiRequest request ) throws InvalidContractException { ApiContract contract = request . getContract ( ) ; boolean matches = true ; if ( ! contract . getApi ( ) . getOrganizationId ( ) . equals ( request . getApiOrgId ( ) ) ) { matches = false ; } if ( ! contract . getApi ( ) . getApiId ( ) . equals ( request . getApiId ( ) ) ) { matches = false ; } if ( ! contract . getApi ( ) . getVersion ( ) . equals ( request . getApiVersion ( ) ) ) { matches = false ; } if ( ! matches ) { throw new InvalidContractException ( Messages . i18n . format ( "EngineImpl.InvalidContractForApi" , //$NON-NLS-1$ request . getApiOrgId ( ) , request . getApiId ( ) , request . getApiVersion ( ) ) ) ; } }
Validates that the contract being used for the request is valid against the api information included in the request . Basically the request includes information indicating which specific api is being invoked . This method ensures that the api information in the contract matches the requested api .