@sapui5/sap.ushell_abap 1.94.0 → 1.96.1
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/ui2/srvc/ODataWrapper.js +1 -1
- package/src/main/js/sap/ushell_abap/.library +4 -9
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +12 -5
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +11 -7
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +47 -32
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +46 -38
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +438 -398
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +25 -15
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +3 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +16 -7
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +8 -8
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +11 -4
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +9 -3
- package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +13 -11
- 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.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +8 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +9 -0
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +12 -5
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +21 -22
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +8 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +6 -3
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +10 -5
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +7 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +10 -3
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +21 -16
- package/src/main/js/sap/ushell_abap/library.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +186 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +704 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +930 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +1027 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +216 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +933 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +45 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +647 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +251 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1262 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +920 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1498 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +466 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +52 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +767 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +139 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +244 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +150 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +165 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +330 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +70 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +50 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +289 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +43 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +115 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +9 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +105 -0
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +128 -0
- package/ui5.yaml +30 -0
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/Component.js +0 -426
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/css/style.css +0 -1
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n.properties +0 -56
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ar.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_bg.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ca.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cs.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cy.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_da.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_de.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_el.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_GB.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_sappsd.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saprigi.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saptrc.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es_MX.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_et.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fi.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr_CA.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hi.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hr.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hu.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_id.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_it.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_iw.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ja.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_kk.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ko.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lt.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lv.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ms.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_nl.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_no.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pl.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt_PT.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ro.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ru.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sh.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sk.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sl.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sv.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_th.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_tr.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_uk.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_vi.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_CN.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_TW.properties +0 -36
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/manifest.json +0 -153
- package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/model/models.js +0 -14
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
// Copyright (c) 2009-2021 SAP SE. All rights reserved.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileOverview A factory for wrapper objects corresponding to the four
|
|
5
|
+
* entities of the page building service: catalogs, pages, CHIP instances, and
|
|
6
|
+
* CHIPs.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
sap.ui.define([
|
|
10
|
+
"sap/ushell_abap/pbServices/ui2/Chip",
|
|
11
|
+
"sap/ushell_abap/pbServices/ui2/Error",
|
|
12
|
+
"sap/ushell_abap/pbServices/ui2/Catalog",
|
|
13
|
+
"sap/ushell_abap/pbServices/ui2/ChipDefinition",
|
|
14
|
+
"sap/ushell_abap/pbServices/ui2/PageBuildingService",
|
|
15
|
+
"sap/ushell_abap/pbServices/ui2/ChipInstance",
|
|
16
|
+
"sap/ushell_abap/pbServices/ui2/Page",
|
|
17
|
+
"sap/ushell_abap/pbServices/ui2/PageSet",
|
|
18
|
+
"sap/ushell_abap/pbServices/ui2/Utils",
|
|
19
|
+
"sap/base/Log"
|
|
20
|
+
], function (
|
|
21
|
+
Chip,
|
|
22
|
+
SrvcError,
|
|
23
|
+
Catalog,
|
|
24
|
+
ChipDefinition,
|
|
25
|
+
PageBuildingService,
|
|
26
|
+
ChipInstance,
|
|
27
|
+
Page,
|
|
28
|
+
PageSet,
|
|
29
|
+
Utils,
|
|
30
|
+
Log
|
|
31
|
+
) {
|
|
32
|
+
"use strict";
|
|
33
|
+
|
|
34
|
+
// "public class" ************************************************************
|
|
35
|
+
|
|
36
|
+
//TODO how could a new page be created via this factory?
|
|
37
|
+
//TODO default error handler, maybe same as PBS?
|
|
38
|
+
/**
|
|
39
|
+
* Constructs a new factory based on the given page building service.
|
|
40
|
+
* A factory for creating wrapper objects corresponding to catalogs, pages,
|
|
41
|
+
* CHIP instances, or CHIPs loaded from a page building service.
|
|
42
|
+
* <p>
|
|
43
|
+
* All factory methods are able to create stubs synchronously. Those stubs
|
|
44
|
+
* need to be loaded asynchronously in order to become complete.
|
|
45
|
+
* <p>
|
|
46
|
+
* Note: All error handlers are optional and default to
|
|
47
|
+
* <code>getPageBuildingService().getDefaultErrorHandler()</code>
|
|
48
|
+
*
|
|
49
|
+
* @param {sap.ushell_abap.pbServices.ui2.PageBuildingService} oPbs
|
|
50
|
+
* the page building service
|
|
51
|
+
*
|
|
52
|
+
* @see sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler
|
|
53
|
+
* @see #getPageBuildingService
|
|
54
|
+
* @class
|
|
55
|
+
* @since 1.2.0
|
|
56
|
+
*/
|
|
57
|
+
var Factory = function (oPbs) {
|
|
58
|
+
var mChips = {}, // cache for CHIPs
|
|
59
|
+
mCatalogs = {}, // cache for catalogs
|
|
60
|
+
mChipDefinitions = {}, // cache for CHIP definitions
|
|
61
|
+
oRemoteCatalogServicesByBaseUrl, // mapping from base URL to remote catalog service
|
|
62
|
+
that = this;
|
|
63
|
+
|
|
64
|
+
// BEWARE: constructor code below!
|
|
65
|
+
|
|
66
|
+
// "private" methods ---------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
// "public" methods ----------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Registers a remote catalog service for the given base URL.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} sBaseUrl
|
|
74
|
+
* the base URL
|
|
75
|
+
* @param {sap.ushell_abap.pbServices.ui2.RemoteCatalogService} oRemoteCatalogService
|
|
76
|
+
* the remote catalog service compatible to {@link sap.ushell_abap.pbServices.ui2.RemoteCatalogService}
|
|
77
|
+
* @throws Error if the base URL is already registered
|
|
78
|
+
* @since 1.19.1
|
|
79
|
+
*/
|
|
80
|
+
this.addRemoteCatalogService = function (sBaseUrl, oRemoteCatalogService) {
|
|
81
|
+
if (!sBaseUrl) {
|
|
82
|
+
throw new SrvcError("Invalid base URL", "sap.ushell_abap.pbServices.ui2.Factory");
|
|
83
|
+
}
|
|
84
|
+
if (typeof oRemoteCatalogService.readChips !== "function") {
|
|
85
|
+
throw new SrvcError("Invalid remote catalog service", "sap.ushell_abap.pbServices.ui2.Factory");
|
|
86
|
+
}
|
|
87
|
+
sBaseUrl = sBaseUrl.replace(/\/$/, ""); // ignore trailing '/'
|
|
88
|
+
if (oRemoteCatalogServicesByBaseUrl.containsKey(sBaseUrl)) {
|
|
89
|
+
throw new SrvcError("Base URL '" + sBaseUrl + "' already registered",
|
|
90
|
+
"sap.ushell_abap.pbServices.ui2.Factory");
|
|
91
|
+
}
|
|
92
|
+
oRemoteCatalogServicesByBaseUrl.put(sBaseUrl, oRemoteCatalogService);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new catalog with the given ID and returns the stub. If a success
|
|
97
|
+
* handler is given, the catalog will be loaded automatically from the page
|
|
98
|
+
* building service, calling one of the given handlers.
|
|
99
|
+
* <p>
|
|
100
|
+
* Caches the created catalog, so that a subsequent request for a catalog with
|
|
101
|
+
* the same ID will be answered from the cache.
|
|
102
|
+
* <p>
|
|
103
|
+
* Note: All contained CHIPs will typically be stubs only!
|
|
104
|
+
* <p>
|
|
105
|
+
* Note: If the catalog is a remote catalog and a success handler is given,
|
|
106
|
+
* an attempt is made to load the chips. If this load attempts failed, the promise
|
|
107
|
+
* is rejected with the 2nd argument being the (semi-)instantiated catalog with an
|
|
108
|
+
* *empty* chip collection! This catalog is not a stub itself!
|
|
109
|
+
*
|
|
110
|
+
* @param {string|object} vCatalogData
|
|
111
|
+
* the catalog ID or the raw catalog representation as loaded via the page building service
|
|
112
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.Catalog)} [fnSuccess]
|
|
113
|
+
* success handler for asynchronous loading
|
|
114
|
+
* @param {function (string, sap.ushell_abap.pbServices.ui2.Catalog=, object=)} fnFailure
|
|
115
|
+
* error handler, taking an error message, an optional {@link sap.ushell_abap.pbServices.ui2.Catalog}
|
|
116
|
+
* instance and, since version 1.28.6, an optional object containing the
|
|
117
|
+
* complete error information.<br />
|
|
118
|
+
* See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
119
|
+
* for more details about the complete error information parameter.
|
|
120
|
+
* If fnFailure is not given
|
|
121
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used.
|
|
122
|
+
*
|
|
123
|
+
* @returns {sap.ushell_abap.pbServices.ui2.Catalog}
|
|
124
|
+
* the newly created catalog, as a stub
|
|
125
|
+
* @since 1.2.0
|
|
126
|
+
*/
|
|
127
|
+
this.createCatalog = function (vCatalogData, fnSuccess, fnFailure) {
|
|
128
|
+
var that = this,
|
|
129
|
+
oCatalog,
|
|
130
|
+
sCatalogId = typeof vCatalogData === "object" ? vCatalogData.id : vCatalogData;
|
|
131
|
+
|
|
132
|
+
// call fnFailure but insert oCatalog as second argument
|
|
133
|
+
function fnFailureWithCatalog () {
|
|
134
|
+
var aArgs;
|
|
135
|
+
fnFailure = fnFailure || that.getPageBuildingService().getDefaultErrorHandler(); // both are optional
|
|
136
|
+
if (fnFailure) {
|
|
137
|
+
// convert a to array and add catalog at index 1
|
|
138
|
+
aArgs = Array.prototype.slice.call(arguments);
|
|
139
|
+
aArgs.splice(1, 0, oCatalog);
|
|
140
|
+
fnFailure.apply(null, aArgs);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function failWithOriginalArgs () {
|
|
145
|
+
// use same error message and error object of the first failure
|
|
146
|
+
fnFailureWithCatalog.apply(null, oCatalog.getCachedRemoteFailureArguments());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (Object.prototype.hasOwnProperty.call(mCatalogs, sCatalogId)) {
|
|
150
|
+
oCatalog = mCatalogs[sCatalogId].catalog;
|
|
151
|
+
if (typeof vCatalogData === "object" && oCatalog.getCatalogData() === undefined) {
|
|
152
|
+
// re-apply constructor function to existing instance which knows only its ID
|
|
153
|
+
Catalog.call(oCatalog, this, vCatalogData);
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
oCatalog = new Catalog(this, vCatalogData);
|
|
157
|
+
mCatalogs[sCatalogId] = {
|
|
158
|
+
catalog: oCatalog,
|
|
159
|
+
chips: {}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (fnSuccess) {
|
|
163
|
+
// since catalogs are cached it might not be a stub any more
|
|
164
|
+
if (oCatalog.isStub()) {
|
|
165
|
+
oCatalog.load(fnSuccess.bind(null, oCatalog), fnFailureWithCatalog);
|
|
166
|
+
} else if (oCatalog.getCachedRemoteFailureArguments() !== undefined) {
|
|
167
|
+
// catalog was already created before, no need to load it again
|
|
168
|
+
Utils.callHandler(failWithOriginalArgs, failWithOriginalArgs, /*async=*/true);
|
|
169
|
+
} else {
|
|
170
|
+
Utils.callHandler(fnSuccess.bind(null, oCatalog), fnFailureWithCatalog, /*async=*/true);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return oCatalog;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Creates a CHIP instance for the given raw CHIP representation as loaded
|
|
178
|
+
* via the page building service. If a success handler is given, the CHIP
|
|
179
|
+
* will be loaded automatically, calling one of the given handlers.
|
|
180
|
+
* <p>
|
|
181
|
+
* Caches the created CHIPs, so that a subsequent request for a CHIP with
|
|
182
|
+
* the same ID will be answered from the cache.
|
|
183
|
+
*
|
|
184
|
+
* @param {object} oRawChip
|
|
185
|
+
* the raw CHIP representation as loaded via the page building service
|
|
186
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.Chip)} [fnSuccess]
|
|
187
|
+
* success handler for asynchronous loading
|
|
188
|
+
* @param {function (string, object=)} [fnFailure]
|
|
189
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
190
|
+
* optional object containing the complete error information as delivered
|
|
191
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
192
|
+
* for more details.
|
|
193
|
+
* If not given
|
|
194
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
195
|
+
*
|
|
196
|
+
* @returns {sap.ushell_abap.pbServices.ui2.Chip}
|
|
197
|
+
* the newly created CHIP, as a stub
|
|
198
|
+
* @since 1.2.0
|
|
199
|
+
*/
|
|
200
|
+
this.createChip = function (oRawChip, fnSuccess, fnFailure) {
|
|
201
|
+
var sCatalogId = oRawChip.remoteCatalogId,
|
|
202
|
+
sChipId = oRawChip.id,
|
|
203
|
+
oCache,
|
|
204
|
+
oChip;
|
|
205
|
+
if (sCatalogId) {
|
|
206
|
+
// the catalog is irrelevant, ensure that the cache entry for it exists
|
|
207
|
+
this.createCatalog(sCatalogId);
|
|
208
|
+
oCache = mCatalogs[sCatalogId].chips;
|
|
209
|
+
} else {
|
|
210
|
+
oCache = mChips;
|
|
211
|
+
}
|
|
212
|
+
if (Object.prototype.hasOwnProperty.call(oCache, sChipId)) {
|
|
213
|
+
oChip = oCache[sChipId];
|
|
214
|
+
oChip.update(oRawChip);
|
|
215
|
+
} else {
|
|
216
|
+
oChip = new Chip(oRawChip, this);
|
|
217
|
+
oCache[sChipId] = oChip;
|
|
218
|
+
}
|
|
219
|
+
if (fnSuccess) {
|
|
220
|
+
if (oChip.isStub()) {
|
|
221
|
+
oChip.load(fnSuccess.bind(null, oChip), fnFailure);
|
|
222
|
+
} else {
|
|
223
|
+
fnFailure = fnFailure || this.getPageBuildingService().getDefaultErrorHandler();
|
|
224
|
+
Utils.callHandler(fnSuccess.bind(null, oChip), fnFailure, true);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return oChip;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Creates a CHIP definition for the given URL. Caches the created objects, making sure that
|
|
232
|
+
* even parallel calls to this function result in a single GET request only.
|
|
233
|
+
* <p> Note: the newly created CHIP definition is returned to the success handler only!
|
|
234
|
+
*
|
|
235
|
+
* @param {string} sUrl
|
|
236
|
+
* the URL to the CHIP definition XML
|
|
237
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.ChipDefinition)} fnSuccess
|
|
238
|
+
* success handler for asynchronous loading; a new clone is passed to each handler!
|
|
239
|
+
* @param {function (string)} [fnFailure]
|
|
240
|
+
* error handler, taking an error message. If not given
|
|
241
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
242
|
+
*
|
|
243
|
+
* @since 1.17.0
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
this.createChipDefinition = function (sUrl, fnSuccess, fnFailure) {
|
|
247
|
+
var oChipDefinition, aLoadHandlers;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Calls the given success handler (a)synchronously with a clone of the given CHIP
|
|
251
|
+
* definition. Errors thrown in the success handler are caught and reported to the error
|
|
252
|
+
* handler.
|
|
253
|
+
*
|
|
254
|
+
* @param {sap.ushell_abap.pbServices.ui2.ChipDefinition} oOriginalChipDefinition
|
|
255
|
+
* original CHIP definition, will be cloned before it is passed to success handler
|
|
256
|
+
* @param {function ()} fnSomeSuccess
|
|
257
|
+
* no-args success handler
|
|
258
|
+
* @param {function (string)} [fnSomeFailure]
|
|
259
|
+
* error handler, taking an error message; MUST NOT throw any error itself! If not given
|
|
260
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
261
|
+
* @param {boolean} [bAsync=false]
|
|
262
|
+
* whether the call shall be asynchronously
|
|
263
|
+
* @private
|
|
264
|
+
*/
|
|
265
|
+
function call (oOriginalChipDefinition, fnSomeSuccess, fnSomeFailure, bAsync) {
|
|
266
|
+
Utils.callHandler(
|
|
267
|
+
fnSomeSuccess.bind(null, new ChipDefinition(oOriginalChipDefinition)),
|
|
268
|
+
fnSomeFailure,
|
|
269
|
+
bAsync
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function successHandler (oXml) {
|
|
274
|
+
var i, n;
|
|
275
|
+
var oChipDefInstance = new ChipDefinition(oXml);
|
|
276
|
+
mChipDefinitions[sUrl] = oChipDefInstance;
|
|
277
|
+
// loading has finished, call all waiting load handlers
|
|
278
|
+
for (i = 0, n = aLoadHandlers.length; i < n; i += 2) {
|
|
279
|
+
call(oChipDefInstance, aLoadHandlers[i], aLoadHandlers[i + 1], false);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function errorHandler (vError) {
|
|
284
|
+
var i, n, sMessage;
|
|
285
|
+
|
|
286
|
+
if (typeof vError === "string") {
|
|
287
|
+
// Util.get error handler returns a sting only
|
|
288
|
+
sMessage = vError;
|
|
289
|
+
} else {
|
|
290
|
+
// jQuery.sap.loadResource error handler returns an Error object
|
|
291
|
+
sMessage = vError.message;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
mChipDefinitions[sUrl] = sMessage; // Note: overwrites load handlers!
|
|
295
|
+
// loading has failed, call all waiting failure handlers
|
|
296
|
+
for (i = 0, n = aLoadHandlers.length; i < n; i += 2) {
|
|
297
|
+
aLoadHandlers[i + 1](sMessage);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (!sUrl) {
|
|
302
|
+
throw new SrvcError("Missing URL", "Factory");
|
|
303
|
+
}
|
|
304
|
+
if (typeof fnSuccess !== "function") {
|
|
305
|
+
throw new SrvcError("Missing success handler", "Factory");
|
|
306
|
+
}
|
|
307
|
+
fnFailure = fnFailure || this.getPageBuildingService().getDefaultErrorHandler();
|
|
308
|
+
|
|
309
|
+
if (window.jQuery && jQuery.sap && typeof jQuery.sap.loadResource === "function") {
|
|
310
|
+
// if UI5 is available, the cache buster token must be added to sURL, as load jQuery.sap.loadResource
|
|
311
|
+
// (further down) is used to load the XML.
|
|
312
|
+
sUrl = Utils.addCacheBusterTokenUsingUshellConfig(sUrl);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (Object.prototype.hasOwnProperty.call(mChipDefinitions, sUrl)) {
|
|
316
|
+
// cache hit: either array of load handlers, or CHIP definition, or error message
|
|
317
|
+
oChipDefinition = aLoadHandlers = mChipDefinitions[sUrl];
|
|
318
|
+
|
|
319
|
+
if (Utils.isArray(aLoadHandlers)) {
|
|
320
|
+
// wait until loading has finished (one way or the other)
|
|
321
|
+
aLoadHandlers.push(fnSuccess, fnFailure);
|
|
322
|
+
} else if (oChipDefinition instanceof ChipDefinition) {
|
|
323
|
+
// already loaded
|
|
324
|
+
call(oChipDefinition, fnSuccess, fnFailure, true);
|
|
325
|
+
} else {
|
|
326
|
+
// error message or illegal state
|
|
327
|
+
Utils.callHandler(fnFailure.bind(null, oChipDefinition), null, true);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// loading is in progress
|
|
333
|
+
aLoadHandlers = [fnSuccess, fnFailure];
|
|
334
|
+
mChipDefinitions[sUrl] = aLoadHandlers;
|
|
335
|
+
|
|
336
|
+
if (window.jQuery && jQuery.sap && typeof jQuery.sap.loadResource === "function") {
|
|
337
|
+
// if UI5 is available use loadResource, as it also looks into preload files.
|
|
338
|
+
// NOTE: the cache buster token was already added to sUrl some lines above.
|
|
339
|
+
// RESTRICTION: CHIP Definition XML files will only be loaded from preload file, if NO cache buster is
|
|
340
|
+
// in use. With cache buster, a request is sent (which most likely is served from browser cache).
|
|
341
|
+
// This is because loadResource matches the URLs and expect the UI5 cache buster token to be used
|
|
342
|
+
// (for Smart Business tiles), but we inject the UI2 token.
|
|
343
|
+
jQuery.sap.loadResource({ dataType: "xml", url: sUrl, async: true })
|
|
344
|
+
.then(successHandler)
|
|
345
|
+
.catch(errorHandler);
|
|
346
|
+
} else {
|
|
347
|
+
// no UI5
|
|
348
|
+
Utils.get(sUrl, /*XML=*/true, successHandler, errorHandler);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Creates a new CHIP instance instance for the given raw CHIP instance
|
|
354
|
+
* representation as loaded via the page building service. If a success
|
|
355
|
+
* handler is given, the CHIP instance will be loaded automatically, calling
|
|
356
|
+
* one of the given handlers.
|
|
357
|
+
* <p>
|
|
358
|
+
*
|
|
359
|
+
* @param {object} oRawChipInstance
|
|
360
|
+
* the raw CHIP instance representation as loaded via the page building service
|
|
361
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.ChipInstance)} [fnSuccess]
|
|
362
|
+
* success handler for asynchronous loading
|
|
363
|
+
* @param {function (string, object=)} [fnFailure]
|
|
364
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
365
|
+
* optional object containing the complete error information as delivered
|
|
366
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
367
|
+
* for more details.
|
|
368
|
+
* If not given
|
|
369
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
370
|
+
* @param {sap.ushell_abap.pbServices.ui2.Page} [oPage]
|
|
371
|
+
* (since 1.9.0) the page to which this CHIP instance belongs; this is passed on to the CHIP
|
|
372
|
+
* instance itself, see {@link sap.ushell_abap.pbServices.ui2.ChipInstance#getPage}
|
|
373
|
+
*
|
|
374
|
+
* @returns {sap.ushell_abap.pbServices.ui2.ChipInstance}
|
|
375
|
+
* the newly created CHIP instance, as a stub
|
|
376
|
+
* @since 1.2.0
|
|
377
|
+
*/
|
|
378
|
+
this.createChipInstance = function (oRawChipInstance, fnSuccess, fnFailure, oPage) {
|
|
379
|
+
var oChip,
|
|
380
|
+
oChipInstance;
|
|
381
|
+
|
|
382
|
+
// ensure at least a "null object" CHIP that knows its IDs
|
|
383
|
+
oRawChipInstance.Chip = oRawChipInstance.Chip || { $proxy: true };
|
|
384
|
+
oRawChipInstance.Chip.id = oRawChipInstance.Chip.id || oRawChipInstance.chipId;
|
|
385
|
+
oRawChipInstance.Chip.remoteCatalogId = oRawChipInstance.Chip.remoteCatalogId
|
|
386
|
+
|| oRawChipInstance.remoteCatalogId;
|
|
387
|
+
|
|
388
|
+
if (oRawChipInstance.RemoteCatalog && oRawChipInstance.RemoteCatalog.id) {
|
|
389
|
+
// ensure that we do not lose the information about the remote catalog
|
|
390
|
+
this.createCatalog(oRawChipInstance.RemoteCatalog);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
oChip = this.createChip(oRawChipInstance.Chip);
|
|
394
|
+
oChipInstance = new ChipInstance(this, oRawChipInstance, oChip, oPage);
|
|
395
|
+
if (fnSuccess) {
|
|
396
|
+
oChipInstance.load(fnSuccess.bind(null, oChipInstance), fnFailure);
|
|
397
|
+
}
|
|
398
|
+
return oChipInstance;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Creates a new catalog in the backend based on the given raw data. The success handler is
|
|
403
|
+
* called as soon as the catalog has been created and the {@link sap.ushell_abap.pbServices.ui2.Catalog} is
|
|
404
|
+
* not a stub anymore. Typically, this will be used to create "remote catalogs", i.e. pointers
|
|
405
|
+
* to existing catalogs on a remote server.
|
|
406
|
+
* <p>
|
|
407
|
+
* Creating a remote catalog requires two steps: first the catalog data is created via the
|
|
408
|
+
* factory's page building service, then the catalog's CHIPs are loaded from the appropriate
|
|
409
|
+
* remote catalog service (see {@link sap.ushell_abap.pbServices.ui2.Factory#addRemoteCatalogService}). If the
|
|
410
|
+
* second step fails, the error handler is called with an error message and the new catalog
|
|
411
|
+
* instance (since 1.20). In this case the catalog is still a stub and does not know its CHIPs,
|
|
412
|
+
* but it knows more than just its ID and it can be updated!
|
|
413
|
+
*
|
|
414
|
+
* @param {object} oCatalogData
|
|
415
|
+
* the raw catalog representation for the page building service (<code>__metadata</code> not
|
|
416
|
+
* needed!), e.g.
|
|
417
|
+
* <pre>
|
|
418
|
+
* {
|
|
419
|
+
* baseUrl: "/sap/hba/apps/kpi/s/odata/hana_chip_catalog.xsodata/",
|
|
420
|
+
* domainId: "Z_REMOTE_HANA_CATALOG",
|
|
421
|
+
* remoteId: "HANA_CATALOG",
|
|
422
|
+
* systemAlias: "sanssouci",
|
|
423
|
+
* title: "Remote HANA catalog",
|
|
424
|
+
* type: "REMOTE"
|
|
425
|
+
* }
|
|
426
|
+
* </pre>
|
|
427
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.Catalog)} fnSuccess
|
|
428
|
+
* success handler for asynchronous creation
|
|
429
|
+
* @param {function (string, sap.ushell_abap.pbServices.ui2.Catalog=, object=)} fnFailure
|
|
430
|
+
* error handler, taking an error message, an optional {@link sap.ushell_abap.pbServices.ui2.Catalog}
|
|
431
|
+
* instance and, since version 1.28.6, an optional object containing the
|
|
432
|
+
* complete error information.<br />
|
|
433
|
+
* See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
434
|
+
* for more details about the complete error information parameter.
|
|
435
|
+
*
|
|
436
|
+
* @since 1.19.1
|
|
437
|
+
*/
|
|
438
|
+
this.createNewCatalog = function (oCatalogData, fnSuccess, fnFailure) {
|
|
439
|
+
this.getPageBuildingService().createCatalog(oCatalogData,
|
|
440
|
+
function (oRawCatalog) {
|
|
441
|
+
var oCatalog = that.createCatalog(oRawCatalog);
|
|
442
|
+
oCatalog.load(fnSuccess.bind(null, oCatalog), function (sErrorMessage, oErrorInformation) {
|
|
443
|
+
fnFailure(sErrorMessage, oCatalog, oErrorInformation);
|
|
444
|
+
});
|
|
445
|
+
}, function (sErrorMessage, oMaybeErrorInformation) { // consistent fnFailure
|
|
446
|
+
fnFailure(sErrorMessage, /* sap.ushell_abap.pbServices.ui2.Catalog */undefined, oMaybeErrorInformation);
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Creates a new catalog in the backend, based on a catalog page and using the given domain ID
|
|
452
|
+
* and title. The success handler is called as soon as the catalog has been created and the
|
|
453
|
+
* {@link sap.ushell_abap.pbServices.ui2.Catalog} is not a stub anymore. Access the new catalog in order to
|
|
454
|
+
* learn the resulting ID! Use {@link sap.ushell_abap.pbServices.ui2.Catalog#getCatalogPage} to access the
|
|
455
|
+
* corresponding catalog page which is initially a stub.
|
|
456
|
+
*
|
|
457
|
+
* @param {string} sDomainId
|
|
458
|
+
* the catalog's domain-specific ID
|
|
459
|
+
* @param {string} [sTitle]
|
|
460
|
+
* the catalog's title
|
|
461
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.Catalog)} fnSuccess
|
|
462
|
+
* success handler for asynchronous creation
|
|
463
|
+
* @param {function (string, object=)} [fnFailure]
|
|
464
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
465
|
+
* optional object containing the complete error information as delivered
|
|
466
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
467
|
+
* for more details.
|
|
468
|
+
* If not given
|
|
469
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
470
|
+
*
|
|
471
|
+
* @since 1.19.1
|
|
472
|
+
*/
|
|
473
|
+
this.createNewPageBasedCatalog = function (sDomainId, sTitle, fnSuccess, fnFailure) {
|
|
474
|
+
this.getPageBuildingService().createPageBasedCatalog(sDomainId, sTitle,
|
|
475
|
+
function (oRawCatalog) {
|
|
476
|
+
that.createCatalog(oRawCatalog, fnSuccess, fnFailure);
|
|
477
|
+
}, fnFailure);
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Creates a new page with the given ID and returns the stub. If a success
|
|
482
|
+
* handler is given, the page will be loaded automatically from the
|
|
483
|
+
* page building service, calling one of the given handlers.
|
|
484
|
+
*
|
|
485
|
+
* @param {string} sPageId
|
|
486
|
+
* the page ID
|
|
487
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.Page)} [fnSuccess]
|
|
488
|
+
* success handler for asynchronous loading
|
|
489
|
+
* @param {function (string, object=)} [fnFailure]
|
|
490
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
491
|
+
* optional object containing the complete error information as delivered
|
|
492
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
493
|
+
* for more details.
|
|
494
|
+
* If not given
|
|
495
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
496
|
+
* @param {boolean} [bPartially=false]
|
|
497
|
+
* whether to load the page only partially (instead of completely, including its CHIP
|
|
498
|
+
* instances)
|
|
499
|
+
*
|
|
500
|
+
* @returns {sap.ushell_abap.pbServices.ui2.Page}
|
|
501
|
+
* the newly created page, as a stub
|
|
502
|
+
* @since 1.2.0
|
|
503
|
+
*/
|
|
504
|
+
this.createPage = function (sPageId, fnSuccess, fnFailure, bPartially) {
|
|
505
|
+
var oPage;
|
|
506
|
+
oPage = new Page(this, sPageId);
|
|
507
|
+
if (fnSuccess) {
|
|
508
|
+
oPage.load(fnSuccess.bind(null, oPage), fnFailure, bPartially);
|
|
509
|
+
}
|
|
510
|
+
return oPage;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Creates a new page set with the given ID and returns the stub. If a success
|
|
515
|
+
* handler is given, the page set will be loaded automatically from the
|
|
516
|
+
* page building service, calling one of the given handlers.
|
|
517
|
+
*
|
|
518
|
+
* @param {string} sPageSetId
|
|
519
|
+
* the page set ID
|
|
520
|
+
* @param {function (sap.ushell_abap.pbServices.ui2.PageSet)} [fnSuccess]
|
|
521
|
+
* success handler for asynchronous loading
|
|
522
|
+
* @param {function (string, object=)} [fnFailure]
|
|
523
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
524
|
+
* optional object containing the complete error information as delivered
|
|
525
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
526
|
+
* for more details.
|
|
527
|
+
* If not given
|
|
528
|
+
* <code>{@link sap.ushell_abap.pbServices.ui2.ODataService#getDefaultErrorHandler}</code> is used
|
|
529
|
+
*
|
|
530
|
+
* @returns {sap.ushell_abap.pbServices.ui2.PageSet}
|
|
531
|
+
* the newly created page set, as a stub
|
|
532
|
+
* @since 1.11.0
|
|
533
|
+
*/
|
|
534
|
+
this.createPageSet = function (sPageSetId, fnSuccess, fnFailure) {
|
|
535
|
+
var oPageSet;
|
|
536
|
+
oPageSet = new PageSet(this, sPageSetId);
|
|
537
|
+
if (fnSuccess) {
|
|
538
|
+
oPageSet.load(fnSuccess.bind(null, oPageSet), fnFailure);
|
|
539
|
+
}
|
|
540
|
+
return oPageSet;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Removes the catalog from the factory internal cache.
|
|
545
|
+
*
|
|
546
|
+
* @param {sap.ui.srvc.Catalog} oCatalog
|
|
547
|
+
* catalog to be removed from cache
|
|
548
|
+
*
|
|
549
|
+
* @private
|
|
550
|
+
*/
|
|
551
|
+
this.forgetCatalog = function (oCatalog) {
|
|
552
|
+
delete mCatalogs[oCatalog.getId()];
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Returns this factory's page building service.
|
|
557
|
+
*
|
|
558
|
+
* @returns {sap.ushell_abap.pbServices.ui2.PageBuildingService}
|
|
559
|
+
* this factory's page building service
|
|
560
|
+
* @since 1.2.0
|
|
561
|
+
*/
|
|
562
|
+
this.getPageBuildingService = function () {
|
|
563
|
+
return oPbs;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Gets the remote catalog service that is able to deliver CHIPs for the given remote catalog.
|
|
568
|
+
*
|
|
569
|
+
* @param {object} oRawCatalog
|
|
570
|
+
* the JSON description of the remote catalog as delivered from
|
|
571
|
+
* {@link sap.ushell_abap.pbServices.ui2.PageBuildingService#readCatalog}.
|
|
572
|
+
* @returns {sap.ushell_abap.pbServices.ui2.RemoteCatalogService}
|
|
573
|
+
* the remote catalog service compatible to {@link sap.ushell_abap.pbServices.ui2.RemoteCatalogService} or
|
|
574
|
+
* <code>undefined</code> if no such service has been added via
|
|
575
|
+
* {@link #addRemoteCatalogService}
|
|
576
|
+
* @private
|
|
577
|
+
*/
|
|
578
|
+
this.getRemoteCatalogService = function (oRawCatalog) {
|
|
579
|
+
var sBaseUrl = oRawCatalog.type === "H"
|
|
580
|
+
? "/sap/hba/apps/kpi/s/odata/hana_chip_catalog.xsodata"
|
|
581
|
+
: oRawCatalog.baseUrl;
|
|
582
|
+
|
|
583
|
+
return sBaseUrl
|
|
584
|
+
? oRemoteCatalogServicesByBaseUrl.get(sBaseUrl.replace(/\/$/, "")) // ignore trailing '/'
|
|
585
|
+
: undefined;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Returns this factory's string representation.
|
|
590
|
+
*
|
|
591
|
+
* @param {boolean} [bVerbose=false]
|
|
592
|
+
* flag whether to show all properties
|
|
593
|
+
* @returns {string}
|
|
594
|
+
* this factory's string representation
|
|
595
|
+
* @since 1.2.0
|
|
596
|
+
*/
|
|
597
|
+
this.toString = function (bVerbose) {
|
|
598
|
+
var aResult = [
|
|
599
|
+
"Factory({oPbs:", oPbs.toString(bVerbose)
|
|
600
|
+
];
|
|
601
|
+
if (bVerbose) {
|
|
602
|
+
aResult.push(",mChips:", JSON.stringify(mChips));
|
|
603
|
+
}
|
|
604
|
+
aResult.push("})");
|
|
605
|
+
return aResult.join("");
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
// constructor code -------------------------------------------------------
|
|
609
|
+
oRemoteCatalogServicesByBaseUrl = new Utils.Map();
|
|
610
|
+
if (!oPbs) {
|
|
611
|
+
throw new SrvcError("Missing page building service", "Factory");
|
|
612
|
+
}
|
|
613
|
+
Log.debug("Created: " + this, null, "Factory");
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
// public factory function ***************************************************
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Constructs a new factory for wrapper objects corresponding to catalogs,
|
|
620
|
+
* pages, CHIP instances, or CHIPs loaded from the page building service with the given base URI.
|
|
621
|
+
*
|
|
622
|
+
* @param {string} sBaseUri
|
|
623
|
+
* base URI of the page building service
|
|
624
|
+
* @param {function (string, object=)} [fnDefaultFailure]
|
|
625
|
+
* error handler taking an error message and, since version 1.28.6, an
|
|
626
|
+
* optional object containing the complete error information as delivered
|
|
627
|
+
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
628
|
+
* for more details.
|
|
629
|
+
* @param {boolean} [bIsPersonalization=false]
|
|
630
|
+
* defines the return value of {@link sap.ushell_abap.pbServices.ui2.PageBuildingService#isPersonalization} of
|
|
631
|
+
* the returned factory's page building service facade (since 1.16.1)
|
|
632
|
+
* @returns {sap.ushell_abap.pbServices.ui2.Factory}
|
|
633
|
+
* returns the new factory for the given <code>sBaseUri</code>
|
|
634
|
+
* @since 1.2.0
|
|
635
|
+
*
|
|
636
|
+
* @see sap.ushell_abap.pbServices.ui2.Factory
|
|
637
|
+
* @see sap.ushell_abap.pbServices.ui2.PageBuildingService
|
|
638
|
+
* @see PageBuildingService.createPageBuildingService()
|
|
639
|
+
*/
|
|
640
|
+
Factory.createFactory = function (sBaseUri, fnDefaultFailure, bIsPersonalization) {
|
|
641
|
+
return new Factory(
|
|
642
|
+
PageBuildingService.createPageBuildingService(sBaseUri, fnDefaultFailure, bIsPersonalization)
|
|
643
|
+
);
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
return Factory;
|
|
647
|
+
}, true);
|