<commit_before>/*!
 * ${copyright}
 */
sap.ui.define([
	"sap/ui/fl/LrepConnector",
	"sap/ui/rta/appVariant/AppVariantUtils",
	"sap/ui/fl/registry/Settings",
	"sap/base/i18n/ResourceBundle"
],
function(
	LrepConnector,
	AppVariantUtils,
	Settings,
	ResourceBundle
) {
		"use strict";

		var Utils = {};

		var sModulePath = sap.ui.require.toUrl("sap/ui/rta/appVariant/manageApps/") + "webapp";
		var oI18n = ResourceBundle.create({
			url : sModulePath + "/i18n/i18n.properties"
		});

		Utils.sendRequest = function(sRoute, sOperation) {
			var oLREPConnector = LrepConnector.createConnector();
			return oLREPConnector.send(sRoute, sOperation);
		};

		Utils._checkNavigationSupported = function(oNavigationParams) {
			var oNavigationService = sap.ushell.Container.getService( "CrossApplicationNavigation" );
			return oNavigationService.getLinks(oNavigationParams);
		};

		Utils._checkAppType = function(bOriginalApp, bAppVariant) {
			if (bOriginalApp && bAppVariant) {
				return oI18n.getText("MAA_ORIGINAL_TYPE");
			} else if (bAppVariant) {
				return oI18n.getText("MAA_APP_VARIANT_TYPE");
			} else if (bOriginalApp) {
				return oI18n.getText("MAA_ORIGINAL_TYPE");
			}

			return undefined;
		};

		Utils._calculateCurrentStatus = function(sAppVariantInfoId) {
			// Get the id of a new created app variant
			var sNewAppVariantId = AppVariantUtils.getNewAppVariantId();

			if (sNewAppVariantId === sAppVariantInfoId) {
				return  oI18n.getText("MAA_NEW_APP_VARIANT");
			}

			return undefined;
		};

		Utils._checkDeleteButtonOptions = function(oPreparedObject, bAdaptUIButtonEnabled) {
			var oDelAppVarObject = {};

			if (oPreparedObject.isKeyUser) {
				if (oPreparedObject.isOriginal) {
					oDelAppVarObject.delAppVarButtonEnabled = false;
					oDelAppVarObject.delAppVarButtonVisibility = false;
					return oDelAppVarObject;
				}

				if (bAdaptUIButtonEnabled) {
					if (oPreparedObject.isS4HanaCloud) {
						// S4 Hana Cloud and target mappings => deleteable
						oDelAppVarObject.delAppVarButtonEnabled = true;
						oDelAppVarObject.delAppVarButtonVisibility = true;
					} else {
						// S4 Hana on premise and target mappings => not deleteable
						oDelAppVarObject.delAppVarButtonEnabled = false;
						oDelAppVarObject.delAppVarButtonVisibility = true;
					}
				} else if (oPreparedObject.isS4HanaCloud) {
					// S4 Hana Cloud and no target mappings => not deleteable
					oDelAppVarObject.delAppVarButtonEnabled = false;
					oDelAppVarObject.delAppVarButtonVisibility = true;
				} else {
					// S4 Hana on Premise and no target mappings => deleteable
					oDelAppVarObject.delAppVarButtonEnabled = true;
					oDelAppVarObject.delAppVarButtonVisibility = true;
				}
			} else {
				// Not a key user => not deleteable
				oDelAppVarObject.delAppVarButtonEnabled = false;
				oDelAppVarObject.delAppVarButtonVisibility = false;
			}

			return oDelAppVarObject;
		};

		Utils._getNavigationInfo = function(oPreparedObject) {
			var oNavigationObject = {};

			var sSemanticObject = oPreparedObject.startWith.semanticObject;
			var sAction = oPreparedObject.startWith.action;
			var oParams = oPreparedObject.startWith.parameters;

			var oNavigationParams = {
				semanticObject : sSemanticObject,
				action : sAction,
				params: oParams
			};<commit_msg>[FIX] Stopping deletion of app variants functionality in S4 Cloud<commit_after>/*!
 * ${copyright}
 */
sap.ui.define([
	"sap/ui/fl/LrepConnector",
	"sap/ui/rta/appVariant/AppVariantUtils",
	"sap/ui/fl/registry/Settings",
	"sap/base/i18n/ResourceBundle"
],
function(
	LrepConnector,
	AppVariantUtils,
	Settings,
	ResourceBundle
) {
		"use strict";

		var Utils = {};

		var sModulePath = sap.ui.require.toUrl("sap/ui/rta/appVariant/manageApps/") + "webapp";
		var oI18n = ResourceBundle.create({
			url : sModulePath + "/i18n/i18n.properties"
		});

		Utils.sendRequest = function(sRoute, sOperation) {
			var oLREPConnector = LrepConnector.createConnector();
			return oLREPConnector.send(sRoute, sOperation);
		};

		Utils._checkNavigationSupported = function(oNavigationParams) {
			var oNavigationService = sap.ushell.Container.getService( "CrossApplicationNavigation" );
			return oNavigationService.getLinks(oNavigationParams);
		};

		Utils._checkAppType = function(bOriginalApp, bAppVariant) {
			if (bOriginalApp && bAppVariant) {
				return oI18n.getText("MAA_ORIGINAL_TYPE");
			} else if (bAppVariant) {
				return oI18n.getText("MAA_APP_VARIANT_TYPE");
			} else if (bOriginalApp) {
				return oI18n.getText("MAA_ORIGINAL_TYPE");
			}

			return undefined;
		};

		Utils._calculateCurrentStatus = function(sAppVariantInfoId) {
			// Get the id of a new created app variant
			var sNewAppVariantId = AppVariantUtils.getNewAppVariantId();

			if (sNewAppVariantId === sAppVariantInfoId) {
				return  oI18n.getText("MAA_NEW_APP_VARIANT");
			}

			return undefined;
		};

		Utils._checkDeleteButtonOptions = function(oPreparedObject, bAdaptUIButtonEnabled) {
			var oDelAppVarObject = {};

			if (oPreparedObject.isKeyUser) {
				if (oPreparedObject.isOriginal) {
					oDelAppVarObject.delAppVarButtonEnabled = false;
					oDelAppVarObject.delAppVarButtonVisibility = false;
					return oDelAppVarObject;
				}

				if (bAdaptUIButtonEnabled) {
					if (oPreparedObject.isS4HanaCloud) {
						// S4 Hana Cloud and target mappings => deleteable
						oDelAppVarObject.delAppVarButtonEnabled = true;
						// TODO: When deletion works E2E, then uncomment line 73 and remove line 74
						// oDelAppVarObject.delAppVarButtonVisibility = true;
						oDelAppVarObject.delAppVarButtonVisibility = false;
					} else {
						// S4 Hana on premise and target mappings => not deleteable
						oDelAppVarObject.delAppVarButtonEnabled = false;
						oDelAppVarObject.delAppVarButtonVisibility = true;
					}
				} else if (oPreparedObject.isS4HanaCloud) {
					// S4 Hana Cloud and no target mappings => not deleteable
					oDelAppVarObject.delAppVarButtonEnabled = false;
					// TODO: When deletion works E2E, then uncomment line 82 and remove line 83
					// oDelAppVarObject.delAppVarButtonVisibility = true;
					oDelAppVarObject.delAppVarButtonVisibility = false;
				} else {
					// S4 Hana on Premise and no target mappings => deleteable
					oDelAppVarObject.delAppVarButtonEnabled = true;
					oDelAppVarObject.delAppVarButtonVisibility = true;
				}
			} else {
				// Not a key user => not deleteable
				oDelAppVarObject.delAppVarButtonEnabled = false;
				oDelAppVarObject.delAppVarButtonVisibility = false;
			}

			return oDelAppVarObject;
		};

		Utils._getNavigationInfo = function(oPreparedObject) {
			var oNavigationObject = {};

			var sSemanticObject = oPreparedObject.startWith.semanticObject;
			var sAction = oPreparedObject.startWith.action;
			var oParams = oPreparedObject.startWith.parameters;

			var oNavigationParams = {
				semanticObject : sSemanticObject,
				action : sAction,
				params: oParams
			};
{'fraction_non_alphanumeric': 0.09622587150677038, 'fraction_numerical': 0.007922788821665225, 'mean_word_length': 3.938122332859175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '365412', 'n_tokens_mistral': 2684, 'n_tokens_neox': 2228, 'n_words': 423}