@sapui5/sap.ushell_abap 1.94.1 → 1.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/package.json +1 -1
  2. package/src/main/js/sap/ui2/srvc/ODataWrapper.js +1 -1
  3. package/src/main/js/sap/ushell_abap/.library +4 -9
  4. package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +12 -5
  5. package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +11 -7
  6. package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +47 -32
  7. package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -1
  8. package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +46 -38
  9. package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +574 -454
  10. package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
  11. package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +25 -15
  12. package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +3 -2
  13. package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +16 -7
  14. package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
  15. package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +8 -8
  16. package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
  17. package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +11 -4
  18. package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +9 -3
  19. package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +13 -11
  20. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-dev.js +1 -1
  21. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +1 -1
  22. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +8 -4
  23. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +1 -1
  24. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +9 -0
  25. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +12 -5
  26. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +21 -22
  27. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +8 -2
  28. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +6 -3
  29. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +10 -5
  30. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +7 -4
  31. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +10 -3
  32. package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +21 -16
  33. package/src/main/js/sap/ushell_abap/library.js +2 -2
  34. package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +186 -0
  35. package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +718 -0
  36. package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +930 -0
  37. package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +1027 -0
  38. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +216 -0
  39. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +951 -0
  40. package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +45 -0
  41. package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +647 -0
  42. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +251 -0
  43. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1262 -0
  44. package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +920 -0
  45. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1498 -0
  46. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +466 -0
  47. package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +52 -0
  48. package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +767 -0
  49. package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +139 -0
  50. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +244 -0
  51. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +150 -0
  52. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +165 -0
  53. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +330 -0
  54. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +70 -0
  55. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +50 -0
  56. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +289 -0
  57. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +43 -0
  58. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +115 -0
  59. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +9 -0
  60. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +105 -0
  61. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +128 -0
  62. package/ui5.yaml +31 -0
  63. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/Component.js +0 -426
  64. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/css/style.css +0 -1
  65. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n.properties +0 -56
  66. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ar.properties +0 -36
  67. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_bg.properties +0 -36
  68. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ca.properties +0 -36
  69. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cs.properties +0 -36
  70. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cy.properties +0 -36
  71. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_da.properties +0 -36
  72. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_de.properties +0 -36
  73. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_el.properties +0 -36
  74. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en.properties +0 -36
  75. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_GB.properties +0 -36
  76. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_sappsd.properties +0 -36
  77. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saprigi.properties +0 -36
  78. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saptrc.properties +0 -36
  79. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es.properties +0 -36
  80. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es_MX.properties +0 -36
  81. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_et.properties +0 -36
  82. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fi.properties +0 -36
  83. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr.properties +0 -36
  84. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr_CA.properties +0 -36
  85. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hi.properties +0 -36
  86. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hr.properties +0 -36
  87. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hu.properties +0 -36
  88. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_id.properties +0 -36
  89. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_it.properties +0 -36
  90. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_iw.properties +0 -36
  91. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ja.properties +0 -36
  92. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_kk.properties +0 -36
  93. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ko.properties +0 -36
  94. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lt.properties +0 -36
  95. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lv.properties +0 -36
  96. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ms.properties +0 -36
  97. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_nl.properties +0 -36
  98. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_no.properties +0 -36
  99. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pl.properties +0 -36
  100. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt.properties +0 -36
  101. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt_PT.properties +0 -36
  102. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ro.properties +0 -36
  103. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ru.properties +0 -36
  104. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sh.properties +0 -36
  105. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sk.properties +0 -36
  106. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sl.properties +0 -36
  107. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sv.properties +0 -36
  108. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_th.properties +0 -36
  109. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_tr.properties +0 -36
  110. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_uk.properties +0 -36
  111. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_vi.properties +0 -36
  112. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_CN.properties +0 -36
  113. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_TW.properties +0 -36
  114. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/manifest.json +0 -153
  115. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/model/models.js +0 -14
@@ -0,0 +1,951 @@
1
+ // Copyright (c) 2009-2021 SAP SE. All rights reserved.
2
+
3
+ /**
4
+ * @fileOverview The <code>sap.ushell_abap.pbServices.ui2.ChipInstance</code> object with related functions.
5
+ */
6
+
7
+ this.sap = this.sap || {};
8
+
9
+ sap.ui.define([
10
+ "sap/ushell_abap/pbServices/ui2/Bag",
11
+ "sap/ushell_abap/pbServices/ui2/Utils",
12
+ "sap/ushell_abap/pbServices/ui2/Error",
13
+ "sap/base/Log"
14
+ ], function (
15
+ Bag,
16
+ Utils,
17
+ SrvcError,
18
+ Log
19
+ ) {
20
+ "use strict";
21
+
22
+ // "public class" -----------------------------------------------------------
23
+
24
+ /**
25
+ * Constructs a new representation (wrapper) of the CHIP instance with the given
26
+ * CHIP instance data as loaded from the page building service. A CHIP instance is a usage of a
27
+ * CHIP in a page
28
+ * <p>
29
+ * Initially a stub is created, which can later load its properties and related objects
30
+ * asynchronously.
31
+ * <p>
32
+ * A CHIP instance is a mutable object and (page building service related) changes can be
33
+ * persisted by the page building service.
34
+ *
35
+ * @param {sap.ushell_abap.pbServices.ui2.Factory} oFactory
36
+ * the factory
37
+ * @param {object} oAlterEgo
38
+ * the CHIP instance data as loaded via the page building service, including embedded
39
+ * CHIP instance property bags
40
+ * @param {sap.ushell_abap.pbServices.ui2.Chip} oChip
41
+ * the CHIP (which might still be a stub)
42
+ * @param {sap.ushell_abap.pbServices.ui2.Page} [oPage]
43
+ * (since 1.9.0) the page to which this CHIP instance belongs
44
+ *
45
+ * @class
46
+ * @see sap.ushell_abap.pbServices.ui2.PageBuildingService
47
+ * @since 1.2.0
48
+ */
49
+ var ChipInstance = function (oFactory, oAlterEgo, oChip, oPage) {
50
+ var oApi,
51
+ oBags,
52
+ oConfiguration,
53
+ oContractsByName = new Utils.Map(),
54
+ bFullscreen = false,
55
+ aFullscreenHandlers = [],
56
+ fnRefreshHandler,
57
+ sTitle, // no own temporary title so far
58
+ fnTitleChange,
59
+ that = this;
60
+
61
+ // BEWARE: constructor code below!
62
+
63
+ // "private" methods ------------------------------------------------------
64
+
65
+ /**
66
+ * The alter ego object has some properties indicating that a CHIP instance is a reference.
67
+ * This method modifies those properties in a way, that this CHIP instance becomes a
68
+ * non-reference.
69
+ * Should be called when an action was executed which made a reference CHIP instance a
70
+ * non-reference in the backend.
71
+ * @private
72
+ */
73
+ function makeNonReference () {
74
+ // note: server sets "" (instead of undefined) for non-references
75
+ oAlterEgo.referenceChipInstanceId = "";
76
+ oAlterEgo.referencePageId = "";
77
+ }
78
+
79
+ /**
80
+ * @see sap.ushell_abap.pbServices.ui2#Bag
81
+ * @param {sap.ushell_abap.pbServices.ui2.Bag} oBag
82
+ * unused
83
+ * @private
84
+ */
85
+ function bagChangeHandler () {
86
+ // copy on write: cannot be a reference anymore!
87
+ makeNonReference();
88
+
89
+ if (oPage) {
90
+ // bag changes may result in Scope changes of the page
91
+ oPage.updateScope();
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Makes sure this CHIP instance is not just a stub.
97
+ *
98
+ * @private
99
+ */
100
+ function checkStub () {
101
+ if (!oApi) {
102
+ throw new SrvcError(that + ": CHIP instance is just a stub",
103
+ "ChipInstance");
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Complete the construction of a CHIP instance and make it ready for full use
109
+ * within a page builder: create CHIP API.
110
+ *
111
+ * @param {function ()} fnSuccess
112
+ * no-args success handler
113
+ * @param {function (string=)} [fnFailure]
114
+ * error handler, taking an optional error message
115
+ *
116
+ * @private
117
+ */
118
+ function initialize (fnSuccess, fnFailure) {
119
+ if (!oApi) {
120
+ oApi = oChip.createApi(that, oContractsByName);
121
+ }
122
+
123
+ Log.debug("Initialized: " + that, null, "ChipInstance");
124
+ Utils.callHandler(fnSuccess, fnFailure); // Note: this method was already called async.
125
+ }
126
+
127
+ /**
128
+ * Initialize the bags from raw CHIP instance bags array.
129
+ * @param {object[]} aRawChipInstanceBags
130
+ * Array of raw CHIP instance bags
131
+ *
132
+ * @private
133
+ */
134
+ function initializeBags (aRawChipInstanceBags) {
135
+ var i,
136
+ aChipBagIds = oChip.getBagIds(),
137
+ oRawBag;
138
+ for (i = 0; i < aRawChipInstanceBags.length; i += 1) {
139
+ oBags.put(aRawChipInstanceBags[i].id,
140
+ new Bag(oFactory, aRawChipInstanceBags[i],
141
+ oChip.getBag(aRawChipInstanceBags[i].id), bagChangeHandler));
142
+ }
143
+ for (i = 0; i < aChipBagIds.length; i += 1) {
144
+ oRawBag = {
145
+ pageId: oAlterEgo.pageId,
146
+ instanceId: oAlterEgo.instanceId,
147
+ id: aChipBagIds[i],
148
+ $tmp: true
149
+ };
150
+ if (!oBags.containsKey(oRawBag.id)) { // do not overwrite CHIP instance bags!
151
+ oBags.put(oRawBag.id,
152
+ new Bag(oFactory, oRawBag, oChip.getBag(oRawBag.id), bagChangeHandler));
153
+ }
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Lazily initialize this CHIP instance's configuration. Requires a complete
159
+ * CHIP, not just a stub!
160
+ *
161
+ * @private
162
+ */
163
+ function initializeConfiguration () {
164
+ if (oChip.isStub()) {
165
+ // BCP 1780175765
166
+ // fail early as updateConfiguration will also throw in this case which results in
167
+ // oConfig being initialized wrongly to an empty object
168
+ throw new SrvcError(this + ": initializeConfiguration expects that the CHIP is no stub anymore",
169
+ "ChipInstance", /*bLogError*/false);
170
+ }
171
+
172
+ if (!oConfiguration) {
173
+ oConfiguration = {};
174
+ oChip.updateConfiguration(oConfiguration, oAlterEgo.configuration);
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Persists this CHIP instance.
180
+ *
181
+ * @param {function ()} [fnSuccess]
182
+ * no-args success handler
183
+ * @param {function (string, object=)} [fnFailure]
184
+ * error handler taking an error message and, since version 1.28.6, an
185
+ * optional object containing the complete error information as delivered
186
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
187
+ * for more details.
188
+ * Default: see {@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}
189
+ *
190
+ * @private
191
+ */
192
+ this.persist = function (fnSuccess, fnFailure) {
193
+ oFactory.getPageBuildingService().updatePageChipInstance(oAlterEgo,
194
+ function () {
195
+ // copy on write: we cannot be a reference anymore!
196
+ makeNonReference();
197
+
198
+ if (oPage) {
199
+ oPage.updateScope();
200
+ }
201
+ if (fnSuccess) {
202
+ fnSuccess(); // no-args!
203
+ }
204
+ }, fnFailure);
205
+ };
206
+
207
+ // "public" methods -------------------------------------------------------
208
+
209
+ /**
210
+ * Attaches the given event handler to the "fullscreen" event which is fired whenever
211
+ * fullscreen mode is toggled. There can be multiple handlers at any time.
212
+ *
213
+ * Use <code>Function.prototype.bind()</code> to determine the event handler's
214
+ * <code>this</code> or some of its arguments.
215
+ *
216
+ * Note: Without such an event handler, the CHIP will simply continue to display the
217
+ * same content, no matter whether fullscreen mode is on or off.
218
+ *
219
+ * @param {function} fnEventHandler
220
+ * the event handler for the "fullscreen" event
221
+ * @since 1.2.0
222
+ */
223
+ this.attachFullscreen = function (fnEventHandler) {
224
+ if (typeof fnEventHandler !== "function") {
225
+ throw new SrvcError(this + ": fullscreen event handler is not a function",
226
+ "ChipInstance");
227
+ }
228
+ aFullscreenHandlers.push(fnEventHandler);
229
+ };
230
+
231
+ /**
232
+ * Attaches the given event handler to the "refresh" event which is fired
233
+ * whenever the user requests a refresh of this CHIP instance's content.
234
+ *
235
+ * Use <code>Function.prototype.bind()</code> to determine the event handler's
236
+ * <code>this</code> or some of its arguments.
237
+ *
238
+ * Note: Without such an event handler, the CHIP will be recreated to enforce a refresh!
239
+ *
240
+ * @param {function} [fnEventHandler]
241
+ * the event handler for the "refresh" event
242
+ * @since 1.2.0
243
+ */
244
+ this.attachRefresh = function (fnEventHandler) {
245
+ if (fnEventHandler && typeof fnEventHandler !== "function") {
246
+ throw new SrvcError(this + ": refresh event handler is not a function",
247
+ "ChipInstance");
248
+ }
249
+ fnRefreshHandler = fnEventHandler;
250
+ };
251
+
252
+ /**
253
+ * Attaches the listener that is notified when setTitle is called. The caller
254
+ * may be the page builder as well as the CHIP.
255
+ *
256
+ * @param {function (sap.ushell_abap.pbServices.ui2.ChipInstance)} fnNewTitleChange
257
+ * the listener function, it will be called with the instance as parameter;
258
+ * may be <code>null</code> to remove the listener
259
+ * @since 1.2.0
260
+ */
261
+ this.attachTitleChange = function (fnNewTitleChange) {
262
+ fnTitleChange = fnNewTitleChange;
263
+ };
264
+
265
+ /**
266
+ * Detaches all event handlers from all events.
267
+ *
268
+ * @since 1.2.0
269
+ */
270
+ this.detachAll = function () {
271
+ aFullscreenHandlers = [];
272
+ fnRefreshHandler = null;
273
+ };
274
+
275
+ /**
276
+ * Releases all resources associated with this CHIP instance. Call this method
277
+ * just before you stop using it.
278
+ *
279
+ * @since 1.2.0
280
+ */
281
+ this.exit = function () {
282
+ Log.debug("Exit: " + that, null, "ChipInstance");
283
+
284
+ // Note: CHIPs are shared objects, do not exit them!
285
+
286
+ // reset to initial state
287
+ oApi = null;
288
+ oBags = new Utils.Map();
289
+ oConfiguration = null;
290
+ sTitle = null;
291
+ fnTitleChange = null;
292
+ };
293
+
294
+ /**
295
+ * Returns this CHIP instance's specific API instance.
296
+ *
297
+ * @returns {object}
298
+ * this CHIP instance's specific API instance
299
+ * @since 1.2.0
300
+ */
301
+ this.getApi = function () {
302
+ return oApi;
303
+ };
304
+
305
+ /**
306
+ * Returns an array of bag IDs attached to this CHIP instance.
307
+ *
308
+ * @returns {string[]}
309
+ * array of bag IDs
310
+ * @since 1.5.0
311
+ */
312
+ this.getBagIds = function () {
313
+ return oBags.keys();
314
+ };
315
+
316
+ /**
317
+ * Returns the property bag with given ID attached to this CHIP instance.
318
+ * <p>
319
+ * If there is no bag with that ID an empty bag is returned.
320
+ *
321
+ * @param {string} sBagId
322
+ * the bag ID
323
+ *
324
+ * @returns {sap.ushell_abap.pbServices.ui2.Bag}
325
+ * the CHIP instance's bag for given ID
326
+ * @since 1.5.0
327
+ */
328
+ this.getBag = function (sBagId) {
329
+ var oBag;
330
+
331
+ if (!sBagId) {
332
+ throw new SrvcError("Missing bag ID", "ChipInstance");
333
+ }
334
+
335
+ oBag = oBags.get(sBagId);
336
+ if (oBag) {
337
+ return oBag;
338
+ }
339
+
340
+ oBag = new Bag(oFactory,
341
+ { pageId: oAlterEgo.pageId, instanceId: oAlterEgo.instanceId, id: sBagId, $tmp: true },
342
+ /*oParentBag*/null,
343
+ bagChangeHandler);
344
+ oBags.put(sBagId, oBag);
345
+ return oBag;
346
+ };
347
+
348
+ /**
349
+ * Returns this instance's CHIP.
350
+ *
351
+ * @returns {sap.ushell_abap.pbServices.ui2.Chip}
352
+ * this instance's CHIP
353
+ * @since 1.2.0
354
+ */
355
+ this.getChip = function () {
356
+ return oChip;
357
+ };
358
+
359
+ /**
360
+ * Get the persisted CHIP instance configuration as string.
361
+ *
362
+ * @returns {string}
363
+ * the persisted configuration
364
+ * @since 1.11.0
365
+ * @private
366
+ */
367
+ this.getConfiguration = function () {
368
+ return oAlterEgo.configuration;
369
+ };
370
+
371
+ /**
372
+ * Retrieves a parameter value from the CHIP instance configuration, the
373
+ * CHIP configuration or the CHIP definition.
374
+ *
375
+ * @param {string} sKey
376
+ * the key
377
+ * @returns {string}
378
+ * the configuration parameter value or <code>undefined</code> if unknown
379
+ * @since 1.2.0
380
+ */
381
+ this.getConfigurationParameter = function (sKey) {
382
+ initializeConfiguration();
383
+ if (Object.prototype.hasOwnProperty.call(oConfiguration, sKey)) {
384
+ return oConfiguration[sKey];
385
+ }
386
+ return oChip.getConfigurationParameter(sKey);
387
+ };
388
+
389
+ /**
390
+ * @namespace The (pseudo) namespace for the instance specific CHIP API. Note that there is no
391
+ * global <code>window.chip</code> property. Instead, you can access the instance specific CHIP
392
+ * API from the view data of the SAPUI5 view (<code>sap.ui.core.mvc.View#getViewData()</code>)
393
+ * in the CHIP coding. For CHIPs based on components, call
394
+ * <code>sap.ui.core.UIComponent#getComponentData()</code> instead. In both cases, the property
395
+ * is simply called <code>chip</code>.
396
+ * @name chip
397
+ * @since 1.2.0
398
+ *
399
+ * @see sap.ushell_abap.pbServices.ui2.ChipInstance#getImplementationAsSapui5
400
+ */
401
+
402
+ /**
403
+ * @namespace The (pseudo) namespace for contract interfaces (to be used by a page builder).
404
+ * Note that there is no global <code>window.contract</code> property. Instead, you can access
405
+ * contracts by {@link sap.ushell_abap.pbServices.ui2.ChipInstance#getContract}.
406
+ *
407
+ * @name contract
408
+ * @since 1.11.0
409
+ *
410
+ * @see sap.ushell_abap.pbServices.ui2.ChipInstance#getContract
411
+ */
412
+
413
+ /**
414
+ * Returns the contract interface (to be used by a page builder) for the given contract name.
415
+ * Can only be called if the CHIP instance is not a stub anymore.
416
+ * Note that a separate contract interface is optional and need not be available for each
417
+ * and every contract!
418
+ *
419
+ * @param {string} sName
420
+ * the name of a contract, e.g. "url"
421
+ * @returns {object}
422
+ * an optional contract interface to be used by a page builder; may be <code>undefined</code>
423
+ * @since 1.11.0
424
+ *
425
+ * @see #isStub()
426
+ */
427
+ this.getContract = function (sName) {
428
+ checkStub();
429
+ return oContractsByName.get(sName);
430
+ };
431
+
432
+ /**
433
+ * Tells whether the fullscreen mode is currently turned on.
434
+ *
435
+ * @returns {boolean}
436
+ * whether fullscreen mode is turned on
437
+ * @since 1.2.0
438
+ */
439
+ this.getFullscreen = function () {
440
+ return bFullscreen;
441
+ };
442
+
443
+ /**
444
+ * Returns this CHIP instance's ID, as defined within the page building service.
445
+ *
446
+ * @returns {string}
447
+ * this CHIP instance's ID
448
+ * @since 1.2.0
449
+ */
450
+ this.getId = function () {
451
+ return oAlterEgo.instanceId;
452
+ };
453
+
454
+ /**
455
+ * Returns this CHIP instance's implementation of type SAPUI5 as a control. This control
456
+ * represents the root of this CHIP instance's UI from a page builder point of view. Can only
457
+ * be called if the CHIP instance is not a stub anymore.
458
+ *
459
+ * @returns {sap.ui.core.Control}
460
+ * this CHIP instance's SAPUI5 implementation as a control
461
+ * @since 1.2.0
462
+ *
463
+ * @see #isStub()
464
+ */
465
+ this.getImplementationAsSapui5 = function () {
466
+ checkStub();
467
+ return oChip.getImplementationAsSapui5(oApi);
468
+ };
469
+
470
+ /**
471
+ * Returns this CHIP instance's implementation of type SAPUI5 as a control. This control
472
+ * represents the root of this CHIP instance's UI from a page builder point of view. Can only
473
+ * be called if the CHIP instance is not a stub anymore.
474
+ *
475
+ * @returns {Promise<sap.ui.core.Control>}
476
+ * resolves this CHIP instance's SAPUI5 implementation as a control
477
+ * @since 1.97.0
478
+ *
479
+ * @see #isStub()
480
+ */
481
+ this.getImplementationAsSapui5Async = function () {
482
+ return new Promise(function (resolve, reject) {
483
+ checkStub();
484
+ resolve(oChip.getImplementationAsSapui5(oApi));
485
+ });
486
+ };
487
+
488
+ /**
489
+ * Returns this CHIP instance's layout data as defined by the page building service.
490
+ *
491
+ * @returns {string}
492
+ * this CHIP instance's layout data
493
+ * @since 1.2.0
494
+ */
495
+ this.getLayoutData = function () {
496
+ return oAlterEgo.layoutData;
497
+ };
498
+
499
+ /**
500
+ * Returns this CHIP instance's page if it has been passed explicitly to our constructor or
501
+ * the corresponding factory method, or if this CHIP instance has been created by its page.
502
+ *
503
+ * @returns {sap.ushell_abap.pbServices.ui2.Page}
504
+ * this CHIP instance's page, which might be unknown (<code>undefined</code>)
505
+ * @since 1.9.0
506
+ * @see sap.ushell_abap.pbServices.ui2.ChipInstance
507
+ * @see sap.ushell_abap.pbServices.ui2.Factory#createChipInstance
508
+ * @see sap.ushell_abap.pbServices.ui2.Page#addChipInstance
509
+ * @see sap.ushell_abap.pbServices.ui2.Page#load
510
+ * @see sap.ushell_abap.pbServices.ui2.Page#removeChipInstance
511
+ */
512
+ this.getPage = function () {
513
+ return oPage;
514
+ };
515
+
516
+ /**
517
+ * Returns this instance's title.
518
+ *
519
+ * @returns {string}
520
+ * this instance's title
521
+ * @since 1.2.0
522
+ */
523
+ this.getTitle = function () {
524
+ // Note: we cannot have a falsy temporary title nor can we persist one!
525
+ return sTitle || oAlterEgo.title || oChip.getTitle();
526
+ };
527
+
528
+ /**
529
+ * Returns the instance's latest update date, as given by the backend.
530
+ * May return <code>undefined</code> in case the CHIP instance is a stub or the date could not
531
+ * be parsed.
532
+ *
533
+ * @param {boolean} [bInRawFormat=false]
534
+ * When set to false (default), the date will be returned as <code>date</code>. When set to
535
+ * true, the value will be returned as given from the backend, which means as a
536
+ * <code>string</code> like <code>"/Date(1415104869000)/"</code>.
537
+ * @returns {date|string}
538
+ * The latest update date returned as date or string. May be undefined in case of a stub.
539
+ * @private
540
+ */
541
+ this.getUpdated = function (bInRawFormat) {
542
+ //TODO after an update of the instance, the new value must be updated in oAlterEgo
543
+ function parsingFailed () {
544
+ Log.error("Parse Error: CHIP instance's updated property has unexpected format",
545
+ "value of updated property: '" + oAlterEgo.updated + "'", "ChipInstance");
546
+ }
547
+
548
+ var aMatches, oResultDate;
549
+ if (oAlterEgo.updated && !bInRawFormat) {
550
+ // ODate V2: format looks like "/Date(1415104869000)/"
551
+ aMatches = /\((\d*)\)/.exec(oAlterEgo.updated);
552
+
553
+ if (!aMatches) {
554
+ parsingFailed();
555
+ return undefined;
556
+ }
557
+
558
+ // Note: parseInt does not throw but returns NaN, new Date(NaN) returns InvalidDate
559
+ oResultDate = new Date(parseInt(aMatches[1], 10));
560
+
561
+ if (isNaN(oResultDate.getTime())) {
562
+ parsingFailed();
563
+ return undefined;
564
+ }
565
+ return oResultDate;
566
+ }
567
+ return oAlterEgo.updated;
568
+ };
569
+
570
+ /**
571
+ * Tells whether this CHIP instance is marked as outdated.
572
+ *
573
+ * @returns {boolean}
574
+ * whether this CHIP instance is marked as outdated
575
+ * @since 1.9.1
576
+ */
577
+ this.isOutdated = function () {
578
+ return oAlterEgo.outdated === "X";
579
+ };
580
+
581
+ /**
582
+ * Tells whether this CHIP instance is readOnly.
583
+ *
584
+ * @throws Error if the CHIP instance is still a stub
585
+ * @returns {boolean}
586
+ * whether this CHIP instance is readOnly
587
+ * @since 1.32.0
588
+ */
589
+ this.isReadOnly = function () {
590
+ checkStub();
591
+ return oAlterEgo.isReadOnly === "X";
592
+ };
593
+
594
+ /**
595
+ * Tells whether this CHIP instance is a reference, pointing to its original CHIP instance.
596
+ *
597
+ * @returns {boolean}
598
+ * whether this CHIP instance is a reference
599
+ * @since 1.19.1
600
+ * @see #getOriginalId()
601
+ * @see #getOriginalPageId()
602
+ * @see #isBrokenReference()
603
+ */
604
+ this.isReference = function () {
605
+ // note in 1.36- and earlier broken references had the following properties:
606
+ // referencePageId: "O",
607
+ // referenceChipInstanceId: ""
608
+ return !!oAlterEgo.referenceChipInstanceId || !!oAlterEgo.referencePageId;
609
+ };
610
+
611
+ /**
612
+ * Tells whether this CHIP instance is a broken reference, which means the original has been deleted.
613
+ *
614
+ * @returns {boolean}
615
+ * whether this CHIP instance is a broken reference
616
+ * @since 1.36.1
617
+ * @see #isReference()
618
+ */
619
+ this.isBrokenReference = function () {
620
+ // note in 1.36- and earlier broken references had the following properties:
621
+ // referencePageId: "O",
622
+ // referenceChipInstanceId: ""
623
+ return oAlterEgo.referenceChipInstanceId === "O" || oAlterEgo.referencePageId === "O";
624
+ };
625
+
626
+ /**
627
+ * If this CHIP instance is a reference, this method returns the ID of the original
628
+ * CHIP instance. If not <code>undefined</code> is returned.
629
+ *
630
+ * @returns {string}
631
+ * The original CHIP instance ID or <code>undefined</code>
632
+ * @since 1.34.0
633
+ * @see #isReference()
634
+ * @see #getOriginalPageId()
635
+ */
636
+ this.getOriginalId = function () {
637
+ // the server returns "" for non-references but this is mapped to undefined here as this is
638
+ // more JavaScript-like. In addition "O" is removed as it is indicating that the original was deleted.
639
+ return (oAlterEgo.referenceChipInstanceId === "" || oAlterEgo.referenceChipInstanceId === "O") ?
640
+ undefined : oAlterEgo.referenceChipInstanceId;
641
+ };
642
+
643
+ /**
644
+ * If this CHIP instance is a reference, this method returns the page ID of the original CHIP
645
+ * instance's page. If not <code>undefined</code> is returned.
646
+ *
647
+ * @returns {string}
648
+ * Page ID of the original CHIP instance's page or <code>undefined</code>
649
+ * @since 1.34.0
650
+ * @see #isReference()
651
+ * @see #getOriginalId()
652
+ */
653
+ this.getOriginalPageId = function () {
654
+ // the server returns "" for non-references but this is mapped to undefined here as this is
655
+ // more JavaScript-like. In addition "O" is removed as it is indicating that the original was deleted.
656
+ return (oAlterEgo.referencePageId === "" || oAlterEgo.referencePageId === "O") ?
657
+ undefined : oAlterEgo.referencePageId;
658
+ };
659
+
660
+ /**
661
+ * Tells whether this CHIP instance is still only a stub and needs to be loaded.
662
+ *
663
+ * @returns {boolean}
664
+ * whether this CHIP instance is still only a stub
665
+ * @since 1.2.0
666
+ *
667
+ * @see #load()
668
+ */
669
+ this.isStub = function () {
670
+ return !oApi;
671
+ };
672
+
673
+ /**
674
+ * Completes the construction of a CHIP instance and makes it ready for full use
675
+ * within a page builder: loads CHIP definition XML, creates CHIP API.
676
+ *
677
+ * @param {function ()} fnSuccess
678
+ * no-args success handler
679
+ * @param {function (string, object=)} [fnFailure]
680
+ * error handler taking an error message and, since version 1.28.6, an
681
+ * optional object containing the complete error information as delivered
682
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
683
+ * for more details.
684
+ * Default: see {@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}
685
+ * @since 1.2.0
686
+ */
687
+ this.load = function (fnSuccess, fnFailure) {
688
+ //TODO disallow multiple calls?
689
+ var fnLoad;
690
+
691
+ fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
692
+ fnLoad = initialize.bind(null, fnSuccess, fnFailure);
693
+
694
+ if (oChip.isStub()) {
695
+ oChip.load(fnLoad, fnFailure);
696
+ } else {
697
+ Utils.callHandler(fnLoad, fnFailure, true);
698
+ }
699
+ };
700
+
701
+ /**
702
+ * Removes this CHIP instance from its page. This deletes the page CHIP instance
703
+ * within the page building service! Since 1.9.0 it also removes it from the page to which this
704
+ * CHIP instance belongs, as long as that page is known.
705
+ * <p>
706
+ * Note: Does not affect the page's layout.
707
+ * <p>
708
+ * Note (since 1.9.0): Call either {@link sap.ushell_abap.pbServices.ui2.ChipInstance#remove} or
709
+ * {@link sap.ushell_abap.pbServices.ui2.Page#removeChipInstance}, the result will be the same!
710
+ *
711
+ * @param {function ()} [fnSuccess]
712
+ * no-args success handler
713
+ * @param {function (string, object=)} [fnFailure]
714
+ * error handler taking an error message and, since version 1.28.6, an
715
+ * optional object containing the complete error information as delivered
716
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
717
+ * for more details.
718
+ * If not given
719
+ * <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
720
+ * @since 1.2.0
721
+ *
722
+ * @see #getPage
723
+ * @see sap.ushell_abap.pbServices.ui2.Page#removeChipInstance
724
+ */
725
+ this.remove = function (fnSuccess, fnFailure) {
726
+ if (oPage && oPage.removeChipInstance(that, fnSuccess, fnFailure)) {
727
+ return; // wait, page will call us again!
728
+ }
729
+
730
+ this.exit();
731
+ oFactory.getPageBuildingService().deletePageChipInstance(
732
+ oAlterEgo.pageId,
733
+ oAlterEgo.instanceId,
734
+ fnSuccess,
735
+ fnFailure
736
+ );
737
+ };
738
+
739
+ /**
740
+ * Calls refresh handler if registered. Returns <code>true</code> if refresh handler has been
741
+ * called successfully.
742
+ *
743
+ * @returns {boolean}
744
+ * <code>true</code> if refresh handler has been called successfully
745
+ * @since 1.2.0
746
+ */
747
+ this.refresh = function () {
748
+ if (fnRefreshHandler) {
749
+ try {
750
+ fnRefreshHandler(); // Note: "this" is undefined
751
+ return true;
752
+ } catch (ex) {
753
+ Log.error(that + ": call to refresh handler failed: "
754
+ + (ex.message || ex.toString()), null, "ChipInstance");
755
+ return false;
756
+ }
757
+ }
758
+ return false;
759
+ };
760
+
761
+ /**
762
+ * Turns the fullscreen mode on as indicated. Calls the attached listener in case the mode
763
+ * has changed.
764
+ *
765
+ * @param {boolean} bOn
766
+ * whether fullscreen mode is turned on
767
+ * @since 1.2.0
768
+ */
769
+ this.setFullscreen = function (bOn) {
770
+ var i, n;
771
+
772
+ if (bFullscreen !== bOn) {
773
+ bFullscreen = bOn;
774
+
775
+ for (i = 0, n = aFullscreenHandlers.length; i < n; i += 1) {
776
+ aFullscreenHandlers[i]();
777
+ }
778
+ }
779
+ };
780
+
781
+ /**
782
+ * Determines this CHIP instance's layout data (encoded as a string, for
783
+ * example in JSON) and persists it.
784
+ *
785
+ * @param {string} sLayoutData
786
+ * the new layout data
787
+ * @param {function ()} [fnSuccess]
788
+ * no-args success handler
789
+ * @param {function (string, object=)} [fnFailure]
790
+ * error handler taking an error message and, since version 1.28.6, an
791
+ * optional object containing the complete error information as delivered
792
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
793
+ * for more details.
794
+ * Default: see {@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}
795
+ * @since 1.2.0
796
+ */
797
+ this.setLayoutData = function (sLayoutData, fnSuccess, fnFailure) {
798
+ if (oAlterEgo.layoutData === sLayoutData) {
799
+ if (fnSuccess) {
800
+ fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
801
+ Utils.callHandler(fnSuccess, fnFailure, true);
802
+ }
803
+ return;
804
+ }
805
+ oAlterEgo.layoutData = sLayoutData;
806
+ this.persist(fnSuccess, fnFailure);
807
+ };
808
+
809
+ /**
810
+ * Changes this instance's title and persists it if requested. The title change
811
+ * listener (see {@link #attachTitleChange}) is called.
812
+ *
813
+ * This method is not reentrant.
814
+ *
815
+ * @param {string} sNewTitle
816
+ * the new title
817
+ * @param {boolean} [bDoPersist=false]
818
+ * whether the change shall be persisted
819
+ * @param {function ()} [fnSuccess]
820
+ * no-args success handler
821
+ * @param {function (string, object=)} [fnFailure]
822
+ * error handler taking an error message and, since version 1.28.6, an
823
+ * optional object containing the complete error information as delivered
824
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
825
+ * for more details.
826
+ * Default: see {@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}
827
+ * @since 1.2.0
828
+ *
829
+ * @see #getPage()
830
+ * @see sap.ushell_abap.pbServices.ui2.Page#getOriginalLanguage()
831
+ */
832
+ this.setTitle = function (sNewTitle, bDoPersist, fnSuccess, fnFailure) {
833
+ var sOldTitle;
834
+ fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
835
+
836
+ if (sTitle !== sNewTitle) {
837
+ // adjust temporary title
838
+ sTitle = sNewTitle;
839
+
840
+ if (fnTitleChange) {
841
+ // if called by CHIP: make sure listener runs asynchronously
842
+ // (thus not during initial rendering)
843
+ Utils.callHandler(
844
+ fnTitleChange.bind(null, this),
845
+ fnFailure,
846
+ !bDoPersist
847
+ );
848
+ }
849
+ }
850
+
851
+ if (bDoPersist && oAlterEgo.title !== sTitle) {
852
+ sOldTitle = oAlterEgo.title;
853
+ oAlterEgo.title = sTitle;
854
+ sTitle = undefined;
855
+ this.persist(fnSuccess, function () {
856
+ // restore old title in case of failure
857
+ oAlterEgo.title = sOldTitle;
858
+ // reset temporary title too
859
+ sTitle = undefined;
860
+
861
+ fnFailure.apply(null, arguments);
862
+ });
863
+ } else if (fnSuccess) {
864
+ Utils.callHandler(fnSuccess, fnFailure, true);
865
+ }
866
+ };
867
+
868
+ /**
869
+ * Returns this CHIP instance's string representation.
870
+ *
871
+ * @param {boolean} [bVerbose=false]
872
+ * flag whether to show all properties
873
+ * @returns {string}
874
+ * this CHIP instance's string representation
875
+ * @since 1.2.0
876
+ */
877
+ this.toString = function (bVerbose) {
878
+ var aResult = ["ChipInstance({oChip:", oChip.toString(bVerbose),
879
+ ",bFullscreen:", bFullscreen
880
+ ];
881
+ if (bVerbose) {
882
+ aResult.push(",oAlterEgo:", JSON.stringify(oAlterEgo),
883
+ ",oApi:", JSON.stringify(oApi),
884
+ ",oBags:", oBags.toString(),
885
+ ",oConfiguration:", JSON.stringify(oConfiguration),
886
+ ",oFactory:", oFactory.toString(bVerbose),
887
+ ",aFullscreenHandlers.length:", aFullscreenHandlers.length,
888
+ ',sTitle:"', sTitle, '"'
889
+ );
890
+ }
891
+ aResult.push("})");
892
+ return aResult.join("");
893
+ };
894
+
895
+ /**
896
+ * Updates the configuration. All parameters that actually were defined in the CHIP definition
897
+ * XML are accepted. All others will raise a warning to the log.
898
+ * <p>
899
+ * The configuration is maintained as JSON string in a single property. This has the following
900
+ * consequences regarding the scopes:
901
+ * <ul>
902
+ * <li>If the CHIP instance has never been persisted in the current scope, the configuration is
903
+ * inherited from lower scopes. If there are no changes either, the properties have their
904
+ * default values from the CHIP definition.
905
+ * <li>When persisting the CHIP instance in a given scope for the first time (may it be due to
906
+ * configuration changes or title changes...), the configuration changes are merged with
907
+ * inherited changes from lower scopes and persisted in the current scope. Subsequent changes
908
+ * in lower scopes will then remain invisible.
909
+ * <li>A property for which never an update was supplied has the default value from the CHIP
910
+ * definition. This also applies if you delete the update again by setting it to
911
+ * <code>undefined</code>.
912
+ * </ul>
913
+ * <b>Example:</b><br>
914
+ * The CHIP has two properties: <code>a</code> with default value "foo" and <code>b</code> with
915
+ * default value "bar". The administrator changes <code>a</code> to "baz" in scope CUST. Later
916
+ * a user changes <code>b</code> in PERS. Then the administrator decides to change
917
+ * <code>a</code> back to "foo", but our user will never see this again, because the system
918
+ * persisted both <code>a</code> and <code>b</code> in PERS.
919
+ *
920
+ * @param {map<String,String>} mConfigurationUpdates
921
+ * The configuration updates. The values must be strings. You can however set a value to
922
+ * <code>undefined</code>. This removes it from the list of updated property and effectively
923
+ * resets it to the default value.
924
+ * @param {function ()} [fnSuccess]
925
+ * no-args success handler
926
+ * @param {function (string, object=)} [fnFailure]
927
+ * error handler taking an error message and, since version 1.28.6, an
928
+ * optional object containing the complete error information as delivered
929
+ * by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
930
+ * for more details.
931
+ * Default: see {@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}
932
+ * @since 1.7.0
933
+ */
934
+ this.updateConfiguration = function (mConfigurationUpdates, fnSuccess, fnFailure) {
935
+ initializeConfiguration();
936
+ oChip.updateConfiguration(oConfiguration, mConfigurationUpdates);
937
+ oAlterEgo.configuration = JSON.stringify(oConfiguration);
938
+ this.persist(fnSuccess, fnFailure);
939
+ };
940
+
941
+ // constructor code -------------------------------------------------------
942
+ oBags = new Utils.Map();
943
+
944
+ initializeBags((oAlterEgo.ChipInstanceBags && oAlterEgo.ChipInstanceBags.results)
945
+ || []);
946
+
947
+ delete oAlterEgo.Chip;
948
+ Log.debug("Created: " + this, null, "ChipInstance");
949
+ };
950
+ return ChipInstance;
951
+ }, true);