src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(oEntry) {
			var oResponse;
			var fnGrep = function(aContains, aContained) {
				return aContains.filter(function(x) {
					return aContained.indexOf(x) < 0;
				})[0];
			};
			// navigate to draft nodes and activate nodes
			for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
				for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
					if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
						oResponse = jQuery.sap.sjax({
							url: oEntry[navprop].__deferred.uri,
							dataType: "json"
						});
						if (oResponse.success && oResponse.data && oResponse.data.d && oResponse.data.d.results) {
							var oNode;
							for (var j = 0; j < oResponse.data.d.results.length; j++) {
								oNode = oResponse.data.d.results[j];
								oNode.IsActiveEntity = true;
								oNode.HasActiveEntity = false;
								oNode.HasDraftEntity = false;
								oNode[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
								var aSemanticDraftNodeKeys = this._calcSemanticKeys(this._oDraftMetadata.draftNodes[i], this._mEntitySets);
								var sDraftKey = fnGrep(this._mEntitySets[this._oDraftMetadata.draftNodes[i]].keys, aSemanticDraftNodeKeys);
								oNode[sDraftKey] = this._oConstants.EMPTY_GUID;
								jQuery.sap.sjax({
									url: oNode.__metadata.uri,
									type: "PATCH",
									data: JSON.stringify(oNode)
								});
							}
						}
					}
				}
			}
			oEntry.IsActiveEntity = true;
			oEntry.HasActiveEntity = false;
			oEntry.HasDraftEntity = false;
			oEntry[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
			jQuery.sap.sjax({
				url: oEntry.__metadata.uri,
				type: "PATCH",
				data: JSON.stringify(oEntry)
			});
			return oEntry;
		}
function(oEntry) {
			var oResponse;
			var fnGrep = function(aContains, aContained) {
				return aContains.filter(function(x) {
					return aContained.indexOf(x) < 0;
				})[0];
			};
			// navigate to draft nodes and activate nodes
			for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
				for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
					if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
						oResponse = jQuery.sap.sjax({
							url: oEntry[navprop].__deferred.uri,
							dataType: "json"
						});
						if (oResponse.success && oResponse.data && oResponse.data.d && oResponse.data.d.results) {
							var oNode;
							for (var j = 0; j < oResponse.data.d.results.length; j++) {
								oNode = oResponse.data.d.results[j];
								oNode.IsActiveEntity = true;
								oNode.HasActiveEntity = false;
								oNode.HasDraftEntity = false;
								oNode[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
								var aSemanticDraftNodeKeys = this._calcSemanticKeys(this._oDraftMetadata.draftNodes[i], this._mEntitySets);
								var sDraftKey = fnGrep(this._mEntitySets[this._oDraftMetadata.draftNodes[i]].keys, aSemanticDraftNodeKeys);
								oNode[sDraftKey] = this._oConstants.EMPTY_GUID;
								jQuery.sap.sjax({
									url: oNode.__metadata.uri,
									type: "PATCH",
									data: JSON.stringify(oNode)
								});
							}
						}
					}
				}
			}
			oEntry.IsActiveEntity = true;
			oEntry.HasActiveEntity = false;
			oEntry.HasDraftEntity = false;
			oEntry[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
			jQuery.sap.sjax({
				url: oEntry.__metadata.uri,
				type: "PATCH",
				data: JSON.stringify(oEntry)
			});
			return oEntry;
		}
function ( oEntry ) { var oResponse ; var fnGrep = function ( aContains , aContained ) { return aContains . filter ( function ( x ) { return aContained . indexOf ( x ) < 0 ; } ) [ 0 ] ; } ; // navigate to draft nodes and activate nodes for ( var i = 0 ; i < this . _oDraftMetadata . draftNodes . length ; i ++ ) { for ( var navprop in this . _mEntitySets [ this . _oDraftMetadata . draftRootName ] . navprops ) { if ( this . _mEntitySets [ this . _oDraftMetadata . draftRootName ] . navprops [ navprop ] . to . entitySet === this . _oDraftMetadata . draftNodes [ i ] ) { oResponse = jQuery . sap . sjax ( { url : oEntry [ navprop ] . __deferred . uri , dataType : "json" } ) ; if ( oResponse . success && oResponse . data && oResponse . data . d && oResponse . data . d . results ) { var oNode ; for ( var j = 0 ; j < oResponse . data . d . results . length ; j ++ ) { oNode = oResponse . data . d . results [ j ] ; oNode . IsActiveEntity = true ; oNode . HasActiveEntity = false ; oNode . HasDraftEntity = false ; oNode [ this . _oDraftMetadata . draftRootKey ] = this . _oConstants . EMPTY_GUID ; var aSemanticDraftNodeKeys = this . _calcSemanticKeys ( this . _oDraftMetadata . draftNodes [ i ] , this . _mEntitySets ) ; var sDraftKey = fnGrep ( this . _mEntitySets [ this . _oDraftMetadata . draftNodes [ i ] ] . keys , aSemanticDraftNodeKeys ) ; oNode [ sDraftKey ] = this . _oConstants . EMPTY_GUID ; jQuery . sap . sjax ( { url : oNode . __metadata . uri , type : "PATCH" , data : JSON . stringify ( oNode ) } ) ; } } } } } oEntry . IsActiveEntity = true ; oEntry . HasActiveEntity = false ; oEntry . HasDraftEntity = false ; oEntry [ this . _oDraftMetadata . draftRootKey ] = this . _oConstants . EMPTY_GUID ; jQuery . sap . sjax ( { url : oEntry . __metadata . uri , type : "PATCH" , data : JSON . stringify ( oEntry ) } ) ; return oEntry ; }
Activates a draft document
@param {object} oEntry the draft document
Activates a draft document