src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function(oModelReference, mParameter) {
			if (typeof mParameter == "string") {
				throw "Deprecated second argument: Adjust your invocation by passing an object with a property sAnnotationJSONDoc as a second argument instead";
			}
			this._mParameter = mParameter;

			var that = this;
			/*
			 * get access to OData model
			 */

			this._oActivatedWorkarounds = {};

			if (oModelReference && oModelReference.aWorkaroundID) {
				for (var i = -1, sID; (sID = oModelReference.aWorkaroundID[++i]) !== undefined;) {
					this._oActivatedWorkarounds[sID] = true;
				}
				oModelReference = oModelReference.oModelReference;
			}

			// check proper usage
			if (!oModelReference || (!oModelReference.sServiceURI && !oModelReference.oModel)) {
				throw "Usage with oModelReference being an instance of Model.ReferenceByURI or Model.ReferenceByModel";
			}

			//check if a model is given, or we need to create one from the service URI
			if (oModelReference.oModel) {
				this._oModel = oModelReference.oModel;
				// find out which model version we are running
				this._iVersion = AnalyticalVersionInfo.getVersion(this._oModel);
				checkForMetadata();
			} else if (mParameter && mParameter.modelVersion === AnalyticalVersionInfo.V2) {
				// Check if the user wants a V2 model
				var V2ODataModel = sap.ui.requireSync("sap/ui/model/odata/v2/ODataModel");
				this._oModel = new V2ODataModel(oModelReference.sServiceURI);
				this._iVersion = AnalyticalVersionInfo.V2;
				checkForMetadata();
			} else {
				//default is V1 Model
				var ODataModel = sap.ui.requireSync("sap/ui/model/odata/ODataModel");
				this._oModel = new ODataModel(oModelReference.sServiceURI);
				this._iVersion = AnalyticalVersionInfo.V1;
				checkForMetadata();
			}

			if (this._oModel.getServiceMetadata()
					&& this._oModel.getServiceMetadata().dataServices == undefined) {
				throw "Model could not be loaded";
			}

			/**
			 * Check if the metadata is already available, if not defere the interpretation of the Metadata
			 */
			function checkForMetadata() {
				// V2 supports asynchronous loading of metadata
				// we have to register for the MetadataLoaded Event in case, the data is not loaded already
				if (!that._oModel.getServiceMetadata()) {
					that._oModel.attachMetadataLoaded(processMetadata);
				} else {
					// metadata already loaded
					processMetadata();
				}
			}

			/**
			 * Kickstart the interpretation of the metadata,
			 * either called directly if metadata is available, or deferred and then
			 * executed via callback by the model during the metadata loaded event.
			 */
			function processMetadata () {
				//only interprete the metadata if the analytics model was not initialised yet
				if (that.bIsInitialized) {
					return;
				}

				//mark analytics model as initialized
				that.bIsInitialized = true;

				/*
				 * add extra annotations if provided
				 */
				if (mParameter && mParameter.sAnnotationJSONDoc) {
					that.mergeV2Annotations(mParameter.sAnnotationJSONDoc);
				}

				that._interpreteMetadata(that._oModel.getServiceMetadata().dataServices);
			}

		}
function(oModelReference, mParameter) {
			if (typeof mParameter == "string") {
				throw "Deprecated second argument: Adjust your invocation by passing an object with a property sAnnotationJSONDoc as a second argument instead";
			}
			this._mParameter = mParameter;

			var that = this;
			/*
			 * get access to OData model
			 */

			this._oActivatedWorkarounds = {};

			if (oModelReference && oModelReference.aWorkaroundID) {
				for (var i = -1, sID; (sID = oModelReference.aWorkaroundID[++i]) !== undefined;) {
					this._oActivatedWorkarounds[sID] = true;
				}
				oModelReference = oModelReference.oModelReference;
			}

			// check proper usage
			if (!oModelReference || (!oModelReference.sServiceURI && !oModelReference.oModel)) {
				throw "Usage with oModelReference being an instance of Model.ReferenceByURI or Model.ReferenceByModel";
			}

			//check if a model is given, or we need to create one from the service URI
			if (oModelReference.oModel) {
				this._oModel = oModelReference.oModel;
				// find out which model version we are running
				this._iVersion = AnalyticalVersionInfo.getVersion(this._oModel);
				checkForMetadata();
			} else if (mParameter && mParameter.modelVersion === AnalyticalVersionInfo.V2) {
				// Check if the user wants a V2 model
				var V2ODataModel = sap.ui.requireSync("sap/ui/model/odata/v2/ODataModel");
				this._oModel = new V2ODataModel(oModelReference.sServiceURI);
				this._iVersion = AnalyticalVersionInfo.V2;
				checkForMetadata();
			} else {
				//default is V1 Model
				var ODataModel = sap.ui.requireSync("sap/ui/model/odata/ODataModel");
				this._oModel = new ODataModel(oModelReference.sServiceURI);
				this._iVersion = AnalyticalVersionInfo.V1;
				checkForMetadata();
			}

			if (this._oModel.getServiceMetadata()
					&& this._oModel.getServiceMetadata().dataServices == undefined) {
				throw "Model could not be loaded";
			}

			/**
			 * Check if the metadata is already available, if not defere the interpretation of the Metadata
			 */
			function checkForMetadata() {
				// V2 supports asynchronous loading of metadata
				// we have to register for the MetadataLoaded Event in case, the data is not loaded already
				if (!that._oModel.getServiceMetadata()) {
					that._oModel.attachMetadataLoaded(processMetadata);
				} else {
					// metadata already loaded
					processMetadata();
				}
			}

			/**
			 * Kickstart the interpretation of the metadata,
			 * either called directly if metadata is available, or deferred and then
			 * executed via callback by the model during the metadata loaded event.
			 */
			function processMetadata () {
				//only interprete the metadata if the analytics model was not initialised yet
				if (that.bIsInitialized) {
					return;
				}

				//mark analytics model as initialized
				that.bIsInitialized = true;

				/*
				 * add extra annotations if provided
				 */
				if (mParameter && mParameter.sAnnotationJSONDoc) {
					that.mergeV2Annotations(mParameter.sAnnotationJSONDoc);
				}

				that._interpreteMetadata(that._oModel.getServiceMetadata().dataServices);
			}

		}
function ( oModelReference , mParameter ) { if ( typeof mParameter == "string" ) { throw "Deprecated second argument: Adjust your invocation by passing an object with a property sAnnotationJSONDoc as a second argument instead" ; } this . _mParameter = mParameter ; var that = this ; /*
			 * get access to OData model
			 */ this . _oActivatedWorkarounds = { } ; if ( oModelReference && oModelReference . aWorkaroundID ) { for ( var i = - 1 , sID ; ( sID = oModelReference . aWorkaroundID [ ++ i ] ) !== undefined ; ) { this . _oActivatedWorkarounds [ sID ] = true ; } oModelReference = oModelReference . oModelReference ; } // check proper usage if ( ! oModelReference || ( ! oModelReference . sServiceURI && ! oModelReference . oModel ) ) { throw "Usage with oModelReference being an instance of Model.ReferenceByURI or Model.ReferenceByModel" ; } //check if a model is given, or we need to create one from the service URI if ( oModelReference . oModel ) { this . _oModel = oModelReference . oModel ; // find out which model version we are running this . _iVersion = AnalyticalVersionInfo . getVersion ( this . _oModel ) ; checkForMetadata ( ) ; } else if ( mParameter && mParameter . modelVersion === AnalyticalVersionInfo . V2 ) { // Check if the user wants a V2 model var V2ODataModel = sap . ui . requireSync ( "sap/ui/model/odata/v2/ODataModel" ) ; this . _oModel = new V2ODataModel ( oModelReference . sServiceURI ) ; this . _iVersion = AnalyticalVersionInfo . V2 ; checkForMetadata ( ) ; } else { //default is V1 Model var ODataModel = sap . ui . requireSync ( "sap/ui/model/odata/ODataModel" ) ; this . _oModel = new ODataModel ( oModelReference . sServiceURI ) ; this . _iVersion = AnalyticalVersionInfo . V1 ; checkForMetadata ( ) ; } if ( this . _oModel . getServiceMetadata ( ) && this . _oModel . getServiceMetadata ( ) . dataServices == undefined ) { throw "Model could not be loaded" ; } /**
			 * Check if the metadata is already available, if not defere the interpretation of the Metadata
			 */ function checkForMetadata ( ) { // V2 supports asynchronous loading of metadata // we have to register for the MetadataLoaded Event in case, the data is not loaded already if ( ! that . _oModel . getServiceMetadata ( ) ) { that . _oModel . attachMetadataLoaded ( processMetadata ) ; } else { // metadata already loaded processMetadata ( ) ; } } /**
			 * Kickstart the interpretation of the metadata,
			 * either called directly if metadata is available, or deferred and then
			 * executed via callback by the model during the metadata loaded event.
			 */ function processMetadata ( ) { //only interprete the metadata if the analytics model was not initialised yet if ( that . bIsInitialized ) { return ; } //mark analytics model as initialized that . bIsInitialized = true ; /*
				 * add extra annotations if provided
				 */ if ( mParameter && mParameter . sAnnotationJSONDoc ) { that . mergeV2Annotations ( mParameter . sAnnotationJSONDoc ) ; } that . _interpreteMetadata ( that . _oModel . getServiceMetadata ( ) . dataServices ) ; } }
initialize a new object

@private
initialize a new object