@sapui5/sap.ushell_abap 1.97.1 → 1.100.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.
- package/package.json +1 -1
- package/src/main/js/sap/ushell_abap/.library +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +16 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +37 -4
- package/src/main/js/sap/ushell_abap/adapters/abap/MenuAdapter.js +65 -15
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +1577 -36
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-dev.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-loader.js +7 -0
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +13 -10
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.backend.config.requestor.js +198 -0
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +6 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +2 -17
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +10 -16
- package/src/main/js/sap/ushell_abap/library.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +1 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +172 -17
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +14 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +1 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +1 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +0 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +48 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
- package/src/main/js/sap/ushell_abap/support/plugins/app-infra/AppInfraOnSapNetWeaverSupportPlugin.js +1 -1
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +1 -1
- package/ui5.yaml +379 -32
- package/src/main/js/sap/ui2/srvc/ODataService.js +0 -267
- package/src/main/js/sap/ui2/srvc/ODataWrapper.js +0 -1283
- package/src/main/js/sap/ui2/srvc/PageBuildingService.js +0 -1508
- package/src/main/js/sap/ui2/srvc/RemoteCatalogService.js +0 -49
- package/src/main/js/sap/ui2/srvc/allcatalogs.js +0 -197
- package/src/main/js/sap/ui2/srvc/bag.js +0 -711
- package/src/main/js/sap/ui2/srvc/catalog.js +0 -946
- package/src/main/js/sap/ui2/srvc/chip.js +0 -1035
- package/src/main/js/sap/ui2/srvc/chipdefinition.js +0 -228
- package/src/main/js/sap/ui2/srvc/chipinstance.js +0 -944
- package/src/main/js/sap/ui2/srvc/contracts/actions.js +0 -239
- package/src/main/js/sap/ui2/srvc/contracts/bag.js +0 -145
- package/src/main/js/sap/ui2/srvc/contracts/configuration.js +0 -161
- package/src/main/js/sap/ui2/srvc/contracts/configurationUi.js +0 -326
- package/src/main/js/sap/ui2/srvc/contracts/fullscreen.js +0 -69
- package/src/main/js/sap/ui2/srvc/contracts/navigation.js +0 -48
- package/src/main/js/sap/ui2/srvc/contracts/preview.js +0 -289
- package/src/main/js/sap/ui2/srvc/contracts/refresh.js +0 -42
- package/src/main/js/sap/ui2/srvc/contracts/search.js +0 -109
- package/src/main/js/sap/ui2/srvc/contracts/searchProvider.js +0 -46
- package/src/main/js/sap/ui2/srvc/contracts/types.js +0 -9
- package/src/main/js/sap/ui2/srvc/contracts/url.js +0 -104
- package/src/main/js/sap/ui2/srvc/contracts/visible.js +0 -122
- package/src/main/js/sap/ui2/srvc/error.js +0 -54
- package/src/main/js/sap/ui2/srvc/factory.js +0 -656
- package/src/main/js/sap/ui2/srvc/page.js +0 -934
- package/src/main/js/sap/ui2/srvc/pageset.js +0 -466
- package/src/main/js/sap/ui2/srvc/utils.js +0 -923
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +0 -108
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +0 -69
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.validate.Url.js +0 -54
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +0 -50
|
@@ -1,1508 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2009-2020 SAP SE, All Rights Reserved
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileOverview A facade to the page building service, providing all needed
|
|
5
|
-
* CRUD operations based on OData4SAP for the entities page, catalog, CHIP,
|
|
6
|
-
* and CHIP instance.
|
|
7
|
-
*/
|
|
8
|
-
(function () {
|
|
9
|
-
"use strict";
|
|
10
|
-
|
|
11
|
-
/* global OData */
|
|
12
|
-
|
|
13
|
-
jQuery.sap.declare("sap.ui2.srvc.PageBuildingService");
|
|
14
|
-
|
|
15
|
-
jQuery.sap.require("sap.ui2.srvc.utils"); // call, Error
|
|
16
|
-
jQuery.sap.require("sap.ui2.srvc.ODataService");
|
|
17
|
-
jQuery.sap.require("sap.ui2.srvc.ODataWrapper");
|
|
18
|
-
|
|
19
|
-
// Note: Only the section between @begin and @end is included in pbs-template.js.
|
|
20
|
-
// In pbs-template fnRequire is differently initialized (in case UI5 is not available)!
|
|
21
|
-
// Thus this variable is used in the coding below and not directly jQuery.sap.require.
|
|
22
|
-
// avoid fnRequire = jQuery.sap.require as require cannot be spied on afterwards
|
|
23
|
-
var fnRequire = function () {
|
|
24
|
-
jQuery.sap.require.apply(this, arguments);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
sap.ui2.srvc.testPublishAt = sap.ui2.srvc.testPublishAt || function () {
|
|
28
|
-
// intentionally left blank
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/// @begin
|
|
32
|
-
// "public class" ************************************************************
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Constructs a facade to the page building service with the given
|
|
36
|
-
* base URI, providing all needed CRUD operations based on OData for the
|
|
37
|
-
* entities page, catalog, bag, CHIP, and CHIP instance.
|
|
38
|
-
* <p>
|
|
39
|
-
* <strong>Ensure that datajs library is available at runtime</strong>. If
|
|
40
|
-
* SAPUI5 is available this script automatically imports their datajs implementation.
|
|
41
|
-
* <p>
|
|
42
|
-
* This facade automatically takes care of Gateway's CSRF protection mechanism
|
|
43
|
-
* via a token. Please perform a read request first, because read requests acquire this token.
|
|
44
|
-
* Otherwise write requests will have fail on first attempt, but automatically acquire this token
|
|
45
|
-
* via reading the service document before repeating the write request. This is a slight
|
|
46
|
-
* performance penalty.
|
|
47
|
-
* <p>
|
|
48
|
-
* The objects returned by this facade are <strong>de-serialized JSON representations</strong>
|
|
49
|
-
* of the entities in question, as converted from the OData's response by datajs.
|
|
50
|
-
* They may be decorated with new properties as long as the property names start with a dollar
|
|
51
|
-
* symbol ("$"). This is needed to tell original properties and decorations apart for the purpose
|
|
52
|
-
* of update operations.
|
|
53
|
-
*
|
|
54
|
-
* @param {string|sap.ui2.srvc.ODataWrapper} vODataBase
|
|
55
|
-
* either the base URI of the page building service or (since 1.19.0) a corresponding
|
|
56
|
-
* <code>sap.ui2.srvc.ODataWrapper</code>
|
|
57
|
-
* @param {function (string, object=)} [fnDefaultFailure]
|
|
58
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
59
|
-
* optional object containing the complete error information as delivered
|
|
60
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
61
|
-
* for more details.
|
|
62
|
-
* @param {boolean} [bIsPersonalization=false]
|
|
63
|
-
* defines the return value of {@link #isPersonalization}; nothing else (since 1.16.1)
|
|
64
|
-
*
|
|
65
|
-
* @class
|
|
66
|
-
* @augments sap.ui2.srvc.ODataService
|
|
67
|
-
* @since 1.2.0
|
|
68
|
-
*/
|
|
69
|
-
sap.ui2.srvc.PageBuildingService = function (vODataBase, fnDefaultFailure, bIsPersonalization) {
|
|
70
|
-
var oWrapper,
|
|
71
|
-
that = this;
|
|
72
|
-
|
|
73
|
-
// BEWARE: constructor code below!
|
|
74
|
-
|
|
75
|
-
// "private" methods -------------------------------------------------------
|
|
76
|
-
/**
|
|
77
|
-
* Encodes a sting to be used in an OData $filter parameter.
|
|
78
|
-
*
|
|
79
|
-
* @param {string} sString
|
|
80
|
-
* string to be encoded.
|
|
81
|
-
* @returns {string}
|
|
82
|
-
* the encoded string
|
|
83
|
-
* @public
|
|
84
|
-
* @since 1.28.0
|
|
85
|
-
*/
|
|
86
|
-
function encodeODataFilterValue (sString) {
|
|
87
|
-
return sString.replace(/'/g, "''").replace(/&/g, "%26");
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns the URL for accessing a bag.
|
|
92
|
-
*
|
|
93
|
-
* @param {string|object} vParent
|
|
94
|
-
* ID of the page or parent object (either page or page CHIP instance; must be the result
|
|
95
|
-
* of a previous create or read operation) of the bag to be read
|
|
96
|
-
* @param {string} sBagId
|
|
97
|
-
* the bag ID
|
|
98
|
-
* @param {boolean} bExpand
|
|
99
|
-
* tells if the properties of the bag should be expanded in the OData call
|
|
100
|
-
* @returns {string}
|
|
101
|
-
* relative(!) URL
|
|
102
|
-
*
|
|
103
|
-
* @private
|
|
104
|
-
*/
|
|
105
|
-
function getBagUrl (vParent, sBagId, bExpand) {
|
|
106
|
-
var sPageId;
|
|
107
|
-
|
|
108
|
-
if (typeof vParent === "string") {
|
|
109
|
-
// for backwards compatibility, allow passing page ID
|
|
110
|
-
sPageId = vParent;
|
|
111
|
-
} else {
|
|
112
|
-
if (vParent.instanceId) {
|
|
113
|
-
// parent is a CHIP instance
|
|
114
|
-
return "ChipInstanceBags(pageId='" + encodeURIComponent(vParent.pageId)
|
|
115
|
-
+ "',instanceId='" + encodeURIComponent(vParent.instanceId)
|
|
116
|
-
+ "',id='" + encodeURIComponent(sBagId) + "')"
|
|
117
|
-
+ (bExpand ? "?$expand=ChipInstanceProperties" : "");
|
|
118
|
-
}
|
|
119
|
-
// parent is a page
|
|
120
|
-
sPageId = vParent.id;
|
|
121
|
-
}
|
|
122
|
-
return "Bags(pageId='" + encodeURIComponent(sPageId)
|
|
123
|
-
+ "',id='" + encodeURIComponent(sBagId) + "')"
|
|
124
|
-
+ (bExpand ? "?$expand=Properties" : "");
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Evaluates status code from OData batch response entry and returns the corresponding OData
|
|
129
|
-
* entity or the status message.
|
|
130
|
-
* @param oEntry The batch response entry which is an element of
|
|
131
|
-
* (For change) oData.__batchResponses[0]._changeResponses array
|
|
132
|
-
* (For read) oData.__batchResponses array (without the element for change responses)
|
|
133
|
-
* @returns OData entity (object or undefined) or status message as string
|
|
134
|
-
*
|
|
135
|
-
* @private
|
|
136
|
-
*/
|
|
137
|
-
sap.ui2.srvc.testPublishAt(that);
|
|
138
|
-
function extractBatchResponseEntry (oEntry) {
|
|
139
|
-
if (oEntry.statusCode === "201") {
|
|
140
|
-
// POST was ok, return the new entity
|
|
141
|
-
return oEntry.data;
|
|
142
|
-
}
|
|
143
|
-
if (oEntry.statusCode === "204") {
|
|
144
|
-
// PUT or DELETE was ok, return nothing
|
|
145
|
-
return undefined;
|
|
146
|
-
}
|
|
147
|
-
// request failed, return error message or empty string
|
|
148
|
-
return oEntry.message || "";
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Sends a batch request to the OData server. The batch request contains a
|
|
153
|
-
* sequence of change requests (PUT, POST) contained in a single changeset.
|
|
154
|
-
*
|
|
155
|
-
* @param {array} [aChangeRequests=[]]
|
|
156
|
-
* array of objects representing the change requests as specified by datajs. See
|
|
157
|
-
* <a href="http://datajs.codeplex.com/wikipage?title=OData%20Code%20Snippets&referringTitle=Documentation">
|
|
158
|
-
* datajs batch coding sample</a> and
|
|
159
|
-
* <a href="http://datajs.codeplex.com/wikipage?title=OData%20Payload%20Formats#Batch Requests">
|
|
160
|
-
* datajs payload format for batch</a>
|
|
161
|
-
* @param {array} [aGetRequests]
|
|
162
|
-
* array of objects representing the read requests as specified by datajs
|
|
163
|
-
* @param {function(array,array)} [fnSuccess]
|
|
164
|
-
* a callback function that is executed if the request succeeds, taking
|
|
165
|
-
* an array of response objects with responses for each change request
|
|
166
|
-
* and an array with responses for each read request. For a successful
|
|
167
|
-
* POST, the response object is the new entity, for a successful PUT it
|
|
168
|
-
* is undefined and for a successful GET it is the entity returned. For a
|
|
169
|
-
* failed request it is the corresponding error message.
|
|
170
|
-
* @param {function (string, object=)} [fnFailure]
|
|
171
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
172
|
-
* optional object containing the complete error information as delivered
|
|
173
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
174
|
-
* for more details.
|
|
175
|
-
* @private
|
|
176
|
-
* @deprecated Used only by {@link sap.ui2.srvc.PageBuildingService#updateBagProperties}.
|
|
177
|
-
*/
|
|
178
|
-
sap.ui2.srvc.testPublishAt(that);
|
|
179
|
-
function batch (aChangeRequests, aGetRequests, fnSuccess, fnFailure) {
|
|
180
|
-
/*jslint nomen:true */
|
|
181
|
-
var aRequests = [];
|
|
182
|
-
|
|
183
|
-
function extract (aResponses) {
|
|
184
|
-
var i, aResult = [];
|
|
185
|
-
|
|
186
|
-
for (i = 0; i < aResponses.length; i += 1) {
|
|
187
|
-
aResult[i] = extractBatchResponseEntry(aResponses[i]);
|
|
188
|
-
}
|
|
189
|
-
return aResult;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
fnSuccess = fnSuccess || function () { /* null object pattern */ };
|
|
193
|
-
fnFailure = fnFailure || that.getDefaultErrorHandler();
|
|
194
|
-
oWrapper.check(fnSuccess, fnFailure);
|
|
195
|
-
|
|
196
|
-
aChangeRequests = aChangeRequests || [];
|
|
197
|
-
aGetRequests = aGetRequests || [];
|
|
198
|
-
if (aChangeRequests.length > 0) {
|
|
199
|
-
aRequests.push({ __changeRequests: aChangeRequests });
|
|
200
|
-
}
|
|
201
|
-
aRequests = aRequests.concat(aGetRequests);
|
|
202
|
-
if (aRequests.length === 0) {
|
|
203
|
-
sap.ui2.srvc.call(fnSuccess.bind(null, [], []), fnFailure, true);
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
oWrapper.batch({ __batchRequests: aRequests },
|
|
207
|
-
function (oData) {
|
|
208
|
-
var aBatchResponses = oData.__batchResponses,
|
|
209
|
-
aChangeResponses = aBatchResponses[0].__changeResponses;
|
|
210
|
-
|
|
211
|
-
if (aBatchResponses[0].response && aBatchResponses[0].message) { // error
|
|
212
|
-
oWrapper.onError("POST", oWrapper.getBaseUrl() + "$batch", fnFailure, undefined,
|
|
213
|
-
oData.__batchResponses[0]);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if ((aChangeResponses && (aChangeResponses.length !== aChangeRequests.length))
|
|
217
|
-
|| (aBatchResponses.length !== aRequests.length)) {
|
|
218
|
-
fnFailure("Number of requests differs from number of responses in $batch");
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
if (aChangeResponses) { // change requests and (maybe) additional read requests
|
|
222
|
-
sap.ui2.srvc.call(
|
|
223
|
-
fnSuccess.bind(null, extract(aChangeResponses), extract(aBatchResponses.slice(1))),
|
|
224
|
-
fnFailure,
|
|
225
|
-
false
|
|
226
|
-
);
|
|
227
|
-
} else { //read requests only
|
|
228
|
-
sap.ui2.srvc.call(
|
|
229
|
-
fnSuccess.bind(null, [], extract(aBatchResponses)),
|
|
230
|
-
fnFailure,
|
|
231
|
-
false
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
fnFailure);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// "public" methods --------------------------------------------------------
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Tells whether this facade is reading from and writing to the "PERSONALIZATION" scope.
|
|
242
|
-
*
|
|
243
|
-
* @returns {boolean}
|
|
244
|
-
* whether this facade is reading from and writing to the "PERSONALIZATION" scope
|
|
245
|
-
* @since 1.16.1
|
|
246
|
-
*/
|
|
247
|
-
this.isPersonalization = function () {
|
|
248
|
-
return !!bIsPersonalization;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Reads the metadata document of the page building service.
|
|
253
|
-
*
|
|
254
|
-
* @param {function (object)} fnSuccess
|
|
255
|
-
* a callback function that is executed if the request succeeds, taking
|
|
256
|
-
* the processed data
|
|
257
|
-
* @param {function (string, object=)} [fnFailure]
|
|
258
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
259
|
-
* optional object containing the complete error information as delivered
|
|
260
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
261
|
-
* for more details.
|
|
262
|
-
* @param {boolean} bNoCache
|
|
263
|
-
* (since 1.5.0) whether to avoid caching
|
|
264
|
-
* @since 1.2.0
|
|
265
|
-
*
|
|
266
|
-
* @deprecated Since 1.17.0 it is no longer necessary to fetch a CSRF token first; this is
|
|
267
|
-
* done automatically.
|
|
268
|
-
*/
|
|
269
|
-
this.readMetadata = function (fnSuccess, fnFailure, bNoCache) {
|
|
270
|
-
var sRequestUrl = oWrapper.getBaseUrl() + "$metadata" + (bNoCache ? "?" + Date.now() : "");
|
|
271
|
-
|
|
272
|
-
fnFailure = fnFailure || this.getDefaultErrorHandler();
|
|
273
|
-
oWrapper.check(fnSuccess, fnFailure);
|
|
274
|
-
|
|
275
|
-
OData.read(sRequestUrl, function (oData) {
|
|
276
|
-
// Note: drop excess parameters; try/catch
|
|
277
|
-
sap.ui2.srvc.call(fnSuccess.bind(null, oData), fnFailure);
|
|
278
|
-
}, oWrapper.onError.bind(oWrapper, "GET", sRequestUrl, fnFailure, /*oDeferred*/undefined),
|
|
279
|
-
OData.metadataHandler);
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Deletes the bag with given IDs.
|
|
284
|
-
* It is not an error if the bag does not exist.
|
|
285
|
-
*
|
|
286
|
-
* @param {string|object} vParent
|
|
287
|
-
* ID of the page or parent object (either page or page CHIP instance; must be the result
|
|
288
|
-
* of a previous create or read operation) of the bag to be deleted
|
|
289
|
-
* @param {string} sBagId
|
|
290
|
-
* ID of the bag to be deleted
|
|
291
|
-
* @param {function ()} [fnSuccess]
|
|
292
|
-
* a callback function that is executed if delete succeeds, taking no data
|
|
293
|
-
* @param {function (string, object=)} [fnFailure]
|
|
294
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
295
|
-
* optional object containing the complete error information as delivered
|
|
296
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
297
|
-
* for more details.
|
|
298
|
-
* @since 1.3.0
|
|
299
|
-
*/
|
|
300
|
-
this.deleteBag = function (vParent, sBagId, fnSuccess, fnFailure) {
|
|
301
|
-
if (!vParent) {
|
|
302
|
-
throw new sap.ui2.srvc.Error("Missing parent ID or object",
|
|
303
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
304
|
-
}
|
|
305
|
-
if (!sBagId) {
|
|
306
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.PageBuildingService");
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
oWrapper.del(getBagUrl(vParent, sBagId, false), fnSuccess, fnFailure);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Reads the bag with the given IDs.
|
|
314
|
-
*
|
|
315
|
-
* @param {string|object} vParent
|
|
316
|
-
* ID of the page or parent object (either page or page CHIP instance; must be the result
|
|
317
|
-
* of a previous create or read operation) of the bag to be read
|
|
318
|
-
* @param {string} sBagId
|
|
319
|
-
* ID of the bag to be read. If the bag does not exist the error handler will be called.
|
|
320
|
-
* @param {function (object)} fnSuccess
|
|
321
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
322
|
-
* @param {function (string, object=)} [fnFailure]
|
|
323
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
324
|
-
* optional object containing the complete error information as delivered
|
|
325
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
326
|
-
* for more details.
|
|
327
|
-
* @since 1.3.0
|
|
328
|
-
*/
|
|
329
|
-
this.readBag = function (vParent, sBagId, fnSuccess, fnFailure) {
|
|
330
|
-
if (!vParent) {
|
|
331
|
-
throw new sap.ui2.srvc.Error("Missing parent ID or object",
|
|
332
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
333
|
-
}
|
|
334
|
-
if (!sBagId) {
|
|
335
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.PageBuildingService");
|
|
336
|
-
}
|
|
337
|
-
oWrapper.read(getBagUrl(vParent, sBagId, true), fnSuccess, fnFailure);
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Reads the "allCatalogs" collection (ordered by ID) that belongs to the page with the given
|
|
342
|
-
* ID.
|
|
343
|
-
*
|
|
344
|
-
* @param {string} sPageId
|
|
345
|
-
* ID of the page
|
|
346
|
-
* @param {function (object)} fnSuccess
|
|
347
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
348
|
-
* @param {function (string, object=)} [fnFailure]
|
|
349
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
350
|
-
* optional object containing the complete error information as delivered
|
|
351
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
352
|
-
* for more details.
|
|
353
|
-
* @param {string} [sFilter]
|
|
354
|
-
* filter value as defined by OData specification e.g. "type eq 'H'" for HANA catalogs.
|
|
355
|
-
* Filter has been introduced with version 1.16.2.
|
|
356
|
-
* @param {string} sSorting
|
|
357
|
-
* name of the field to be sorted on via $orderby as defined by OData specification.
|
|
358
|
-
* If not defined the dafault sorting would be on the field id (since 1.44)
|
|
359
|
-
* @param {string} bCache
|
|
360
|
-
* Use cache when true, added with 1.70 .0
|
|
361
|
-
* @since 1.7.0
|
|
362
|
-
*/
|
|
363
|
-
this.readAllCatalogs = function (sPageId, fnSuccess, fnFailure, sFilter, sSorting, bCache) {
|
|
364
|
-
var sSortField = "id";
|
|
365
|
-
bCache = bCache === undefined ? true : bCache;
|
|
366
|
-
if (sSorting && typeof sSorting === "string") {
|
|
367
|
-
sSortField = sSorting;
|
|
368
|
-
}
|
|
369
|
-
var sUrl = "Pages('" + encodeURIComponent(sPageId)
|
|
370
|
-
+ "')/allCatalogs?$expand=Chips/ChipBags/ChipProperties&"
|
|
371
|
-
+ "$orderby=" + sSortField;
|
|
372
|
-
if (sFilter && typeof sFilter === "string") {
|
|
373
|
-
sUrl = sUrl + "&$filter=" + encodeURIComponent(sFilter);
|
|
374
|
-
}
|
|
375
|
-
if (this.readAllCatalogs.cacheBusterTokens && this.readAllCatalogs.cacheBusterTokens.get(sPageId)) {
|
|
376
|
-
// There is a cache buster token maintained (!== "") for this ID, so add it to the URL
|
|
377
|
-
sUrl += "&sap-cache-id=" + this.readAllCatalogs.cacheBusterTokens.get(sPageId);
|
|
378
|
-
}
|
|
379
|
-
oWrapper.read(sUrl, fnSuccess, fnFailure, bCache);
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Reads all catalogs ordered by ID.
|
|
384
|
-
*
|
|
385
|
-
* @param {function (object)} fnSuccess
|
|
386
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
387
|
-
* @param {function (string, object=)} [fnFailure]
|
|
388
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
389
|
-
* optional object containing the complete error information as delivered
|
|
390
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
391
|
-
* for more details.
|
|
392
|
-
* @param {string} [sFilter]
|
|
393
|
-
* filter value as defined by OData specification e.g. "type eq 'H'" for HANA catalogs.
|
|
394
|
-
* Filter has been introduced with version 1.26.0
|
|
395
|
-
* @since 1.2.0
|
|
396
|
-
*/
|
|
397
|
-
this.readCatalogs = function (fnSuccess, fnFailure, sFilter) {
|
|
398
|
-
var sUrl = "Catalogs?$orderby=id";
|
|
399
|
-
if (sFilter && typeof sFilter === "string") {
|
|
400
|
-
sUrl = sUrl + "&$filter=" + encodeURIComponent(sFilter);
|
|
401
|
-
}
|
|
402
|
-
oWrapper.read(sUrl, fnSuccess, fnFailure);
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Reads all catalogs for current user filtered by given expression.
|
|
407
|
-
* @param {string} sFilter
|
|
408
|
-
* filter value as defined by OData specification e.g. "type eq 'H'" for HANA catalogs
|
|
409
|
-
* @param {function (object)} fnSuccess
|
|
410
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
411
|
-
* @param {function (string, object=)} [fnFailure]
|
|
412
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
413
|
-
* optional object containing the complete error information as delivered
|
|
414
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
415
|
-
* for more details.
|
|
416
|
-
* @private
|
|
417
|
-
*/
|
|
418
|
-
this.readAllCatalogsForUser = function (sFilter, fnSuccess, fnFailure) {
|
|
419
|
-
var sUrlParameter = sFilter ? "?$filter=" + encodeURIComponent(sFilter) : "";
|
|
420
|
-
// Page ID for the allCatalogs relation is not relevant
|
|
421
|
-
oWrapper.read("Pages('unused')/allCatalogs" + sUrlParameter, fnSuccess, fnFailure);
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Detect if a CHIP is referenced by other CHIPs, also within other catalogs.
|
|
426
|
-
* The CHIP which is checked is specified by its ID (not the ID of its CHIP instance
|
|
427
|
-
* representation on the catalog page).
|
|
428
|
-
* The success handler receives an array of all catalog IDs which contain at least
|
|
429
|
-
* one CHIP which references the CHIP with sReferenceChipId.
|
|
430
|
-
* If the request fails, fnFailure is invoked.
|
|
431
|
-
*
|
|
432
|
-
* @param {string} sReferencedChipId
|
|
433
|
-
* ID of the CHIP for which references are searched
|
|
434
|
-
* @param {function (array)} fnSuccess
|
|
435
|
-
* A callback function that is executed if the request succeeds. It is taking an array of
|
|
436
|
-
* catalog IDs which contain the referenced CHIP ID.
|
|
437
|
-
* The list may be in arbitrary order, notably not the order of the initial array
|
|
438
|
-
* @param {function (string, object=)} [fnFailure]
|
|
439
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
440
|
-
* optional object containing the complete error information as delivered
|
|
441
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
442
|
-
* for more details.
|
|
443
|
-
* @since 1.28.0
|
|
444
|
-
*/
|
|
445
|
-
this.getReferencingCatalogIds = function (sReferencedChipId, fnSuccess, fnFailure) {
|
|
446
|
-
// support SP11 interface: sReferencedChipId, aCatalogIds, fnSuccess, fnFailure
|
|
447
|
-
if (typeof fnSuccess !== "function") {
|
|
448
|
-
fnSuccess = fnFailure;
|
|
449
|
-
// note: using arguments[3] leads to Lint warnings but a named arg will be visible in JSDoc
|
|
450
|
-
fnFailure = arguments[3];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function success (oResponse) {
|
|
454
|
-
var aRefCatalogIds = [],
|
|
455
|
-
aReferenceChips = oResponse.results || [];
|
|
456
|
-
|
|
457
|
-
aReferenceChips.forEach(function (oChip) {
|
|
458
|
-
if (oChip.referenceChipId === sReferencedChipId) { //remove when CSN 1570015473 is solved
|
|
459
|
-
// no redundant catalog Ids in aRefCatalogIds
|
|
460
|
-
if (aRefCatalogIds.indexOf(oChip.catalogId) === -1) {
|
|
461
|
-
aRefCatalogIds.push(oChip.catalogId);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
fnSuccess(aRefCatalogIds);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
// parameter checks
|
|
470
|
-
if (typeof sReferencedChipId !== "string") {
|
|
471
|
-
throw new sap.ui2.srvc.Error("sReferencedChipId must be a string",
|
|
472
|
-
"sap.ui2.srvc.test.PageBuildingService");
|
|
473
|
-
}
|
|
474
|
-
if (typeof fnSuccess !== "function") {
|
|
475
|
-
throw new sap.ui2.srvc.Error("fnSuccess is mandatory",
|
|
476
|
-
"sap.ui2.srvc.test.PageBuildingService");
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
oWrapper.read("Chips?$filter=" + encodeURIComponent("referenceChipId eq '" +
|
|
480
|
-
encodeODataFilterValue(sReferencedChipId) + "'"),
|
|
481
|
-
success,
|
|
482
|
-
function (sMsg /*, oErrorInformation */) {
|
|
483
|
-
/* eslint-disable no-new */
|
|
484
|
-
new sap.ui2.srvc.Error(sMsg, "sap.ui2.srvc.PageBuildingService");
|
|
485
|
-
/* eslint-enable no-new */
|
|
486
|
-
fnFailure.apply(null, arguments);
|
|
487
|
-
});
|
|
488
|
-
};
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Creates a new catalog based on a catalog page, using the given domain ID and title. Note
|
|
492
|
-
* that the page building service will default to a certain type (e.g. "CATALOG_PAGE" in case
|
|
493
|
-
* of ABAP) and will create an ID from that type and the given domain-specific ID (e.g. by
|
|
494
|
-
* adding the prefix "X-SAP-UI2-CATALOGPAGE:" in case of ABAP). Access the object passed to the
|
|
495
|
-
* success callback in order to learn the resulting ID! Note that the catalog page has the
|
|
496
|
-
* same ID as the corresponding catalog and can be retrieved by {@link #readPage}.
|
|
497
|
-
*
|
|
498
|
-
* @param {string} sDomainId
|
|
499
|
-
* the catalog's domain-specific ID
|
|
500
|
-
* @param {string} [sTitle]
|
|
501
|
-
* the catalog's title, also used for the catalog page
|
|
502
|
-
* @param {function (object)} [fnSuccess]
|
|
503
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
504
|
-
* (as a catalog, not as a page)
|
|
505
|
-
* @param {function (string, object=)} [fnFailure]
|
|
506
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
507
|
-
* optional object containing the complete error information as delivered
|
|
508
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
509
|
-
* for more details.
|
|
510
|
-
* Default: see {@link #getDefaultErrorHandler}
|
|
511
|
-
*
|
|
512
|
-
* @since 1.19.1
|
|
513
|
-
*/
|
|
514
|
-
this.createPageBasedCatalog = function (sDomainId, sTitle, fnSuccess, fnFailure) {
|
|
515
|
-
if (!sDomainId) {
|
|
516
|
-
throw new sap.ui2.srvc.Error("Missing domain ID", "sap.ui2.srvc.PageBuildingService");
|
|
517
|
-
}
|
|
518
|
-
// TODO: test if type: "CATALOG_PAGE" is the default so we dont need to set it here.
|
|
519
|
-
oWrapper.create("Catalogs", { domainId: sDomainId, title: sTitle, type: "CATALOG_PAGE" },
|
|
520
|
-
fnSuccess, fnFailure);
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Creates a new catalog based on the given raw data. Typically, this will be used to create
|
|
525
|
-
* "remote catalogs", i.e. pointers to existing catalogs on a remote server.
|
|
526
|
-
*
|
|
527
|
-
* @param {object} oCatalog
|
|
528
|
-
* the raw catalog representation (<code>__metadata</code> not needed!), e.g.
|
|
529
|
-
* <pre>
|
|
530
|
-
* {
|
|
531
|
-
* baseUrl: "/sap/hba/apps/kpi/s/odata/hana_chip_catalog.xsodata/",
|
|
532
|
-
* domainId: "Z_REMOTE_HANA_CATALOG",
|
|
533
|
-
* remoteId: "HANA_CATALOG",
|
|
534
|
-
* systemAlias: "sanssouci",
|
|
535
|
-
* title: "Remote HANA catalog",
|
|
536
|
-
* type: "REMOTE"
|
|
537
|
-
* }
|
|
538
|
-
* </pre>
|
|
539
|
-
* @param {function (object)} fnSuccess
|
|
540
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
541
|
-
* @param {function (string, object=)} [fnFailure]
|
|
542
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
543
|
-
* optional object containing the complete error information as delivered
|
|
544
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
545
|
-
* for more details.
|
|
546
|
-
*
|
|
547
|
-
* @since 1.19.1
|
|
548
|
-
*/
|
|
549
|
-
this.createCatalog = function (oCatalog, fnSuccess, fnFailure) {
|
|
550
|
-
oWrapper.create("Catalogs", oCatalog, fnSuccess, fnFailure);
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Deletes the catalog with the given representation which must be the result of a previous
|
|
555
|
-
* create or read operation. If the catalog is based on a catalog page
|
|
556
|
-
* ({@link #createPageBasedCatalog}), that page is also deleted including all of its CHIP
|
|
557
|
-
* instances and bags.
|
|
558
|
-
*
|
|
559
|
-
* @param {object} oCatalog
|
|
560
|
-
* the de-serialized JSON representing the catalog to be deleted
|
|
561
|
-
* @param {function ()} [fnSuccess]
|
|
562
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
563
|
-
* @param {function (string, object=)} [fnFailure]
|
|
564
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
565
|
-
* optional object containing the complete error information as delivered
|
|
566
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
567
|
-
* for more details.
|
|
568
|
-
* Default: see {@link #getDefaultErrorHandler}
|
|
569
|
-
*
|
|
570
|
-
* @since 1.19.1
|
|
571
|
-
*/
|
|
572
|
-
this.deleteCatalog = function (oCatalog, fnSuccess, fnFailure) {
|
|
573
|
-
oWrapper.del(oCatalog, fnSuccess, fnFailure);
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Creates a new catalog in the backend as a clone of the catalog with given ID, using the
|
|
578
|
-
* given new domain ID. Note that the page building service will create an ID from the
|
|
579
|
-
* catalog's type and the given domain-specific ID (e.g. by adding the prefix
|
|
580
|
-
* "X-SAP-UI2-CATALOGPAGE:" for type "CATALOG_PAGE" in case of ABAP). Access the object passed
|
|
581
|
-
* to the success callback in order to learn the resulting ID!
|
|
582
|
-
*
|
|
583
|
-
* @param {string} sCatalogId
|
|
584
|
-
* the old catalog's ID as returned from the page building service
|
|
585
|
-
* @param {string} sNewDomainId
|
|
586
|
-
* the new catalog's domain-specific ID which must not contain a colon
|
|
587
|
-
* @param {string} [sNewTitle]
|
|
588
|
-
* the new catalog's title; if the parameter is <code>undefined</code>,
|
|
589
|
-
* the old catalog's title will be used
|
|
590
|
-
* @param {function (object)} fnSuccess
|
|
591
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
592
|
-
* (BEWARE: the Chips relation is not expanded, but still deferred!)
|
|
593
|
-
* @param {function (string, object=)} [fnFailure]
|
|
594
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
595
|
-
* optional object containing the complete error information as delivered
|
|
596
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
597
|
-
* for more details.
|
|
598
|
-
* Default: see {@link #getDefaultErrorHandler}
|
|
599
|
-
* @since 1.19.1
|
|
600
|
-
*/
|
|
601
|
-
this.cloneCatalog = function (sCatalogId, sNewDomainId, sNewTitle, fnSuccess, fnFailure) {
|
|
602
|
-
if (!sCatalogId) {
|
|
603
|
-
throw new sap.ui2.srvc.Error("Missing source catalog ID",
|
|
604
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
605
|
-
}
|
|
606
|
-
if (!sNewDomainId) {
|
|
607
|
-
throw new sap.ui2.srvc.Error("Missing new domain ID", "sap.ui2.srvc.PageBuildingService");
|
|
608
|
-
}
|
|
609
|
-
if (sNewDomainId.indexOf(":") >= 0) {
|
|
610
|
-
throw new sap.ui2.srvc.Error("Illegal domain ID: " + sNewDomainId,
|
|
611
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
oWrapper.create("CloneCatalog?sourceId='" + encodeURIComponent(sCatalogId)
|
|
615
|
-
+ "'&targetId='" + encodeURIComponent(sNewDomainId)
|
|
616
|
-
+ (sNewTitle !== undefined ? "'&title='" + encodeURIComponent(sNewTitle) + "'" : "'"),
|
|
617
|
-
{}, //payload
|
|
618
|
-
fnSuccess,
|
|
619
|
-
fnFailure);
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Adds a reference CHIP instance to the page with ID <code>sTargetPageId</code>. The new
|
|
624
|
-
* reference refers to the CHIP instance with the given ID located on the source page with the
|
|
625
|
-
* given ID.
|
|
626
|
-
*
|
|
627
|
-
* @param {string} sSourcePageId
|
|
628
|
-
* ID of the source page the CHIP instance with ID <code>sSourceChipInstanceId</code> is
|
|
629
|
-
* located on
|
|
630
|
-
* @param {string} sSourceChipInstanceId
|
|
631
|
-
* ID of the CHIP instance referenced to
|
|
632
|
-
* @param {string} sTargetPageId
|
|
633
|
-
* ID of the page where the reference CHIP Instance shall be added to
|
|
634
|
-
* @param {function (object)} fnSuccess
|
|
635
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
636
|
-
* @param {function (string, object=)} [fnFailure]
|
|
637
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
638
|
-
* optional object containing the complete error information as delivered
|
|
639
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
640
|
-
* for more details.
|
|
641
|
-
* Default: see {@link #getDefaultErrorHandler}
|
|
642
|
-
*
|
|
643
|
-
* @since 1.21.1
|
|
644
|
-
*/
|
|
645
|
-
this.clonePageChipInstance = function (sSourcePageId, sSourceChipInstanceId,
|
|
646
|
-
sTargetPageId, fnSuccess, fnFailure) {
|
|
647
|
-
if (!sSourcePageId) {
|
|
648
|
-
throw new sap.ui2.srvc.Error("Missing source page ID",
|
|
649
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
650
|
-
}
|
|
651
|
-
if (!sSourceChipInstanceId) {
|
|
652
|
-
throw new sap.ui2.srvc.Error("Missing source CHIP instance ID",
|
|
653
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
654
|
-
}
|
|
655
|
-
if (!sTargetPageId) {
|
|
656
|
-
throw new sap.ui2.srvc.Error("Missing target page ID",
|
|
657
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
658
|
-
}
|
|
659
|
-
oWrapper.create("ClonePageChipInstance?sourcePageId='" + encodeURIComponent(sSourcePageId)
|
|
660
|
-
+ "'&sourceChipInstanceId='" + encodeURIComponent(sSourceChipInstanceId)
|
|
661
|
-
+ "'&targetPageId='" + encodeURIComponent(sTargetPageId) + "'",
|
|
662
|
-
{}, //payload
|
|
663
|
-
function (oRawChipInstance) {
|
|
664
|
-
// ClonePageChipInstance cannot expand the result
|
|
665
|
-
// Note: the CHIP instance cannot be remote and the CHIP has already been loaded
|
|
666
|
-
oWrapper.read("PageChipInstances(pageId='" + encodeURIComponent(oRawChipInstance.pageId)
|
|
667
|
-
+ "',instanceId='" + encodeURIComponent(oRawChipInstance.instanceId) + "')"
|
|
668
|
-
+ "?$expand=ChipInstanceBags/ChipInstanceProperties",
|
|
669
|
-
fnSuccess,
|
|
670
|
-
fnFailure);
|
|
671
|
-
},
|
|
672
|
-
fnFailure);
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Reads the catalog with the given ID including all contained CHIPs (unless specified
|
|
677
|
-
* otherwise). Note that the corresponding catalog page (if applicable) has the same ID and can
|
|
678
|
-
* be retrieved by {@link #readPage}.
|
|
679
|
-
*
|
|
680
|
-
* @param {string} sCatalogId
|
|
681
|
-
* ID of the catalog to be loaded
|
|
682
|
-
* @param {function (object)} fnSuccess
|
|
683
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
684
|
-
* @param {function (string, object=)} [fnFailure]
|
|
685
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
686
|
-
* optional object containing the complete error information as delivered
|
|
687
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
688
|
-
* for more details.
|
|
689
|
-
* @param {boolean} [bNoChips=false]
|
|
690
|
-
* whether to avoid including all contained CHIPs
|
|
691
|
-
* @param {boolean} [bNoChipBags=false]
|
|
692
|
-
* whether to avoid including CHIP bags and properties
|
|
693
|
-
* @since 1.2.0
|
|
694
|
-
*/
|
|
695
|
-
this.readCatalog = function (sCatalogId, fnSuccess, fnFailure, bNoChips, bNoChipBags) {
|
|
696
|
-
var sUrl;
|
|
697
|
-
|
|
698
|
-
if (!sCatalogId) {
|
|
699
|
-
throw new sap.ui2.srvc.Error("Missing catalog ID", "sap.ui2.srvc.PageBuildingService");
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
sUrl = "Catalogs('" + encodeURIComponent(sCatalogId) + "')";
|
|
703
|
-
if (!bNoChips) {
|
|
704
|
-
sUrl += "?$expand=Chips";
|
|
705
|
-
if (!bNoChipBags) {
|
|
706
|
-
sUrl += "/ChipBags/ChipProperties";
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
oWrapper.read(sUrl, fnSuccess, fnFailure);
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* Updates the catalog with the given representation which must be the result of a previous
|
|
714
|
-
* create or read operation. Note that you cannot update keys, in this case the "id" property.
|
|
715
|
-
* Note that for a catalog based on a catalog page ({@link #createPageBasedCatalog}), the
|
|
716
|
-
* "title" property is shared between the catalog and its corresponding catalog page!
|
|
717
|
-
*
|
|
718
|
-
* @param {object} oCatalog
|
|
719
|
-
* the de-serialized JSON representing the catalog to be updated
|
|
720
|
-
* @param {function ()} [fnSuccess]
|
|
721
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
722
|
-
* @param {function (string, object=)} [fnFailure]
|
|
723
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
724
|
-
* optional object containing the complete error information as delivered
|
|
725
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
726
|
-
* for more details.
|
|
727
|
-
*
|
|
728
|
-
* @since 1.19.1
|
|
729
|
-
*/
|
|
730
|
-
this.updateCatalog = function (oCatalog, fnSuccess, fnFailure) {
|
|
731
|
-
oWrapper.update(oCatalog, fnSuccess, fnFailure);
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* Reads the given CHIPs from the catalog with the given ID.
|
|
736
|
-
*
|
|
737
|
-
* @param {string} sCatalogId
|
|
738
|
-
* ID of the catalog to be loaded
|
|
739
|
-
* @param {string[]} [aChipIds]
|
|
740
|
-
* the IDs of the CHIPs to be loaded. If <code>undefined</code>, all CHIPs will be loaded.
|
|
741
|
-
* @param {function (object)} fnSuccess
|
|
742
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
743
|
-
* @param {function (string, object=)} [fnFailure]
|
|
744
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
745
|
-
* optional object containing the complete error information as delivered
|
|
746
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
747
|
-
* for more details.
|
|
748
|
-
* @throws Error if an empty array is given for filtering
|
|
749
|
-
* @since 1.16.4
|
|
750
|
-
*/
|
|
751
|
-
this.readCatalogChips = function (sCatalogId, aChipIds, fnSuccess, fnFailure) {
|
|
752
|
-
var sUrl,
|
|
753
|
-
sFilter = "",
|
|
754
|
-
sPrefix = "?$filter=";
|
|
755
|
-
|
|
756
|
-
if (!sCatalogId) {
|
|
757
|
-
throw new sap.ui2.srvc.Error("Missing catalog ID", "sap.ui2.srvc.PageBuildingService");
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
// TODO: read also CHIP bags
|
|
761
|
-
sUrl = "Catalogs('" + encodeURIComponent(sCatalogId) + "')/Chips";
|
|
762
|
-
if (aChipIds) {
|
|
763
|
-
if (!aChipIds.length) {
|
|
764
|
-
throw new sap.ui2.srvc.Error("No CHIP IDs given", "sap.ui2.srvc.PageBuildingService");
|
|
765
|
-
}
|
|
766
|
-
aChipIds.forEach(function (sId) {
|
|
767
|
-
sFilter = sFilter + sPrefix + "id%20eq%20'" + encodeURIComponent(sId) + "'";
|
|
768
|
-
sPrefix = "%20or%20";
|
|
769
|
-
});
|
|
770
|
-
// ensure that the resulting URL does not exceed length limits
|
|
771
|
-
if (oWrapper.getBaseUrl().length + sUrl.length + sFilter.length > 2000) {
|
|
772
|
-
sFilter = "";
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
oWrapper.read(sUrl + sFilter, fnSuccess, fnFailure);
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Creates a new page with the given properties.
|
|
780
|
-
*
|
|
781
|
-
* @param {string} sId
|
|
782
|
-
* ID of the new page
|
|
783
|
-
* @param {string} sCatalogId
|
|
784
|
-
* ID of the catalog for the new page
|
|
785
|
-
* @param {string} sLayout
|
|
786
|
-
* value of the layout property for the new page
|
|
787
|
-
* @param {string} sTitle
|
|
788
|
-
* title of the new page
|
|
789
|
-
* @param {function (object)} [fnSuccess]
|
|
790
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
791
|
-
* @param {function (string, object=)} [fnFailure]
|
|
792
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
793
|
-
* optional object containing the complete error information as delivered
|
|
794
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
795
|
-
* for more details.
|
|
796
|
-
* @since 1.2.0
|
|
797
|
-
*/
|
|
798
|
-
this.createPage = function (sId, sCatalogId, sLayout, sTitle, fnSuccess, fnFailure) {
|
|
799
|
-
if (!sId) {
|
|
800
|
-
throw new sap.ui2.srvc.Error("Missing page ID", "sap.ui2.srvc.PageBuildingService");
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
oWrapper.create("Pages", {
|
|
804
|
-
id: sId,
|
|
805
|
-
catalogId: sCatalogId,
|
|
806
|
-
layout: sLayout,
|
|
807
|
-
title: sTitle
|
|
808
|
-
}, fnSuccess, fnFailure);
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Reads all pages ordered by ID including all contained catalogs (unless specified otherwise).
|
|
813
|
-
*
|
|
814
|
-
* @param {function (object)} fnSuccess
|
|
815
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
816
|
-
* @param {function (string, object=)} [fnFailure]
|
|
817
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
818
|
-
* optional object containing the complete error information as delivered
|
|
819
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
820
|
-
* for more details.
|
|
821
|
-
* @param {boolean} [bNoCatalogs=false]
|
|
822
|
-
* whether to avoid including all contained catalogs
|
|
823
|
-
* @since 1.2.0
|
|
824
|
-
*/
|
|
825
|
-
this.readPages = function (fnSuccess, fnFailure, bNoCatalogs) {
|
|
826
|
-
var sUrl = "Pages?";
|
|
827
|
-
if (!bNoCatalogs) {
|
|
828
|
-
sUrl += "$expand=Catalog&";
|
|
829
|
-
}
|
|
830
|
-
oWrapper.read(sUrl + "$orderby=id", fnSuccess, fnFailure);
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* Reads the page with the given ID including all contained <br>
|
|
835
|
-
* - CHIP instances and their CHIPs, <br>
|
|
836
|
-
* - bags and properties (page, CHIP and CHIP instance bags), <br>
|
|
837
|
-
* - RemoteCatalog data.
|
|
838
|
-
* <p>
|
|
839
|
-
* Via the parameter <code>sCustomExpand</code> you can specify a different $expand statement.
|
|
840
|
-
*
|
|
841
|
-
* @param {string} sId
|
|
842
|
-
* ID of the page to be read
|
|
843
|
-
* @param {function (object)} fnSuccess
|
|
844
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
845
|
-
* @param {function (string, object=)} [fnFailure]
|
|
846
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
847
|
-
* optional object containing the complete error information as delivered
|
|
848
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
849
|
-
* for more details.
|
|
850
|
-
* @param {string} [sCustomExpand="Bags/Properties,PageChipInstances/Chip/ChipBags/ChipProperties,PageChipInstances/RemoteCatalog,PageChipInstances/ChipInstanceBags/ChipInstanceProperties"]
|
|
851
|
-
* (since 1.30.0) can be used to overwrite the default $expand value. If "" is used, the
|
|
852
|
-
* entire $expand parameter will be skipped
|
|
853
|
-
* @since 1.2.0
|
|
854
|
-
*/
|
|
855
|
-
this.readPage = function (sId, fnSuccess, fnFailure, sCustomExpand) {
|
|
856
|
-
var sUrl = "Pages('" + encodeURIComponent(sId) + "')";
|
|
857
|
-
if (!sId) {
|
|
858
|
-
throw new sap.ui2.srvc.Error("Missing page ID", "sap.ui2.srvc.PageBuildingService");
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
if (sCustomExpand === undefined) {
|
|
862
|
-
// use default expand
|
|
863
|
-
sUrl += "?$expand=Bags/Properties,PageChipInstances/Chip/ChipBags/ChipProperties,"
|
|
864
|
-
+ "PageChipInstances/RemoteCatalog,"
|
|
865
|
-
+ "PageChipInstances/ChipInstanceBags/ChipInstanceProperties";
|
|
866
|
-
} else if (sCustomExpand !== "") {
|
|
867
|
-
sUrl += "?$expand=" + sCustomExpand;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
oWrapper.read(sUrl, fnSuccess, fnFailure);
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* Reads the page set with the given ID including all contained pages and their CHIP instances.
|
|
875
|
-
* Property bags are not loaded.
|
|
876
|
-
* Note: Cache buster tokens (sap-cache-id), can be set via
|
|
877
|
-
* <code>oPbs.readPageSet.cacheBusterTokens.put("PageSetId", "cbtoken")</code>
|
|
878
|
-
*
|
|
879
|
-
* @param {string} sId
|
|
880
|
-
* ID of the page set to be read
|
|
881
|
-
* @param {function (object)} fnSuccess
|
|
882
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
883
|
-
* @param {function (string, object=)} [fnFailure]
|
|
884
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
885
|
-
* optional object containing the complete error information as delivered
|
|
886
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
887
|
-
* for more details.
|
|
888
|
-
* @param {string} bCache
|
|
889
|
-
* Use cache when true, added with 1.70.0
|
|
890
|
-
* @since 1.11.0
|
|
891
|
-
* @private
|
|
892
|
-
*/
|
|
893
|
-
this.readPageSet = function (sId, fnSuccess, fnFailure, bCache) {
|
|
894
|
-
var sUrl;
|
|
895
|
-
var that = this;
|
|
896
|
-
var appendedParametersKeys;
|
|
897
|
-
bCache = bCache === undefined ? true : bCache;
|
|
898
|
-
|
|
899
|
-
if (!sId) {
|
|
900
|
-
throw new sap.ui2.srvc.Error("Missing page set ID", "sap.ui2.srvc.PageBuildingService");
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
sUrl = "PageSets('" + encodeURIComponent(sId) + "')?$expand="
|
|
904
|
-
+ "Pages/PageChipInstances/Chip/ChipBags/ChipProperties,"
|
|
905
|
-
+ "Pages/PageChipInstances/RemoteCatalog,"
|
|
906
|
-
+ "Pages/PageChipInstances/ChipInstanceBags/ChipInstanceProperties,"
|
|
907
|
-
+ "AssignedPages,"
|
|
908
|
-
+ "DefaultPage";
|
|
909
|
-
|
|
910
|
-
if (this.readPageSet.cacheBusterTokens && this.readPageSet.cacheBusterTokens.get(sId)) {
|
|
911
|
-
// There is a cache buster token maintained (!== "") for this ID, so add it to the URL
|
|
912
|
-
// Note: Same parameter order as in ABAP bootstrap must be used as the response is cached
|
|
913
|
-
// in OData.read.$cache under exactly that URL string
|
|
914
|
-
sUrl += "&sap-cache-id=" + this.readPageSet.cacheBusterTokens.get(sId);
|
|
915
|
-
}
|
|
916
|
-
if (this.readPageSet.appendedParameters) {
|
|
917
|
-
appendedParametersKeys = Object.keys(this.readPageSet.appendedParameters);
|
|
918
|
-
if (appendedParametersKeys.length > 0) {
|
|
919
|
-
appendedParametersKeys.sort();
|
|
920
|
-
appendedParametersKeys.forEach(function (key) {
|
|
921
|
-
sUrl += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(that.readPageSet.appendedParameters[key]);
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
oWrapper.read(sUrl, fnSuccess, fnFailure, bCache);
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* Updates the page set with the given representation which must be the result of
|
|
930
|
-
* a previous read operation.
|
|
931
|
-
*
|
|
932
|
-
* @param {object} oPageSet
|
|
933
|
-
* the de-serialized JSON representing the page set to be updated
|
|
934
|
-
* @param {function ()} [fnSuccess]
|
|
935
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
936
|
-
* @param {function (string, object=)} [fnFailure]
|
|
937
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
938
|
-
* optional object containing the complete error information as delivered
|
|
939
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
940
|
-
* for more details.
|
|
941
|
-
* @since 1.11.0
|
|
942
|
-
* @private
|
|
943
|
-
*/
|
|
944
|
-
this.updatePageSet = function (oPageSet, fnSuccess, fnFailure) {
|
|
945
|
-
oWrapper.update(oPageSet, fnSuccess, fnFailure);
|
|
946
|
-
};
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* Creates a new page with given title in given page set.
|
|
950
|
-
*
|
|
951
|
-
* @param {string} sPageSetId
|
|
952
|
-
* ID of the page set
|
|
953
|
-
* @param {string} sPageTitle
|
|
954
|
-
* title (might be an empty) of the new page
|
|
955
|
-
* @param {string} sCatalogId
|
|
956
|
-
* ID of the default catalog of the new page
|
|
957
|
-
* @param {function (object)} fnSuccess
|
|
958
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
959
|
-
* @param {function (string, object=)} [fnFailure]
|
|
960
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
961
|
-
* optional object containing the complete error information as delivered
|
|
962
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
963
|
-
* for more details.
|
|
964
|
-
* @private
|
|
965
|
-
*/
|
|
966
|
-
this.createPageInPageSet = function (sPageSetId, sPageTitle, sCatalogId, fnSuccess, fnFailure) {
|
|
967
|
-
// TODO refactor parameters use one object instead of multiple strings
|
|
968
|
-
if (!sPageSetId) {
|
|
969
|
-
throw new sap.ui2.srvc.Error("Missing page set ID", "sap.ui2.srvc.PageBuildingService");
|
|
970
|
-
}
|
|
971
|
-
oWrapper.create("PageSets('" + encodeURIComponent(sPageSetId) + "')/Pages", {
|
|
972
|
-
catalogId: sCatalogId || "",
|
|
973
|
-
layout: "",
|
|
974
|
-
title: sPageTitle || ""
|
|
975
|
-
}, fnSuccess, fnFailure);
|
|
976
|
-
};
|
|
977
|
-
|
|
978
|
-
/**
|
|
979
|
-
* Updates the page with the given representation which must be the result of
|
|
980
|
-
* a previous create or read operation.
|
|
981
|
-
*
|
|
982
|
-
* @param {object} oPage
|
|
983
|
-
* the de-serialized JSON representing the page to be updated
|
|
984
|
-
* @param {function ()} [fnSuccess]
|
|
985
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
986
|
-
* @param {function (string, object=)} [fnFailure]
|
|
987
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
988
|
-
* optional object containing the complete error information as delivered
|
|
989
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
990
|
-
* for more details.
|
|
991
|
-
* @since 1.2.0
|
|
992
|
-
*/
|
|
993
|
-
this.updatePage = function (oPage, fnSuccess, fnFailure) {
|
|
994
|
-
oWrapper.update(oPage, fnSuccess, fnFailure);
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
/**
|
|
998
|
-
* Deletes the page with the given ID.
|
|
999
|
-
*
|
|
1000
|
-
* @param {string} sId
|
|
1001
|
-
* ID of page to be deleted
|
|
1002
|
-
* @param {function ()} [fnSuccess]
|
|
1003
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
1004
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1005
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1006
|
-
* optional object containing the complete error information as delivered
|
|
1007
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1008
|
-
* for more details.
|
|
1009
|
-
* @since 1.2.0
|
|
1010
|
-
*/
|
|
1011
|
-
this.deletePage = function (sId, fnSuccess, fnFailure) {
|
|
1012
|
-
if (!sId) {
|
|
1013
|
-
throw new sap.ui2.srvc.Error("Missing page ID", "sap.ui2.srvc.PageBuildingService");
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
oWrapper.del("Pages('" + encodeURIComponent(sId) + "')",
|
|
1017
|
-
fnSuccess, fnFailure);
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* Creates a CHIP instance with the given properties inside the page with given ID.
|
|
1022
|
-
*
|
|
1023
|
-
* @param {string} sPageId
|
|
1024
|
-
* ID of page containing the new CHIP instance
|
|
1025
|
-
* @param {string} [sInstanceId]
|
|
1026
|
-
* ID of new CHIP instance (optional, a UUID will be created as a default)
|
|
1027
|
-
* @param {string} sChipId
|
|
1028
|
-
* ID of CHIP to be used
|
|
1029
|
-
* @param {string} sTitle
|
|
1030
|
-
* title of CHIP instance
|
|
1031
|
-
* @param {string} sConfiguration
|
|
1032
|
-
* configuration of CHIP instance
|
|
1033
|
-
* @param {string} sLayoutData
|
|
1034
|
-
* layout data of CHIP instance
|
|
1035
|
-
* @param {function (object)} [fnSuccess]
|
|
1036
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
1037
|
-
* (Note: The instance's "Chips" relation will not be expanded!)
|
|
1038
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1039
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1040
|
-
* optional object containing the complete error information as delivered
|
|
1041
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1042
|
-
* for more details.
|
|
1043
|
-
* @since 1.2.0
|
|
1044
|
-
*/
|
|
1045
|
-
this.createPageChipInstance = function (sPageId, sInstanceId,
|
|
1046
|
-
sChipId, sTitle, sConfiguration, sLayoutData, fnSuccess, fnFailure) {
|
|
1047
|
-
this.createPageChipInstanceFromRawData({
|
|
1048
|
-
pageId: sPageId,
|
|
1049
|
-
instanceId: sInstanceId,
|
|
1050
|
-
chipId: sChipId,
|
|
1051
|
-
title: sTitle,
|
|
1052
|
-
configuration: sConfiguration,
|
|
1053
|
-
layoutData: sLayoutData
|
|
1054
|
-
}, fnSuccess, fnFailure);
|
|
1055
|
-
};
|
|
1056
|
-
|
|
1057
|
-
/**
|
|
1058
|
-
* Creates a CHIP instance with the given properties inside the page with given ID.
|
|
1059
|
-
*
|
|
1060
|
-
* @param {object} oChipInstance
|
|
1061
|
-
* the de-serialized JSON representing the CHIP instance to be created
|
|
1062
|
-
* @param {string} oChipInstance.pageId
|
|
1063
|
-
* ID of page containing the new CHIP instance
|
|
1064
|
-
* @param {string} [oChipInstance.instanceId]
|
|
1065
|
-
* ID of new CHIP instance (optional, a UUID will be created as a default)
|
|
1066
|
-
* @param {string} oChipInstance.chipId
|
|
1067
|
-
* ID of CHIP to be used
|
|
1068
|
-
* @param {string} [oChipInstance.title]
|
|
1069
|
-
* title of CHIP instance
|
|
1070
|
-
* @param {string} [oChipInstance.configuration]
|
|
1071
|
-
* configuration of CHIP instance
|
|
1072
|
-
* @param {string} [oChipInstance.layoutData]
|
|
1073
|
-
* layout data of CHIP instance
|
|
1074
|
-
* @param {function (object)} [fnSuccess]
|
|
1075
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
1076
|
-
* (Note: The instance's "Chips" relation will not be expanded!)
|
|
1077
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1078
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1079
|
-
* optional object containing the complete error information as delivered
|
|
1080
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1081
|
-
* for more details.
|
|
1082
|
-
* @since 1.9.0
|
|
1083
|
-
*/
|
|
1084
|
-
this.createPageChipInstanceFromRawData = function (oChipInstance, fnSuccess, fnFailure) {
|
|
1085
|
-
if (typeof oChipInstance !== "object") {
|
|
1086
|
-
throw new sap.ui2.srvc.Error("Invalid raw data", "sap.ui2.srvc.PageBuildingService");
|
|
1087
|
-
}
|
|
1088
|
-
if (!oChipInstance.pageId) {
|
|
1089
|
-
throw new sap.ui2.srvc.Error("Missing page ID", "sap.ui2.srvc.PageBuildingService");
|
|
1090
|
-
}
|
|
1091
|
-
if (!oChipInstance.chipId) {
|
|
1092
|
-
throw new sap.ui2.srvc.Error("Missing CHIP ID", "sap.ui2.srvc.PageBuildingService");
|
|
1093
|
-
}
|
|
1094
|
-
oChipInstance.instanceId = oChipInstance.instanceId || "";
|
|
1095
|
-
oChipInstance.title = oChipInstance.title || "";
|
|
1096
|
-
oChipInstance.configuration = oChipInstance.configuration || "";
|
|
1097
|
-
oChipInstance.layoutData = oChipInstance.layoutData || "";
|
|
1098
|
-
//oChipInstance.remoteCatalogId = oChipInstance.remoteCatalogId || "";
|
|
1099
|
-
|
|
1100
|
-
//TODO the equivalent of "?$expand=Chips/ChipBags/ChipProperties" is missing!
|
|
1101
|
-
oWrapper.create("PageChipInstances", oChipInstance, fnSuccess, fnFailure);
|
|
1102
|
-
};
|
|
1103
|
-
|
|
1104
|
-
/**
|
|
1105
|
-
* Updates the CHIP instance with the given representation which must be the
|
|
1106
|
-
* result of a previous create or read operation.
|
|
1107
|
-
*
|
|
1108
|
-
* @param {object} oChipInstance
|
|
1109
|
-
* the de-serialized JSON representing the CHIP instance to be updated
|
|
1110
|
-
* @param {function ()} [fnSuccess]
|
|
1111
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
1112
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1113
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1114
|
-
* optional object containing the complete error information as delivered
|
|
1115
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1116
|
-
* for more details.
|
|
1117
|
-
* @since 1.2.0
|
|
1118
|
-
*/
|
|
1119
|
-
this.updatePageChipInstance = function (oChipInstance, fnSuccess, fnFailure) {
|
|
1120
|
-
oWrapper.update(oChipInstance, fnSuccess, fnFailure);
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
* Deletes the CHIP instance with the given ID inside the page with given ID.
|
|
1125
|
-
*
|
|
1126
|
-
* @param {string} sPageId
|
|
1127
|
-
* ID of page from which CHIP instance is to be deleted
|
|
1128
|
-
* @param {string} sInstanceId
|
|
1129
|
-
* ID of CHIP instance to be deleted
|
|
1130
|
-
* @param {function ()} [fnSuccess]
|
|
1131
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
1132
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1133
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1134
|
-
* optional object containing the complete error information as delivered
|
|
1135
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1136
|
-
* for more details.
|
|
1137
|
-
* @since 1.2.0
|
|
1138
|
-
*/
|
|
1139
|
-
this.deletePageChipInstance = function (sPageId, sInstanceId, fnSuccess, fnFailure) {
|
|
1140
|
-
if (!sPageId) {
|
|
1141
|
-
throw new sap.ui2.srvc.Error("Missing page ID", "sap.ui2.srvc.PageBuildingService");
|
|
1142
|
-
}
|
|
1143
|
-
if (!sInstanceId) {
|
|
1144
|
-
throw new sap.ui2.srvc.Error("Missing instance ID", "sap.ui2.srvc.PageBuildingService");
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
oWrapper.del("PageChipInstances(pageId='" + encodeURIComponent(sPageId)
|
|
1148
|
-
+ "',instanceId='" + encodeURIComponent(sInstanceId) + "')",
|
|
1149
|
-
fnSuccess, fnFailure);
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
/**
|
|
1153
|
-
* Updates all changed properties for the specified bag using a single batch request.
|
|
1154
|
-
*
|
|
1155
|
-
* @param {object} oParent
|
|
1156
|
-
* parent of the bag to be updated (either page or page CHIP instance)
|
|
1157
|
-
* @param {string} sBagId
|
|
1158
|
-
* ID of the bag
|
|
1159
|
-
* @param {array} [aChangedProperties=[]]
|
|
1160
|
-
* array of existing properties to be changed
|
|
1161
|
-
* @param {array} [aNewProperties=[]]
|
|
1162
|
-
* array of properties to be created
|
|
1163
|
-
* @param {array} [aResetProperties=[]]
|
|
1164
|
-
* array of properties to be reset (since 1.17.1)
|
|
1165
|
-
* @param {function(array,array,array)} [fnSuccess]
|
|
1166
|
-
* a callback function that is executed if the request succeeds, taking three arrays of
|
|
1167
|
-
* response objects for changed, new and reset properties respectively.
|
|
1168
|
-
* For a successful creation, the response object is the new entity. For a successful
|
|
1169
|
-
* change, it is undefined. For a successful reset it is the entity from the underlying scope
|
|
1170
|
-
* or undefined if this does not exist.
|
|
1171
|
-
* For a failed request, it is the corresponding error message.
|
|
1172
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1173
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1174
|
-
* optional object containing the complete error information as delivered
|
|
1175
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1176
|
-
* for more details.
|
|
1177
|
-
* <br/>
|
|
1178
|
-
* <b>NOTE:</b> it is called only in case the whole
|
|
1179
|
-
* <code>$batch</code> request fails!)
|
|
1180
|
-
*
|
|
1181
|
-
* @since 1.11.0
|
|
1182
|
-
* @deprecated Use {@link sap.ui2.srvc.ODataService#openBatchQueue} instead.
|
|
1183
|
-
*/
|
|
1184
|
-
this.updateBagProperties = function (oParent, sBagId, aChangedProperties, aNewProperties,
|
|
1185
|
-
aResetProperties, fnSuccess, fnFailure) {
|
|
1186
|
-
var aChangeRequests = [],
|
|
1187
|
-
aGetRequests = [],
|
|
1188
|
-
i,
|
|
1189
|
-
pos,
|
|
1190
|
-
oProperty,
|
|
1191
|
-
sRequestUri,
|
|
1192
|
-
sMETADATA = "__metadata"; // constant to make JSLint happy
|
|
1193
|
-
|
|
1194
|
-
/* @returns {object} */
|
|
1195
|
-
function extractPayload (oEntity) {
|
|
1196
|
-
var oResult = {
|
|
1197
|
-
__metadata: {
|
|
1198
|
-
type: oEntity[sMETADATA].type,
|
|
1199
|
-
uri: oEntity[sMETADATA].uri
|
|
1200
|
-
}
|
|
1201
|
-
},
|
|
1202
|
-
sPropertyName;
|
|
1203
|
-
|
|
1204
|
-
// filter out unnecessary properties
|
|
1205
|
-
for (sPropertyName in oEntity) {
|
|
1206
|
-
if (Object.prototype.hasOwnProperty.call(oEntity, sPropertyName)
|
|
1207
|
-
&& sPropertyName !== sMETADATA
|
|
1208
|
-
&& sPropertyName.indexOf("$") !== 0
|
|
1209
|
-
&& typeof oEntity[sPropertyName] !== "object") {
|
|
1210
|
-
oResult[sPropertyName] = oEntity[sPropertyName];
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
return oResult;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
if (!oParent) {
|
|
1217
|
-
throw new sap.ui2.srvc.Error("Missing parent object",
|
|
1218
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
if (!sBagId) {
|
|
1222
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.PageBuildingService");
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
//Compatibility for callers not having newly inserted parameter aResetProperties
|
|
1226
|
-
if (typeof aResetProperties === "function") {
|
|
1227
|
-
this.updateBagProperties(oParent, sBagId, aChangedProperties, aNewProperties, [],
|
|
1228
|
-
/*fnSuccess=*/aResetProperties, /*fnFailure=*/fnSuccess);
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
aChangedProperties = aChangedProperties || [];
|
|
1233
|
-
aNewProperties = aNewProperties || [];
|
|
1234
|
-
aResetProperties = aResetProperties || [];
|
|
1235
|
-
|
|
1236
|
-
if (aChangedProperties.length === 0 && aNewProperties.length === 0 &&
|
|
1237
|
-
aResetProperties.length === 0) {
|
|
1238
|
-
throw new sap.ui2.srvc.Error("No properties to update, create or reset",
|
|
1239
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
// PUT requests
|
|
1243
|
-
for (i = 0; i < aChangedProperties.length; i += 1) {
|
|
1244
|
-
oProperty = aChangedProperties[i];
|
|
1245
|
-
sRequestUri = oProperty[sMETADATA].uri;
|
|
1246
|
-
// cut protocol, hostname and base URI from request URI
|
|
1247
|
-
pos = sRequestUri.indexOf(oWrapper.getBaseUrl());
|
|
1248
|
-
if (pos >= 0) {
|
|
1249
|
-
sRequestUri = sRequestUri.slice(pos + oWrapper.getBaseUrl().length);
|
|
1250
|
-
}
|
|
1251
|
-
aChangeRequests.push({
|
|
1252
|
-
requestUri: sRequestUri,
|
|
1253
|
-
method: "PUT",
|
|
1254
|
-
data: extractPayload(oProperty)
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
// POST requests
|
|
1259
|
-
sRequestUri = oParent.instanceId ? "ChipInstanceProperties" : "Properties";
|
|
1260
|
-
for (i = 0; i < aNewProperties.length; i += 1) {
|
|
1261
|
-
oProperty = aNewProperties[i];
|
|
1262
|
-
if (!oProperty.name) {
|
|
1263
|
-
throw new sap.ui2.srvc.Error("Missing property name", "sap.ui2.srvc.PageBuildingService");
|
|
1264
|
-
}
|
|
1265
|
-
if (oParent.instanceId) {
|
|
1266
|
-
oProperty.instanceId = oParent.instanceId;
|
|
1267
|
-
oProperty.pageId = oParent.pageId;
|
|
1268
|
-
} else {
|
|
1269
|
-
oProperty.pageId = oParent.id;
|
|
1270
|
-
}
|
|
1271
|
-
oProperty.bagId = sBagId;
|
|
1272
|
-
aChangeRequests.push({
|
|
1273
|
-
requestUri: sRequestUri,
|
|
1274
|
-
method: "POST",
|
|
1275
|
-
data: oProperty
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
// Reset property maps to DELETE and GET request
|
|
1280
|
-
for (i = 0; i < aResetProperties.length; i += 1) {
|
|
1281
|
-
oProperty = aResetProperties[i];
|
|
1282
|
-
sRequestUri = oProperty[sMETADATA].uri;
|
|
1283
|
-
// cut protocol, hostname and base URI from request URI
|
|
1284
|
-
pos = sRequestUri.indexOf(oWrapper.getBaseUrl());
|
|
1285
|
-
if (pos >= 0) {
|
|
1286
|
-
sRequestUri = sRequestUri.slice(pos + oWrapper.getBaseUrl().length);
|
|
1287
|
-
}
|
|
1288
|
-
aChangeRequests.push({
|
|
1289
|
-
requestUri: sRequestUri,
|
|
1290
|
-
method: "DELETE"
|
|
1291
|
-
});
|
|
1292
|
-
aGetRequests.push({
|
|
1293
|
-
requestUri: sRequestUri,
|
|
1294
|
-
method: "GET"
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
batch(aChangeRequests, aGetRequests,
|
|
1299
|
-
function (aChangeResponses, aGetResponses) {
|
|
1300
|
-
var aResetResponses =
|
|
1301
|
-
aChangeResponses.slice(aNewProperties.length + aChangedProperties.length),
|
|
1302
|
-
i;
|
|
1303
|
-
|
|
1304
|
-
for (i = 0; i < aResetResponses.length; i += 1) {
|
|
1305
|
-
if (aResetResponses[i] === undefined) { //DELETE ok
|
|
1306
|
-
if (typeof aGetResponses[i] === "object") { //GET ok
|
|
1307
|
-
aResetResponses[i] = aGetResponses[i];
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
if (fnSuccess) {
|
|
1312
|
-
fnSuccess(
|
|
1313
|
-
aChangeResponses.slice(0, aChangedProperties.length), // PUT responses
|
|
1314
|
-
aChangeResponses.slice(aChangedProperties.length,
|
|
1315
|
-
aNewProperties.length + aChangedProperties.length), // POST responses
|
|
1316
|
-
aResetResponses
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
}, fnFailure);
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* Creates a new property with the given value.
|
|
1324
|
-
*
|
|
1325
|
-
* @param {string|object} vParent
|
|
1326
|
-
* ID of the page or parent object (either page or page CHIP instance; must be the result
|
|
1327
|
-
* of a previous create or read operation) of the bag for which a property needs to be
|
|
1328
|
-
* created
|
|
1329
|
-
* @param {string} sBagId
|
|
1330
|
-
* ID of the bag
|
|
1331
|
-
* @param {string} sPropertyName
|
|
1332
|
-
* the property name
|
|
1333
|
-
* @param {string} sValue
|
|
1334
|
-
* the property value
|
|
1335
|
-
* @param {string} [sTranslatable]
|
|
1336
|
-
* determines if the new property is a translatable one (since 1.19.0)
|
|
1337
|
-
* <b>Note:</b> this is treated here as a plain string by intent, although the backend will
|
|
1338
|
-
* treat it like a boolean (<code>" "</code> vs. <code>"X"</code>)
|
|
1339
|
-
* @param {function (object)} [fnSuccess]
|
|
1340
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
1341
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1342
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1343
|
-
* optional object containing the complete error information as delivered
|
|
1344
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1345
|
-
* for more details.
|
|
1346
|
-
* @since 1.3.0
|
|
1347
|
-
*/
|
|
1348
|
-
this.createProperty = function (vParent, sBagId, sPropertyName, sValue, sTranslatable,
|
|
1349
|
-
fnSuccess, fnFailure) {
|
|
1350
|
-
var oProperty;
|
|
1351
|
-
|
|
1352
|
-
if (!vParent) {
|
|
1353
|
-
throw new sap.ui2.srvc.Error("Missing parent ID or object",
|
|
1354
|
-
"sap.ui2.srvc.PageBuildingService");
|
|
1355
|
-
}
|
|
1356
|
-
if (!sBagId) {
|
|
1357
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.PageBuildingService");
|
|
1358
|
-
}
|
|
1359
|
-
if (!sPropertyName) {
|
|
1360
|
-
throw new sap.ui2.srvc.Error("Missing property name", "sap.ui2.srvc.PageBuildingService");
|
|
1361
|
-
}
|
|
1362
|
-
if (typeof sTranslatable === "function") {
|
|
1363
|
-
// sTranslatable missing, shift arguments appropriately
|
|
1364
|
-
this.createProperty(vParent, sBagId, sPropertyName, sValue, undefined,
|
|
1365
|
-
/*fnSuccess=*/sTranslatable, /*fnFailure=*/fnSuccess);
|
|
1366
|
-
return;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
oProperty = {
|
|
1370
|
-
bagId: sBagId,
|
|
1371
|
-
name: sPropertyName,
|
|
1372
|
-
pageId: vParent,
|
|
1373
|
-
translatable: sTranslatable,
|
|
1374
|
-
value: sValue
|
|
1375
|
-
};
|
|
1376
|
-
if (typeof vParent !== "string") {
|
|
1377
|
-
if (vParent.instanceId) {
|
|
1378
|
-
oProperty.instanceId = vParent.instanceId;
|
|
1379
|
-
oProperty.pageId = vParent.pageId;
|
|
1380
|
-
} else {
|
|
1381
|
-
oProperty.pageId = vParent.id;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
oWrapper.create((oProperty.instanceId ? "ChipInstanceProperties" : "Properties"),
|
|
1386
|
-
oProperty, fnSuccess, fnFailure);
|
|
1387
|
-
};
|
|
1388
|
-
|
|
1389
|
-
/**
|
|
1390
|
-
* Updates the property with the given representation which must be the result of
|
|
1391
|
-
* a previous create or read operation.
|
|
1392
|
-
*
|
|
1393
|
-
* @param {object} oProperty
|
|
1394
|
-
* the de-serialized JSON representing the property to be updated
|
|
1395
|
-
* @param {function ()} [fnSuccess]
|
|
1396
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
1397
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1398
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1399
|
-
* optional object containing the complete error information as delivered
|
|
1400
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1401
|
-
* for more details.
|
|
1402
|
-
* @since 1.3.0
|
|
1403
|
-
*/
|
|
1404
|
-
this.updateProperty = function (oProperty, fnSuccess, fnFailure) {
|
|
1405
|
-
oWrapper.update(oProperty, fnSuccess, fnFailure);
|
|
1406
|
-
};
|
|
1407
|
-
|
|
1408
|
-
/**
|
|
1409
|
-
* Deletes the property with the given representation which must be the result of
|
|
1410
|
-
* a previous create or read operation.
|
|
1411
|
-
*
|
|
1412
|
-
* @param {object} oProperty
|
|
1413
|
-
* the de-serialized JSON representing the property to be deleted
|
|
1414
|
-
* @param {function ()} [fnSuccess]
|
|
1415
|
-
* a callback function that is executed if the request succeeds, taking no data
|
|
1416
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1417
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1418
|
-
* optional object containing the complete error information as delivered
|
|
1419
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1420
|
-
* for more details.
|
|
1421
|
-
* @since 1.19.0
|
|
1422
|
-
*/
|
|
1423
|
-
this.deleteProperty = function (oProperty, fnSuccess, fnFailure) {
|
|
1424
|
-
oWrapper.del(oProperty, fnSuccess, fnFailure);
|
|
1425
|
-
};
|
|
1426
|
-
|
|
1427
|
-
/**
|
|
1428
|
-
* Reads the CHIP with the given ID.
|
|
1429
|
-
*
|
|
1430
|
-
* @param {string} sChipId
|
|
1431
|
-
* ID of the CHIP to be loaded
|
|
1432
|
-
* @param {function (object)} fnSuccess
|
|
1433
|
-
* a callback function that is executed if the request succeeds, taking the processed data
|
|
1434
|
-
* @param {function (string, object=)} [fnFailure]
|
|
1435
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
1436
|
-
* optional object containing the complete error information as delivered
|
|
1437
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
1438
|
-
* for more details.
|
|
1439
|
-
* @since 1.2.0
|
|
1440
|
-
*/
|
|
1441
|
-
this.readChip = function (sChipId, fnSuccess, fnFailure) {
|
|
1442
|
-
if (!sChipId) {
|
|
1443
|
-
throw new sap.ui2.srvc.Error("Missing CHIP ID", "sap.ui2.srvc.PageBuildingService");
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
oWrapper.read("Chips('" + encodeURIComponent(sChipId) + "')" +
|
|
1447
|
-
"?$expand=ChipBags/ChipProperties", fnSuccess, fnFailure);
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
|
-
// constructor code -------------------------------------------------------
|
|
1451
|
-
if (!sap.ui2.srvc.Error) {
|
|
1452
|
-
fnRequire("sap.ui2.srvc.error");
|
|
1453
|
-
}
|
|
1454
|
-
if (typeof vODataBase === "string") {
|
|
1455
|
-
oWrapper = new sap.ui2.srvc.ODataWrapper(vODataBase, this, /*bSupportsChangeSets=*/true);
|
|
1456
|
-
} else {
|
|
1457
|
-
oWrapper = vODataBase;
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
/*
|
|
1461
|
-
* Add cache buster token maps as property of the corresponding method.
|
|
1462
|
-
* Entries must look like:
|
|
1463
|
-
* key: ID of entity
|
|
1464
|
-
* value: cache buster token
|
|
1465
|
-
*/
|
|
1466
|
-
this.readAllCatalogs.cacheBusterTokens = new sap.ui2.srvc.Map();
|
|
1467
|
-
this.readPageSet.cacheBusterTokens = new sap.ui2.srvc.Map();
|
|
1468
|
-
|
|
1469
|
-
/*
|
|
1470
|
-
* Enable sticky session in non PERS scopes: All operations in PERS should be
|
|
1471
|
-
* faster and synchronous than in CONF and CUST. So the user must be really
|
|
1472
|
-
* fast to obtain an error because of load balancing inconsistencies. Another
|
|
1473
|
-
* reason is client-side caching. If the response is cached, the load balancing
|
|
1474
|
-
* mechanism may be bypassed. This may not be fine for users of the launchpad.
|
|
1475
|
-
*/
|
|
1476
|
-
if (!oWrapper.isStickySessionEnabled() && !bIsPersonalization) {
|
|
1477
|
-
oWrapper.enableStickySession();
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
sap.ui2.srvc.ODataService.call(this, oWrapper, fnDefaultFailure);
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
|
-
// public factory function ***************************************************
|
|
1484
|
-
|
|
1485
|
-
if (!sap.ui2.srvc.createPageBuildingService) {
|
|
1486
|
-
/**
|
|
1487
|
-
* Constructs a facade to the page building service with the given base URI.
|
|
1488
|
-
*
|
|
1489
|
-
* @param {string} sBaseUri
|
|
1490
|
-
* base URI of the page building service
|
|
1491
|
-
* @param {function (string)} [fnDefaultFailure]
|
|
1492
|
-
* default error handler, taking an error message
|
|
1493
|
-
* @param {boolean} [bIsPersonalization=false]
|
|
1494
|
-
* defines the return value of {@link sap.ui2.srvc.PageBuildingService#isPersonalization} of
|
|
1495
|
-
* the returned instance (since 1.16.1)
|
|
1496
|
-
* @returns {sap.ui2.srvc.PageBuildingService}
|
|
1497
|
-
* a facade to the page building service
|
|
1498
|
-
* @since 1.2.0
|
|
1499
|
-
*
|
|
1500
|
-
* @see sap.ui2.srvc.PageBuildingService
|
|
1501
|
-
*/
|
|
1502
|
-
sap.ui2.srvc.createPageBuildingService = function (sBaseUri, fnDefaultFailure,
|
|
1503
|
-
bIsPersonalization) {
|
|
1504
|
-
return new sap.ui2.srvc.PageBuildingService(sBaseUri, fnDefaultFailure, bIsPersonalization);
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
/// @end
|
|
1508
|
-
}());
|