src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(sEntitySetName, sKeys) {
					sKeys = decodeURIComponent(sKeys);
					var oFoundEntry;
					var oEntitySet = that._mEntitySets[sEntitySetName];
					var aKeys = oEntitySet.keys;
					// split keys
					var aRequestedKeys = sKeys.split(',');

					// check number of keys to be equal to the entity keys and validates keys type for quotations
					if (aRequestedKeys.length !== aKeys.length) {
						that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
					}
					that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
					if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
						aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
					}
					jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
						// check each key for existence and value
						for (var i = 0; i < aRequestedKeys.length; i++) {
							var aKeyVal = aRequestedKeys[i].split('=');
							var sKey = that._trim(aKeyVal[0]);
							//key doesn't match, continue to next entry
							if (!aKeys || aKeys.indexOf(sKey) === -1) {
								return true; // = continue
							}

							var sNewValue = that._trim(aKeyVal[1]);
							var sOrigiValue = oEntry[sKey];

							switch (oEntitySet.keysType[sKey]) {
								case "Edm.String":
									sNewValue = sNewValue.replace(/^\'|\'$/g, '');
									break;
								case "Edm.Time":
								case "Edm.DateTime":
									sOrigiValue = that._getDateTime(sOrigiValue);
									break;
								case "Edm.Int16":
								case "Edm.Int32":
									//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
								case "Edm.Decimal":
								case "Edm.Byte":
								case "Edm.Double":
								case "Edm.Single":
								case "Edm.SByte":
									if (!that._isValidNumber(sNewValue)) {
										//TODO check better handling
										return false; // = break
									}
									sNewValue = parseFloat(sNewValue);
									break;
								case "Edm.Guid":
									sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
									break;
								case "Edm.Boolean":
									if (["true", "false"].indexOf(sNewValue) === -1) {
										that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
									}
									sNewValue = sNewValue === "true";
									break;
								case "Edm.Binary":
								case "Edm.DateTimeOffset":
								default:
									sNewValue = sNewValue;
							}

							//value doesn't match, continue to next entry
							if (sOrigiValue !== sNewValue) {
								return true; // = continue
							}
						}
						oFoundEntry = {
							index: iIndex,
							entry: oEntry
						};
						return false; // = break
					});
					return oFoundEntry;
				}
function(sEntitySetName, sKeys) {
					sKeys = decodeURIComponent(sKeys);
					var oFoundEntry;
					var oEntitySet = that._mEntitySets[sEntitySetName];
					var aKeys = oEntitySet.keys;
					// split keys
					var aRequestedKeys = sKeys.split(',');

					// check number of keys to be equal to the entity keys and validates keys type for quotations
					if (aRequestedKeys.length !== aKeys.length) {
						that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
					}
					that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
					if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
						aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
					}
					jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
						// check each key for existence and value
						for (var i = 0; i < aRequestedKeys.length; i++) {
							var aKeyVal = aRequestedKeys[i].split('=');
							var sKey = that._trim(aKeyVal[0]);
							//key doesn't match, continue to next entry
							if (!aKeys || aKeys.indexOf(sKey) === -1) {
								return true; // = continue
							}

							var sNewValue = that._trim(aKeyVal[1]);
							var sOrigiValue = oEntry[sKey];

							switch (oEntitySet.keysType[sKey]) {
								case "Edm.String":
									sNewValue = sNewValue.replace(/^\'|\'$/g, '');
									break;
								case "Edm.Time":
								case "Edm.DateTime":
									sOrigiValue = that._getDateTime(sOrigiValue);
									break;
								case "Edm.Int16":
								case "Edm.Int32":
									//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
								case "Edm.Decimal":
								case "Edm.Byte":
								case "Edm.Double":
								case "Edm.Single":
								case "Edm.SByte":
									if (!that._isValidNumber(sNewValue)) {
										//TODO check better handling
										return false; // = break
									}
									sNewValue = parseFloat(sNewValue);
									break;
								case "Edm.Guid":
									sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
									break;
								case "Edm.Boolean":
									if (["true", "false"].indexOf(sNewValue) === -1) {
										that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
									}
									sNewValue = sNewValue === "true";
									break;
								case "Edm.Binary":
								case "Edm.DateTimeOffset":
								default:
									sNewValue = sNewValue;
							}

							//value doesn't match, continue to next entry
							if (sOrigiValue !== sNewValue) {
								return true; // = continue
							}
						}
						oFoundEntry = {
							index: iIndex,
							entry: oEntry
						};
						return false; // = break
					});
					return oFoundEntry;
				}
function ( sEntitySetName , sKeys ) { sKeys = decodeURIComponent ( sKeys ) ; var oFoundEntry ; var oEntitySet = that . _mEntitySets [ sEntitySetName ] ; var aKeys = oEntitySet . keys ; // split keys var aRequestedKeys = sKeys . split ( ',' ) ; // check number of keys to be equal to the entity keys and validates keys type for quotations if ( aRequestedKeys . length !== aKeys . length ) { that . _logAndThrowMockServerCustomError ( 400 , that . _oErrorMessages . INVALID_KEY_PREDICATE_QUANTITY ) ; } that . _isRequestedKeysValid ( oEntitySet , aRequestedKeys ) ; if ( aRequestedKeys . length === 1 && ! aRequestedKeys [ 0 ] . split ( '=' ) [ 1 ] ) { aRequestedKeys = [ aKeys [ 0 ] + "=" + aRequestedKeys [ 0 ] ] ; } jQuery . each ( that . _oMockdata [ sEntitySetName ] , function ( iIndex , oEntry ) { // check each key for existence and value for ( var i = 0 ; i < aRequestedKeys . length ; i ++ ) { var aKeyVal = aRequestedKeys [ i ] . split ( '=' ) ; var sKey = that . _trim ( aKeyVal [ 0 ] ) ; //key doesn't match, continue to next entry if ( ! aKeys || aKeys . indexOf ( sKey ) === - 1 ) { return true ; // = continue } var sNewValue = that . _trim ( aKeyVal [ 1 ] ) ; var sOrigiValue = oEntry [ sKey ] ; switch ( oEntitySet . keysType [ sKey ] ) { case "Edm.String" : sNewValue = sNewValue . replace ( / ^\'|\'$ / g , '' ) ; break ; case "Edm.Time" : case "Edm.DateTime" : sOrigiValue = that . _getDateTime ( sOrigiValue ) ; break ; case "Edm.Int16" : case "Edm.Int32" : //case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html) case "Edm.Decimal" : case "Edm.Byte" : case "Edm.Double" : case "Edm.Single" : case "Edm.SByte" : if ( ! that . _isValidNumber ( sNewValue ) ) { //TODO check better handling return false ; // = break } sNewValue = parseFloat ( sNewValue ) ; break ; case "Edm.Guid" : sNewValue = sNewValue . replace ( / ^guid\'|\'$ / g , '' ) ; break ; case "Edm.Boolean" : if ( [ "true" , "false" ] . indexOf ( sNewValue ) === - 1 ) { that . _logAndThrowMockServerCustomError ( 400 , that . _oErrorMessages . INVALID_KEY_TYPE , sKey ) ; } sNewValue = sNewValue === "true" ; break ; case "Edm.Binary" : case "Edm.DateTimeOffset" : default : sNewValue = sNewValue ; } //value doesn't match, continue to next entry if ( sOrigiValue !== sNewValue ) { return true ; // = continue } } oFoundEntry = { index : iIndex , entry : oEntry } ; return false ; // = break } ) ; return oFoundEntry ; }
helper to find the entity set entry for a given entity set name and the keys of the entry
helper to find the entity set entry for a given entity set name and the keys of the entry