@openui5/sap.ui.core 1.96.2 → 1.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +2 -2
- package/.reuse/dep5 +1 -1
- package/THIRDPARTY.txt +2 -1
- package/package.json +1 -1
- package/src/jquery.sap.global.js +1 -1
- package/src/jquery.sap.properties.js +1 -1
- package/src/jquery.sap.resources.js +2 -2
- package/src/jquery.sap.script.js +1 -1
- package/src/jquery.sap.storage.js +3 -3
- package/src/sap/base/util/restricted/_CancelablePromise.js +1 -1
- package/src/sap/base/util/restricted/_castArray.js +1 -1
- package/src/sap/base/util/restricted/_compact.js +1 -1
- package/src/sap/base/util/restricted/_curry.js +1 -1
- package/src/sap/base/util/restricted/_debounce.js +1 -1
- package/src/sap/base/util/restricted/_difference.js +1 -1
- package/src/sap/base/util/restricted/_differenceBy.js +1 -1
- package/src/sap/base/util/restricted/_differenceWith.js +1 -1
- package/src/sap/base/util/restricted/_flatMap.js +1 -1
- package/src/sap/base/util/restricted/_flatMapDeep.js +1 -1
- package/src/sap/base/util/restricted/_flatMapDepth.js +1 -1
- package/src/sap/base/util/restricted/_flatten.js +1 -1
- package/src/sap/base/util/restricted/_flattenDeep.js +1 -1
- package/src/sap/base/util/restricted/_flattenDepth.js +1 -1
- package/src/sap/base/util/restricted/_intersection.js +1 -1
- package/src/sap/base/util/restricted/_intersectionBy.js +1 -1
- package/src/sap/base/util/restricted/_intersectionWith.js +1 -1
- package/src/sap/base/util/restricted/_isEqual.js +1 -1
- package/src/sap/base/util/restricted/_isEqualWith.js +1 -1
- package/src/sap/base/util/restricted/_isNil.js +1 -1
- package/src/sap/base/util/restricted/_max.js +1 -1
- package/src/sap/base/util/restricted/_merge.js +1 -1
- package/src/sap/base/util/restricted/_mergeWith.js +1 -1
- package/src/sap/base/util/restricted/_min.js +1 -1
- package/src/sap/base/util/restricted/_omit.js +1 -1
- package/src/sap/base/util/restricted/_pick.js +1 -1
- package/src/sap/base/util/restricted/_pickBy.js +1 -1
- package/src/sap/base/util/restricted/_throttle.js +1 -1
- package/src/sap/base/util/restricted/_toArray.js +1 -1
- package/src/sap/base/util/restricted/_union.js +1 -1
- package/src/sap/base/util/restricted/_unionBy.js +1 -1
- package/src/sap/base/util/restricted/_unionWith.js +1 -1
- package/src/sap/base/util/restricted/_uniq.js +1 -1
- package/src/sap/base/util/restricted/_uniqBy.js +1 -1
- package/src/sap/base/util/restricted/_uniqWith.js +1 -1
- package/src/sap/base/util/restricted/_without.js +1 -1
- package/src/sap/base/util/restricted/_xor.js +1 -1
- package/src/sap/base/util/restricted/_xorBy.js +1 -1
- package/src/sap/base/util/restricted/_xorWith.js +1 -1
- package/src/sap/base/util/restricted/_zipObject.js +1 -1
- package/src/sap/base/util/restricted/_zipObjectDeep.js +1 -1
- package/src/sap/ui/Device.js +4 -4
- package/src/sap/ui/Global.js +11 -16
- package/src/sap/ui/base/Event.js +1 -1
- package/src/sap/ui/base/EventProvider.js +1 -1
- package/src/sap/ui/base/Interface.js +1 -1
- package/src/sap/ui/base/ManagedObject.js +3 -3
- package/src/sap/ui/base/ManagedObjectMetadata.js +1 -1
- package/src/sap/ui/base/Metadata.js +1 -3
- package/src/sap/ui/base/Object.js +1 -1
- package/src/sap/ui/base/ObjectPool.js +1 -1
- package/src/sap/ui/core/.library +1 -27
- package/src/sap/ui/core/AppCacheBuster.js +4 -4
- package/src/sap/ui/core/BusyIndicator.js +1 -1
- package/src/sap/ui/core/Component.js +31 -9
- package/src/sap/ui/core/ComponentContainer.js +1 -1
- package/src/sap/ui/core/ComponentMetadata.js +1 -1
- package/src/sap/ui/core/ComponentSupport.js +1 -1
- package/src/sap/ui/core/Control.js +2 -2
- package/src/sap/ui/core/Core.js +2 -2
- package/src/sap/ui/core/CustomData.js +1 -1
- package/src/sap/ui/core/DeclarativeSupport.js +1 -1
- package/src/sap/ui/core/Element.js +2 -6
- package/src/sap/ui/core/ElementMetadata.js +1 -1
- package/src/sap/ui/core/EnabledPropagator.js +1 -1
- package/src/sap/ui/core/EventBus.js +1 -1
- package/src/sap/ui/core/Fragment.js +1 -1
- package/src/sap/ui/core/HTML.js +3 -3
- package/src/sap/ui/core/History.js +1 -1
- package/src/sap/ui/core/Icon.js +1 -1
- package/src/sap/ui/core/IndicationColorSupport.js +1 -1
- package/src/sap/ui/core/IntervalTrigger.js +1 -1
- package/src/sap/ui/core/InvisibleMessage.js +1 -1
- package/src/sap/ui/core/InvisibleRenderer.js +1 -1
- package/src/sap/ui/core/InvisibleText.js +1 -1
- package/src/sap/ui/core/Item.js +1 -1
- package/src/sap/ui/core/LabelEnablement.js +1 -1
- package/src/sap/ui/core/LayoutData.js +1 -1
- package/src/sap/ui/core/ListItem.js +1 -1
- package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
- package/src/sap/ui/core/Locale.js +1 -1
- package/src/sap/ui/core/LocaleData.js +3 -3
- package/src/sap/ui/core/Manifest.js +1 -1
- package/src/sap/ui/core/Message.js +1 -1
- package/src/sap/ui/core/RenderManager.js +3 -3
- package/src/sap/ui/core/Renderer.js +1 -1
- package/src/sap/ui/core/ResizeHandler.js +1 -1
- package/src/sap/ui/core/ScrollBar.js +4 -3
- package/src/sap/ui/core/SeparatorItem.js +1 -1
- package/src/sap/ui/core/ThemeCheck.js +2 -2
- package/src/sap/ui/core/Title.js +1 -1
- package/src/sap/ui/core/TooltipBase.js +1 -1
- package/src/sap/ui/core/UIArea.js +3 -3
- package/src/sap/ui/core/UIComponent.js +1 -1
- package/src/sap/ui/core/UIComponentMetadata.js +1 -1
- package/src/sap/ui/core/ValueStateSupport.js +1 -1
- package/src/sap/ui/core/VariantLayoutData.js +1 -1
- package/src/sap/ui/core/XMLComposite.js +1 -1
- package/src/sap/ui/core/XMLCompositeMetadata.js +1 -1
- package/src/sap/ui/core/XMLTemplateProcessor.js +19 -5
- package/src/sap/ui/core/cache/LRUPersistentCache.js +4 -2
- package/src/sap/ui/core/date/UniversalDateUtils.js +33 -0
- package/src/sap/ui/core/delegate/ItemNavigation.js +1 -1
- package/src/sap/ui/core/delegate/ScrollEnablement.js +1 -1
- package/src/sap/ui/core/dnd/DragDropBase.js +1 -1
- package/src/sap/ui/core/dnd/DragDropInfo.js +1 -1
- package/src/sap/ui/core/dnd/DragInfo.js +1 -1
- package/src/sap/ui/core/dnd/DropInfo.js +1 -1
- package/src/sap/ui/core/hyphenation/Hyphenation.js +1 -1
- package/src/sap/ui/core/library.js +5 -5
- package/src/sap/ui/core/message/ControlMessageProcessor.js +5 -5
- package/src/sap/ui/core/message/Message.js +1 -1
- package/src/sap/ui/core/message/MessageManager.js +1 -1
- package/src/sap/ui/core/message/MessageParser.js +1 -1
- package/src/sap/ui/core/message/MessageProcessor.js +22 -12
- package/src/sap/ui/core/messagebundle_fr.properties +7 -7
- package/src/sap/ui/core/messagebundle_ru.properties +21 -21
- package/src/sap/ui/core/mvc/Controller.js +4 -4
- package/src/sap/ui/core/mvc/HTMLView.js +1 -1
- package/src/sap/ui/core/mvc/JSONView.js +1 -1
- package/src/sap/ui/core/mvc/JSView.js +1 -1
- package/src/sap/ui/core/mvc/TemplateView.js +1 -1
- package/src/sap/ui/core/mvc/View.js +1 -1
- package/src/sap/ui/core/mvc/XMLView.js +1 -1
- package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
- package/src/sap/ui/core/plugin/LessSupport.js +1 -1
- package/src/sap/ui/core/plugin/TemplatingSupport.js +1 -1
- package/src/sap/ui/core/postmessage/Bus.js +1 -1
- package/src/sap/ui/core/postmessage/confirmationDialog.js +1 -1
- package/src/sap/ui/core/rules/Misc.support.js +51 -1
- package/src/sap/ui/core/rules/Rendering.support.js +1 -4
- package/src/sap/ui/core/rules/View.support.js +14 -46
- package/src/sap/ui/core/search/OpenSearchProvider.js +1 -1
- package/src/sap/ui/core/search/SearchProvider.js +1 -1
- package/src/sap/ui/core/service/Service.js +1 -1
- package/src/sap/ui/core/service/ServiceFactory.js +1 -1
- package/src/sap/ui/core/service/ServiceFactoryRegistry.js +1 -1
- package/src/sap/ui/core/support/Plugin.js +2 -2
- package/src/sap/ui/core/support/RuleEngineOpaExtension.js +0 -1
- package/src/sap/ui/core/support/Support.js +1 -1
- package/src/sap/ui/core/support/controls/TreeViewer.js +1 -1
- package/src/sap/ui/core/support/plugins/ControlTree.js +1 -1
- package/src/sap/ui/core/support/plugins/Interaction.js +1 -1
- package/src/sap/ui/core/support/plugins/LocalStorage.js +1 -1
- package/src/sap/ui/core/support/plugins/Performance.js +1 -2
- package/src/sap/ui/core/support/plugins/Selector.js +1 -1
- package/src/sap/ui/core/support/plugins/TechInfo.js +1 -1
- package/src/sap/ui/core/support/plugins/Trace.js +1 -1
- package/src/sap/ui/core/support/plugins/ViewInfo.js +1 -1
- package/src/sap/ui/core/support/techinfo/TechnicalInfo.js +1 -1
- package/src/sap/ui/core/support/trace/E2eTraceLib.js +3 -3
- package/src/sap/ui/core/tmpl/DOMAttribute.js +1 -1
- package/src/sap/ui/core/tmpl/DOMElement.js +1 -1
- package/src/sap/ui/core/tmpl/HandlebarsTemplate.js +1 -1
- package/src/sap/ui/core/tmpl/Template.js +1 -1
- package/src/sap/ui/core/tmpl/TemplateControl.js +1 -1
- package/src/sap/ui/core/util/AsyncHintsHelper.js +1 -1
- package/src/sap/ui/core/util/Export.js +1 -1
- package/src/sap/ui/core/util/ExportCell.js +1 -1
- package/src/sap/ui/core/util/ExportColumn.js +1 -1
- package/src/sap/ui/core/util/ExportRow.js +1 -1
- package/src/sap/ui/core/util/ExportType.js +1 -1
- package/src/sap/ui/core/util/ExportTypeCSV.js +1 -1
- package/src/sap/ui/core/util/File.js +1 -1
- package/src/sap/ui/core/util/LibraryInfo.js +1 -1
- package/src/sap/ui/core/util/MockServer.js +2 -2
- package/src/sap/ui/core/util/PasteHelper.js +1 -1
- package/src/sap/ui/core/util/reflection/JsControlTreeModifier.js +4 -4
- package/src/sap/ui/core/util/serializer/HTMLViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/Serializer.js +1 -1
- package/src/sap/ui/core/util/serializer/ViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/XMLViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/Delegate.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/HTML.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/XML.js +1 -1
- package/src/sap/ui/core/ws/ReadyState.js +1 -1
- package/src/sap/ui/core/ws/SapPcpWebSocket.js +1 -1
- package/src/sap/ui/core/ws/WebSocket.js +1 -1
- package/src/sap/ui/debug/ControlTree.js +1 -1
- package/src/sap/ui/debug/DebugEnv.js +1 -1
- package/src/sap/ui/debug/PropertyList.js +1 -1
- package/src/sap/ui/model/ChangeReason.js +1 -1
- package/src/sap/ui/model/ClientListBinding.js +7 -0
- package/src/sap/ui/model/ClientModel.js +6 -5
- package/src/sap/ui/model/ClientTreeBindingAdapter.js +1 -1
- package/src/sap/ui/model/CompositeDataState.js +1 -1
- package/src/sap/ui/model/CompositeType.js +1 -1
- package/src/sap/ui/model/DataState.js +1 -1
- package/src/sap/ui/model/ListBinding.js +24 -5
- package/src/sap/ui/model/MetaModel.js +1 -1
- package/src/sap/ui/model/Model.js +5 -10
- package/src/sap/ui/model/SelectionModel.js +1 -1
- package/src/sap/ui/model/SimpleType.js +1 -1
- package/src/sap/ui/model/TreeAutoExpandMode.js +1 -1
- package/src/sap/ui/model/TreeBindingAdapter.js +0 -2
- package/src/sap/ui/model/TreeBindingUtils.js +2 -0
- package/src/sap/ui/model/Type.js +1 -1
- package/src/sap/ui/model/analytics/AnalyticalBinding.js +12 -6
- package/src/sap/ui/model/analytics/AnalyticalTreeBindingAdapter.js +16 -18
- package/src/sap/ui/model/json/JSONModel.js +7 -7
- package/src/sap/ui/model/json/JSONPropertyBinding.js +1 -1
- package/src/sap/ui/model/message/MessageModel.js +3 -3
- package/src/sap/ui/model/message/MessagePropertyBinding.js +1 -1
- package/src/sap/ui/model/odata/AnnotationHelper.js +2 -2
- package/src/sap/ui/model/odata/AnnotationParser.js +4 -2
- package/src/sap/ui/model/odata/ODataAnnotations.js +1 -1
- package/src/sap/ui/model/odata/ODataListBinding.js +61 -38
- package/src/sap/ui/model/odata/ODataMessageParser.js +2 -2
- package/src/sap/ui/model/odata/ODataMetaModel.js +3 -3
- package/src/sap/ui/model/odata/ODataMetadata.js +136 -85
- package/src/sap/ui/model/odata/ODataModel.js +442 -215
- package/src/sap/ui/model/odata/ODataPropertyBinding.js +7 -5
- package/src/sap/ui/model/odata/ODataTreeBindingAdapter.js +27 -17
- package/src/sap/ui/model/odata/ODataTreeBindingFlat.js +440 -260
- package/src/sap/ui/model/odata/ODataUtils.js +24 -9
- package/src/sap/ui/model/odata/_AnnotationHelperBasics.js +2 -1
- package/src/sap/ui/model/odata/_AnnotationHelperExpression.js +10 -8
- package/src/sap/ui/model/odata/_ODataMetaModelUtils.js +6 -4
- package/src/sap/ui/model/odata/type/Boolean.js +1 -1
- package/src/sap/ui/model/odata/type/Byte.js +1 -1
- package/src/sap/ui/model/odata/type/Currency.js +1 -1
- package/src/sap/ui/model/odata/type/Date.js +1 -1
- package/src/sap/ui/model/odata/type/DateTime.js +1 -1
- package/src/sap/ui/model/odata/type/DateTimeBase.js +1 -1
- package/src/sap/ui/model/odata/type/DateTimeOffset.js +1 -1
- package/src/sap/ui/model/odata/type/Decimal.js +5 -1
- package/src/sap/ui/model/odata/type/Double.js +1 -1
- package/src/sap/ui/model/odata/type/Guid.js +1 -1
- package/src/sap/ui/model/odata/type/Int.js +1 -1
- package/src/sap/ui/model/odata/type/Int16.js +1 -1
- package/src/sap/ui/model/odata/type/Int32.js +1 -1
- package/src/sap/ui/model/odata/type/Int64.js +1 -1
- package/src/sap/ui/model/odata/type/ODataType.js +1 -1
- package/src/sap/ui/model/odata/type/Raw.js +1 -1
- package/src/sap/ui/model/odata/type/SByte.js +1 -1
- package/src/sap/ui/model/odata/type/Single.js +1 -1
- package/src/sap/ui/model/odata/type/Stream.js +1 -1
- package/src/sap/ui/model/odata/type/String.js +1 -1
- package/src/sap/ui/model/odata/type/Time.js +1 -1
- package/src/sap/ui/model/odata/type/TimeOfDay.js +1 -1
- package/src/sap/ui/model/odata/type/Unit.js +1 -1
- package/src/sap/ui/model/odata/type/UnitMixin.js +0 -1
- package/src/sap/ui/model/odata/v2/Context.js +42 -11
- package/src/sap/ui/model/odata/v2/ODataAnnotations.js +1 -1
- package/src/sap/ui/model/odata/v2/ODataListBinding.js +205 -88
- package/src/sap/ui/model/odata/v2/ODataModel.js +154 -89
- package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +162 -89
- package/src/sap/ui/model/odata/v2/_CreatedContextsCache.js +52 -2
- package/src/sap/ui/model/odata/v4/Context.js +48 -7
- package/src/sap/ui/model/odata/v4/ODataBinding.js +55 -24
- package/src/sap/ui/model/odata/v4/ODataContextBinding.js +67 -19
- package/src/sap/ui/model/odata/v4/ODataListBinding.js +211 -78
- package/src/sap/ui/model/odata/v4/ODataMetaModel.js +1 -1
- package/src/sap/ui/model/odata/v4/ODataModel.js +2 -1
- package/src/sap/ui/model/odata/v4/ODataParentBinding.js +36 -23
- package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +3 -3
- package/src/sap/ui/model/odata/v4/lib/_Cache.js +106 -11
- package/src/sap/ui/model/odata/v4/lib/_Helper.js +33 -3
- package/src/sap/ui/model/odata/v4/lib/_Requestor.js +11 -2
- package/src/sap/ui/model/resource/ResourceModel.js +1 -1
- package/src/sap/ui/model/type/Boolean.js +1 -1
- package/src/sap/ui/model/type/Currency.js +1 -1
- package/src/sap/ui/model/type/Date.js +1 -1
- package/src/sap/ui/model/type/DateInterval.js +1 -1
- package/src/sap/ui/model/type/DateTime.js +1 -1
- package/src/sap/ui/model/type/DateTimeInterval.js +1 -1
- package/src/sap/ui/model/type/FileSize.js +1 -1
- package/src/sap/ui/model/type/Float.js +1 -1
- package/src/sap/ui/model/type/Integer.js +1 -1
- package/src/sap/ui/model/type/String.js +1 -1
- package/src/sap/ui/model/type/Time.js +1 -1
- package/src/sap/ui/model/type/TimeInterval.js +1 -1
- package/src/sap/ui/model/type/Unit.js +1 -1
- package/src/sap/ui/model/xml/XMLModel.js +5 -5
- package/src/sap/ui/model/xml/XMLPropertyBinding.js +1 -1
- package/src/sap/ui/qunit/utils/ControlIterator.js +1 -1
- package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +1 -1
- package/src/sap/ui/test/actions/Action.js +9 -2
- package/src/sap/ui/test/actions/Press.js +28 -1
- package/src/sap/ui/test/generic/_EnforceSemanticRendering.js +111 -0
- package/src/sap/ui/util/Mobile.js +28 -39
- package/src/sap/ui/util/Storage.js +1 -1
- package/src/ui5loader.js +6 -6
- package/ui5.yaml +244 -1
- package/src/sap/ui/core/CustomizingConfiguration.js +0 -47
- package/src/sap/ui/thirdparty/baseuri.js +0 -1
- package/src/sap/ui/thirdparty/es6-object-assign.js +0 -1
- package/src/sap/ui/thirdparty/es6-promise.js +0 -1
- package/src/sap/ui/thirdparty/es6-shim-nopromise.js +0 -1
- package/src/sap/ui/thirdparty/es6-string-methods.js +0 -1
- package/src/sap/ui/thirdparty/flexie.js +0 -1
- package/src/sap/ui/thirdparty/unorm.js +0 -1
- package/src/sap/ui/thirdparty/unormdata.js +0 -1
|
@@ -76,7 +76,7 @@ sap.ui.define([
|
|
|
76
76
|
*
|
|
77
77
|
*
|
|
78
78
|
* @author SAP SE
|
|
79
|
-
* @version 1.
|
|
79
|
+
* @version 1.97.0
|
|
80
80
|
*
|
|
81
81
|
* @public
|
|
82
82
|
* @deprecated As of version 1.48, please use {@link sap.ui.model.odata.v2.ODataModel} instead.
|
|
@@ -135,7 +135,7 @@ sap.ui.define([
|
|
|
135
135
|
this.aPendingRequestHandles = [];
|
|
136
136
|
this.oRequestQueue = {};
|
|
137
137
|
this.aBatchOperations = [];
|
|
138
|
-
this.oHandler;
|
|
138
|
+
this.oHandler = undefined;
|
|
139
139
|
this.bTokenHandling = bTokenHandling !== false;
|
|
140
140
|
this.bWithCredentials = bWithCredentials === true;
|
|
141
141
|
this.bUseBatch = bUseBatch === true;
|
|
@@ -350,6 +350,10 @@ sap.ui.define([
|
|
|
350
350
|
};
|
|
351
351
|
|
|
352
352
|
/**
|
|
353
|
+
* Fires the "metadataLoaded" event if the metadata and the annotations are loaded.
|
|
354
|
+
*
|
|
355
|
+
* @param {boolean} bDelayEvent
|
|
356
|
+
* Whether the <code>fireMetadataLoaded</code>-event should be fired with a delay
|
|
353
357
|
* @private
|
|
354
358
|
*/
|
|
355
359
|
ODataModel.prototype._initializeMetadata = function(bDelayEvent) {
|
|
@@ -358,11 +362,9 @@ sap.ui.define([
|
|
|
358
362
|
var doFire = function(bDelay){
|
|
359
363
|
if (bDelay) {
|
|
360
364
|
that.metadataLoadEvent = setTimeout(doFire.bind(that), 0);
|
|
361
|
-
} else {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
Log.debug("ODataModel fired metadataloaded");
|
|
365
|
-
}
|
|
365
|
+
} else if (that.oMetadata) {
|
|
366
|
+
that.fireMetadataLoaded({metadata: that.oMetadata});
|
|
367
|
+
Log.debug("ODataModel fired metadataloaded");
|
|
366
368
|
}
|
|
367
369
|
};
|
|
368
370
|
|
|
@@ -657,7 +659,15 @@ sap.ui.define([
|
|
|
657
659
|
};
|
|
658
660
|
|
|
659
661
|
/**
|
|
660
|
-
*
|
|
662
|
+
* Creates a request URL using the supplied parameters.
|
|
663
|
+
*
|
|
664
|
+
* @param {string} sPath The path to the property
|
|
665
|
+
* @param {sap.ui.model.Context} oContext The context of the property
|
|
666
|
+
* @param {object} oUrlParams Additional query parameters
|
|
667
|
+
* @param {boolean} bBatch Whether a batch request should be sent
|
|
668
|
+
* @param {boolean} [bCache=true] Force no caching if false
|
|
669
|
+
*
|
|
670
|
+
* @returns {string} The created URL
|
|
661
671
|
* @private
|
|
662
672
|
*/
|
|
663
673
|
ODataModel.prototype._createRequestUrl = function(sPath, oContext, oUrlParams, bBatch, bCache) {
|
|
@@ -709,29 +719,36 @@ sap.ui.define([
|
|
|
709
719
|
};
|
|
710
720
|
|
|
711
721
|
/**
|
|
712
|
-
* Does a request using the service URL and configuration parameters
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
* @param {string}
|
|
717
|
-
* sPath A string containing the path to the data which should
|
|
718
|
-
* be retrieved. The path is appended to the <code>sServiceUrl</code>
|
|
719
|
-
* which was specified in the model constructor.
|
|
720
|
-
* @param {function}
|
|
721
|
-
* [fnSuccess] Callback function which is called when the data has
|
|
722
|
-
* been successfully retrieved and stored in the model
|
|
723
|
-
* @param {function}
|
|
724
|
-
* [fnError] Callback function which is called when the request failed
|
|
722
|
+
* Does a request using the service URL and configuration parameters provided in the model's
|
|
723
|
+
* constructor and sets the response data into the model. This request is performed
|
|
724
|
+
* asynchronously.
|
|
725
725
|
*
|
|
726
|
-
* @param {
|
|
726
|
+
* @param {string} sPath
|
|
727
|
+
* A string containing the path to the data which should be retrieved; the path is appended
|
|
728
|
+
* to the <code>sServiceUrl</code> which was specified in the model constructor
|
|
729
|
+
* @param {string[]} aParams
|
|
730
|
+
* Additional query parameters
|
|
731
|
+
* @param {function} [fnSuccess]
|
|
732
|
+
* Callback function which is called when the data has been successfully retrieved and stored
|
|
733
|
+
* in the model
|
|
734
|
+
* @param {function} [fnError]
|
|
735
|
+
* Callback function which is called when the request failed
|
|
736
|
+
* @param {boolean} [bCache=true]
|
|
737
|
+
* Force no caching if false
|
|
738
|
+
* @param {function} [fnHandleUpdate]
|
|
739
|
+
* Function to handle an update with
|
|
740
|
+
* @param {function} [fnCompleted]
|
|
741
|
+
* Function to call after the request is completed; called after <code>fnSuccess</code>
|
|
727
742
|
*
|
|
728
743
|
* @private
|
|
729
744
|
*/
|
|
730
|
-
ODataModel.prototype._loadData = function(sPath, aParams, fnSuccess, fnError, bCache,
|
|
731
|
-
|
|
745
|
+
ODataModel.prototype._loadData = function(sPath, aParams, fnSuccess, fnError, bCache,
|
|
746
|
+
fnHandleUpdate, fnCompleted){
|
|
732
747
|
// create a request object for the data request
|
|
733
748
|
var oRequestHandle,
|
|
734
|
-
|
|
749
|
+
aResults = [],
|
|
750
|
+
sUrl = this._createRequestUrl(sPath, null, aParams, null, bCache || this.bCache),
|
|
751
|
+
oRequest = this._createRequest(sUrl, "GET", true),
|
|
735
752
|
that = this;
|
|
736
753
|
|
|
737
754
|
function _handleSuccess(oData, oResponse) {
|
|
@@ -749,7 +766,8 @@ sap.ui.define([
|
|
|
749
766
|
}
|
|
750
767
|
that.fireRequestCompleted({url : oRequest.requestUri, type : "GET", async : oRequest.async,
|
|
751
768
|
info: "Accept headers:" + that.oHeaders["Accept"], infoObject : {acceptHeaders: that.oHeaders["Accept"]}, success: true});
|
|
752
|
-
|
|
769
|
+
|
|
770
|
+
return undefined;
|
|
753
771
|
}
|
|
754
772
|
|
|
755
773
|
// no data available
|
|
@@ -825,6 +843,8 @@ sap.ui.define([
|
|
|
825
843
|
that.fireRequestCompleted({url : oRequest.requestUri, type : "GET", async : oRequest.async,
|
|
826
844
|
info: "Accept headers:" + that.oHeaders["Accept"], infoObject : {acceptHeaders: that.oHeaders["Accept"]}, success: true});
|
|
827
845
|
}
|
|
846
|
+
|
|
847
|
+
return undefined;
|
|
828
848
|
}
|
|
829
849
|
|
|
830
850
|
function _handleError(oError) {
|
|
@@ -894,10 +914,6 @@ sap.ui.define([
|
|
|
894
914
|
}
|
|
895
915
|
}
|
|
896
916
|
|
|
897
|
-
// execute request
|
|
898
|
-
var aResults = [];
|
|
899
|
-
var sUrl = this._createRequestUrl(sPath, null, aParams, null, bCache || this.bCache);
|
|
900
|
-
oRequest = this._createRequest(sUrl, "GET", true);
|
|
901
917
|
// Make sure requests not requiring a CSRF token don't send one.
|
|
902
918
|
if (that.bTokenHandling) {
|
|
903
919
|
delete oRequest.headers["x-csrf-token"];
|
|
@@ -908,9 +924,18 @@ sap.ui.define([
|
|
|
908
924
|
};
|
|
909
925
|
|
|
910
926
|
/**
|
|
911
|
-
* Imports the data to the internal storage.
|
|
912
|
-
*
|
|
913
|
-
*
|
|
927
|
+
* Imports the data to the internal storage. Nested entries are processed recursively, moved to
|
|
928
|
+
* the canonic location and referenced from the parent entry. Keys are collected in a map for
|
|
929
|
+
* updating bindings.
|
|
930
|
+
*
|
|
931
|
+
* @param {object} oData
|
|
932
|
+
* The data
|
|
933
|
+
* @param {Object<string,boolean>} mKeys
|
|
934
|
+
* Keys used to update affected bindings
|
|
935
|
+
*
|
|
936
|
+
* @returns {string[]|string}
|
|
937
|
+
* Returns an array of keys if the data has nested data or a single key if it doesn't have
|
|
938
|
+
* nested data
|
|
914
939
|
*/
|
|
915
940
|
ODataModel.prototype._importData = function(oData, mKeys) {
|
|
916
941
|
var that = this,
|
|
@@ -946,7 +971,11 @@ sap.ui.define([
|
|
|
946
971
|
};
|
|
947
972
|
|
|
948
973
|
/**
|
|
949
|
-
* Remove references of navigation properties created in importData function
|
|
974
|
+
* Remove references of navigation properties created in <code>importData</code> function.
|
|
975
|
+
*
|
|
976
|
+
* @param {object} oData Data imported in <code>importData</code>
|
|
977
|
+
*
|
|
978
|
+
* @returns {object|object[]} The data with references of navigation properties removed
|
|
950
979
|
*/
|
|
951
980
|
ODataModel.prototype._removeReferences = function(oData){
|
|
952
981
|
var that = this, aList;
|
|
@@ -969,7 +998,11 @@ sap.ui.define([
|
|
|
969
998
|
};
|
|
970
999
|
|
|
971
1000
|
/**
|
|
972
|
-
* Restore
|
|
1001
|
+
* Restore references of navigation properties created in <code>importData</code> function.
|
|
1002
|
+
*
|
|
1003
|
+
* @param {object} oData Data imported in <code>importData</code>
|
|
1004
|
+
*
|
|
1005
|
+
* @returns {object|object[]} The data with references of navigation properties restored
|
|
973
1006
|
*/
|
|
974
1007
|
ODataModel.prototype._restoreReferences = function(oData){
|
|
975
1008
|
var that = this,
|
|
@@ -1061,12 +1094,17 @@ sap.ui.define([
|
|
|
1061
1094
|
|
|
1062
1095
|
|
|
1063
1096
|
/**
|
|
1064
|
-
* Private method iterating the registered bindings of this model instance and initiating their
|
|
1097
|
+
* Private method iterating the registered bindings of this model instance and initiating their
|
|
1098
|
+
* check for an update.
|
|
1065
1099
|
*
|
|
1066
1100
|
* @param {boolean} bForceUpdate
|
|
1101
|
+
* Whether change events is fired regardless of the bindings state
|
|
1067
1102
|
* @param {boolean} bAsync
|
|
1103
|
+
* Whether the check is done asynchronously
|
|
1068
1104
|
* @param {object} mChangedEntities
|
|
1069
|
-
*
|
|
1105
|
+
* A map of changed entities
|
|
1106
|
+
* @param {boolean} bMetaModelOnly
|
|
1107
|
+
* Whether only metamodel bindings are updated
|
|
1070
1108
|
*
|
|
1071
1109
|
* @private
|
|
1072
1110
|
*/
|
|
@@ -1091,7 +1129,7 @@ sap.ui.define([
|
|
|
1091
1129
|
}.bind(this));
|
|
1092
1130
|
};
|
|
1093
1131
|
|
|
1094
|
-
|
|
1132
|
+
/*
|
|
1095
1133
|
* @see sap.ui.model.Model.prototype.bindProperty
|
|
1096
1134
|
*/
|
|
1097
1135
|
ODataModel.prototype.bindProperty = function(sPath, oContext, mParameters) {
|
|
@@ -1102,17 +1140,31 @@ sap.ui.define([
|
|
|
1102
1140
|
/**
|
|
1103
1141
|
* Creates a new list binding for this model.
|
|
1104
1142
|
*
|
|
1105
|
-
* @param {string} sPath
|
|
1106
|
-
*
|
|
1107
|
-
* @param {sap.ui.model.
|
|
1108
|
-
*
|
|
1109
|
-
* @param {
|
|
1110
|
-
*
|
|
1111
|
-
* @param {
|
|
1112
|
-
*
|
|
1113
|
-
* @param {
|
|
1114
|
-
*
|
|
1115
|
-
* @
|
|
1143
|
+
* @param {string} sPath
|
|
1144
|
+
* Binding path, either absolute or relative to a given <code>oContext</code>
|
|
1145
|
+
* @param {sap.ui.model.Context} [oContext]
|
|
1146
|
+
* Binding context referring to this model
|
|
1147
|
+
* @param {sap.ui.model.Sorter|sap.ui.model.Sorter[]} [aSorters]
|
|
1148
|
+
* Initial sort order, can be either a sorter or an array of sorters
|
|
1149
|
+
* @param {sap.ui.model.Filter|sap.ui.model.Filter[]} [aFilters]
|
|
1150
|
+
* Predefined filter/s, can be either a filter or an array of filters
|
|
1151
|
+
* @param {object} [mParameters]
|
|
1152
|
+
* Map which contains additional parameters for the binding
|
|
1153
|
+
* @param {string} [mParameters.expand]
|
|
1154
|
+
* Value for the OData <code>$expand</code> query parameter which should be included in the
|
|
1155
|
+
* request
|
|
1156
|
+
* @param {string} [mParameters.select]
|
|
1157
|
+
* Value for the OData <code>$select</code> query parameter which should be included in the
|
|
1158
|
+
* request
|
|
1159
|
+
* @param {Object<string,string>} [mParameters.custom]
|
|
1160
|
+
* Optional map of custom query parameters (name/value pairs); names of custom parameters must
|
|
1161
|
+
* not start with <code>$</code>
|
|
1162
|
+
* @param {sap.ui.model.odata.CountMode} [mParameters.countMode]
|
|
1163
|
+
* Defines the count mode of the new binding; if not specified, the default count mode of this
|
|
1164
|
+
* model will be applied
|
|
1165
|
+
*
|
|
1166
|
+
* @returns {sap.ui.model.ListBinding} A new list binding object
|
|
1167
|
+
*
|
|
1116
1168
|
* @see sap.ui.model.Model.prototype.bindList
|
|
1117
1169
|
* @public
|
|
1118
1170
|
*/
|
|
@@ -1121,7 +1173,7 @@ sap.ui.define([
|
|
|
1121
1173
|
return oBinding;
|
|
1122
1174
|
};
|
|
1123
1175
|
|
|
1124
|
-
|
|
1176
|
+
/*
|
|
1125
1177
|
* @see sap.ui.model.Model.prototype.bindTree
|
|
1126
1178
|
*/
|
|
1127
1179
|
ODataModel.prototype.bindTree = function(sPath, oContext, aFilters, mParameters) {
|
|
@@ -1129,7 +1181,7 @@ sap.ui.define([
|
|
|
1129
1181
|
return oBinding;
|
|
1130
1182
|
};
|
|
1131
1183
|
|
|
1132
|
-
|
|
1184
|
+
/*
|
|
1133
1185
|
* Creates a binding context for the given path
|
|
1134
1186
|
* If the data of the context is not yet available, it can not be created, but first the
|
|
1135
1187
|
* entity needs to be fetched from the server asynchronously. In case no callback function
|
|
@@ -1137,9 +1189,11 @@ sap.ui.define([
|
|
|
1137
1189
|
*
|
|
1138
1190
|
* @see sap.ui.model.Model.prototype.createBindingContext
|
|
1139
1191
|
*/
|
|
1140
|
-
ODataModel.prototype.createBindingContext =
|
|
1141
|
-
|
|
1142
|
-
|
|
1192
|
+
ODataModel.prototype.createBindingContext =
|
|
1193
|
+
function(sPath, oContext, mParameters, fnCallBack, bReload) {
|
|
1194
|
+
var sFullPath = this.resolve(sPath, oContext);
|
|
1195
|
+
bReload = !!bReload;
|
|
1196
|
+
|
|
1143
1197
|
// optional parameter handling
|
|
1144
1198
|
if (typeof oContext == "function") {
|
|
1145
1199
|
fnCallBack = oContext;
|
|
@@ -1206,15 +1260,24 @@ sap.ui.define([
|
|
|
1206
1260
|
fnCallBack(null); // error - notify to recreate contexts
|
|
1207
1261
|
}
|
|
1208
1262
|
}
|
|
1263
|
+
|
|
1264
|
+
return undefined;
|
|
1209
1265
|
};
|
|
1210
1266
|
|
|
1211
1267
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
* In case it couldn't be found we should reload the data so we return true.
|
|
1268
|
+
* Checks if data based on <code>select</code>, <code>expand</code> parameters is already loaded
|
|
1269
|
+
* or not. In case it couldn't be found we should reload the data so we return true.
|
|
1270
|
+
*
|
|
1271
|
+
* @param {string} sFullPath The path to the data
|
|
1272
|
+
* @param {object} oData The data to check for completeness
|
|
1273
|
+
* @param {object} [mParameters] Value of <code>select</code> and/or <code>expand</code>
|
|
1274
|
+
*
|
|
1275
|
+
* @returns {boolean} Whether a reload is needed
|
|
1214
1276
|
*/
|
|
1215
1277
|
ODataModel.prototype._isReloadNeeded = function(sFullPath, oData, mParameters) {
|
|
1216
|
-
var sNavProps,
|
|
1217
|
-
|
|
1278
|
+
var oDataObject, i, sNavProps, sPropKey, bReloadNeeded, sSelectProps,
|
|
1279
|
+
aNavProps = [],
|
|
1280
|
+
aSelectProps = [];
|
|
1218
1281
|
|
|
1219
1282
|
// no valid path --> no reload
|
|
1220
1283
|
if (!sFullPath) {
|
|
@@ -1235,7 +1298,7 @@ sap.ui.define([
|
|
|
1235
1298
|
//Split the Navigation properties again, if there are multi-level properties chained together by "/"
|
|
1236
1299
|
//The resulting aNavProps array will look like this: ["a", ["b", "c/d/e"], ["f", "g/h"], "i"]
|
|
1237
1300
|
if (aNavProps) {
|
|
1238
|
-
for (
|
|
1301
|
+
for (i = 0; i < aNavProps.length; i++) {
|
|
1239
1302
|
var chainedPropIndex = aNavProps[i].indexOf("/");
|
|
1240
1303
|
if (chainedPropIndex !== -1) {
|
|
1241
1304
|
//cut of the first nav property of the chain
|
|
@@ -1248,10 +1311,11 @@ sap.ui.define([
|
|
|
1248
1311
|
}
|
|
1249
1312
|
|
|
1250
1313
|
//Iterate all nav props and follow the given expand-chain
|
|
1251
|
-
for (
|
|
1314
|
+
for (i = 0; i < aNavProps.length; i++) {
|
|
1252
1315
|
var navProp = aNavProps[i];
|
|
1253
1316
|
|
|
1254
|
-
//check if the navProp was split into multiple parts (meaning it's an array)
|
|
1317
|
+
//check if the navProp was split into multiple parts (meaning it's an array)
|
|
1318
|
+
//e.g. ["Orders", "Products/Suppliers"]
|
|
1255
1319
|
if (Array.isArray(navProp)) {
|
|
1256
1320
|
|
|
1257
1321
|
var oFirstNavProp = oData[navProp[0]];
|
|
@@ -1260,40 +1324,38 @@ sap.ui.define([
|
|
|
1260
1324
|
//first nav prop in the chain is either undefined or deferred -> reload needed
|
|
1261
1325
|
if (!oFirstNavProp || (oFirstNavProp && oFirstNavProp.__deferred)) {
|
|
1262
1326
|
return true;
|
|
1263
|
-
} else {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
//
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
var bReloadNeeded = this._isReloadNeeded(sPropKey, oDataObject, {expand: sNavPropRest});
|
|
1275
|
-
if (bReloadNeeded) { //if a single nav-prop path is not loaded -> reload needed
|
|
1276
|
-
return true;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
} else if (oFirstNavProp.__ref) {
|
|
1280
|
-
//the first nav-prop is not a __list, but only a reference to a single entry (__ref)
|
|
1281
|
-
var sPropKey = "/" + oFirstNavProp.__ref;
|
|
1282
|
-
var oDataObject = this.getObject(sPropKey);
|
|
1283
|
-
var bReloadNeeded = this._isReloadNeeded(sPropKey, oDataObject, {expand: sNavPropRest});
|
|
1327
|
+
} else if (oFirstNavProp) {
|
|
1328
|
+
if (oFirstNavProp.__list && oFirstNavProp.__list.length > 0) {
|
|
1329
|
+
//Follow all keys in the __list collection by recursively calling
|
|
1330
|
+
//this function to check if all linked properties are loaded.
|
|
1331
|
+
//This is basically a depth-first search.
|
|
1332
|
+
for (var iNavIndex = 0; iNavIndex < oFirstNavProp.__list.length;
|
|
1333
|
+
iNavIndex++) {
|
|
1334
|
+
sPropKey = "/" + oFirstNavProp.__list[iNavIndex];
|
|
1335
|
+
oDataObject = this.getObject(sPropKey);
|
|
1336
|
+
bReloadNeeded =
|
|
1337
|
+
this._isReloadNeeded(sPropKey, oDataObject, {expand: sNavPropRest});
|
|
1284
1338
|
if (bReloadNeeded) {
|
|
1339
|
+
//if a single nav-prop path is not loaded -> reload needed
|
|
1285
1340
|
return true;
|
|
1286
1341
|
}
|
|
1287
1342
|
}
|
|
1343
|
+
} else if (oFirstNavProp.__ref) {
|
|
1344
|
+
//the first nav-prop is not a __list
|
|
1345
|
+
//but only a reference to a single entry (__ref)
|
|
1346
|
+
sPropKey = "/" + oFirstNavProp.__ref;
|
|
1347
|
+
oDataObject = this.getObject(sPropKey);
|
|
1348
|
+
bReloadNeeded =
|
|
1349
|
+
this._isReloadNeeded(sPropKey, oDataObject, {expand: sNavPropRest});
|
|
1350
|
+
if (bReloadNeeded) {
|
|
1351
|
+
return true;
|
|
1352
|
+
}
|
|
1288
1353
|
}
|
|
1289
1354
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1355
|
+
} else if (oData[navProp] === undefined
|
|
1356
|
+
|| (oData[navProp] && oData[navProp].__deferred)) {
|
|
1292
1357
|
//only one single Part, e.g. "Orders"
|
|
1293
|
-
|
|
1294
|
-
if (oData[navProp] === undefined || (oData[navProp] && oData[navProp].__deferred)) {
|
|
1295
|
-
return true;
|
|
1296
|
-
}
|
|
1358
|
+
return true;
|
|
1297
1359
|
}
|
|
1298
1360
|
}
|
|
1299
1361
|
|
|
@@ -1302,7 +1364,7 @@ sap.ui.define([
|
|
|
1302
1364
|
aSelectProps = sSelectProps.split(',');
|
|
1303
1365
|
}
|
|
1304
1366
|
|
|
1305
|
-
for (
|
|
1367
|
+
for (i = 0; i < aSelectProps.length; i++) {
|
|
1306
1368
|
// reload data if select property not available
|
|
1307
1369
|
if (oData[aSelectProps[i]] === undefined) {
|
|
1308
1370
|
return true;
|
|
@@ -1317,7 +1379,7 @@ sap.ui.define([
|
|
|
1317
1379
|
// if no entity type could be found we decide not to reload
|
|
1318
1380
|
return false;
|
|
1319
1381
|
} else {
|
|
1320
|
-
for (
|
|
1382
|
+
for (i = 0; i < oEntityType.property.length; i++) {
|
|
1321
1383
|
if (oData[oEntityType.property[i].name] === undefined) {
|
|
1322
1384
|
return true;
|
|
1323
1385
|
}
|
|
@@ -1327,30 +1389,36 @@ sap.ui.define([
|
|
|
1327
1389
|
return false;
|
|
1328
1390
|
};
|
|
1329
1391
|
|
|
1330
|
-
|
|
1392
|
+
/*
|
|
1331
1393
|
* @see sap.ui.model.Model.prototype.destroyBindingContext
|
|
1332
1394
|
*/
|
|
1333
1395
|
ODataModel.prototype.destroyBindingContext = function(oContext) {
|
|
1334
1396
|
};
|
|
1335
1397
|
|
|
1336
1398
|
/**
|
|
1337
|
-
* Create URL parameters from custom parameters
|
|
1399
|
+
* Create URL parameters from custom parameters.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {object} mParameters Parameters to build URL parameters from
|
|
1402
|
+
*
|
|
1403
|
+
* @returns {string} The parameters to use in a URL
|
|
1338
1404
|
* @private
|
|
1339
1405
|
*/
|
|
1340
1406
|
ODataModel.prototype.createCustomParams = function(mParameters) {
|
|
1341
|
-
var
|
|
1407
|
+
var sName, sParamName,
|
|
1408
|
+
aCustomParams = [],
|
|
1342
1409
|
mCustomQueryOptions,
|
|
1343
1410
|
mSupportedParams = {
|
|
1344
1411
|
expand: true,
|
|
1345
1412
|
select: true
|
|
1346
1413
|
};
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1414
|
+
|
|
1415
|
+
for (sParamName in mParameters) {
|
|
1416
|
+
if (sParamName in mSupportedParams) {
|
|
1417
|
+
aCustomParams.push("$" + sParamName + "=" + encodeURL(mParameters[sParamName]));
|
|
1350
1418
|
}
|
|
1351
|
-
if (
|
|
1352
|
-
mCustomQueryOptions = mParameters[
|
|
1353
|
-
for (
|
|
1419
|
+
if (sParamName == "custom") {
|
|
1420
|
+
mCustomQueryOptions = mParameters[sParamName];
|
|
1421
|
+
for (sName in mCustomQueryOptions) {
|
|
1354
1422
|
if (sName.indexOf("$") == 0) {
|
|
1355
1423
|
Log.warning("Trying to set OData parameter " + sName + " as custom query option!");
|
|
1356
1424
|
} else {
|
|
@@ -1362,7 +1430,7 @@ sap.ui.define([
|
|
|
1362
1430
|
return aCustomParams.join("&");
|
|
1363
1431
|
};
|
|
1364
1432
|
|
|
1365
|
-
|
|
1433
|
+
/*
|
|
1366
1434
|
* @see sap.ui.model.Model.prototype.bindContext
|
|
1367
1435
|
*/
|
|
1368
1436
|
ODataModel.prototype.bindContext = function(sPath, oContext, mParameters) {
|
|
@@ -1371,9 +1439,10 @@ sap.ui.define([
|
|
|
1371
1439
|
};
|
|
1372
1440
|
|
|
1373
1441
|
/**
|
|
1374
|
-
* Sets whether this OData service supports
|
|
1442
|
+
* Sets whether this OData service supports <code>$count</code> on its collections.
|
|
1375
1443
|
*
|
|
1376
1444
|
* @param {boolean} bCountSupported
|
|
1445
|
+
* Whether this OData service supports <code>$count</code> on its collections
|
|
1377
1446
|
* @deprecated As of version 1.20, please use {@link #setDefaultCountMode} instead.
|
|
1378
1447
|
* @public
|
|
1379
1448
|
*/
|
|
@@ -1382,9 +1451,10 @@ sap.ui.define([
|
|
|
1382
1451
|
};
|
|
1383
1452
|
|
|
1384
1453
|
/**
|
|
1385
|
-
* Returns whether this model supports
|
|
1454
|
+
* Returns whether this model supports <code>$count</code> on its collections.
|
|
1455
|
+
*
|
|
1456
|
+
* @returns {boolean} Whether this model supports <code>$count</code> on its collections
|
|
1386
1457
|
*
|
|
1387
|
-
* @returns {boolean}
|
|
1388
1458
|
* @deprecated As of version 1.20, please use {@link #getDefaultCountMode} instead.
|
|
1389
1459
|
* @public
|
|
1390
1460
|
*/
|
|
@@ -1419,9 +1489,11 @@ sap.ui.define([
|
|
|
1419
1489
|
};
|
|
1420
1490
|
|
|
1421
1491
|
/**
|
|
1422
|
-
* Returns the default count mode for retrieving the count of collections
|
|
1492
|
+
* Returns the default count mode for retrieving the count of collections.
|
|
1423
1493
|
*
|
|
1424
1494
|
* @returns {sap.ui.model.odata.CountMode}
|
|
1495
|
+
* The default count mode for retrieving the count of collections
|
|
1496
|
+
*
|
|
1425
1497
|
* @since 1.20
|
|
1426
1498
|
* @public
|
|
1427
1499
|
*/
|
|
@@ -1431,10 +1503,13 @@ sap.ui.define([
|
|
|
1431
1503
|
|
|
1432
1504
|
|
|
1433
1505
|
/**
|
|
1434
|
-
* Returns the key part from the entry URI or the given context
|
|
1506
|
+
* Returns the key part from the entry URI or the given context.
|
|
1435
1507
|
*
|
|
1436
|
-
* @param {object|sap.ui.model.Context} oObject
|
|
1508
|
+
* @param {object|sap.ui.model.Context} oObject The object or context to get the key from
|
|
1437
1509
|
* @param {boolean} bDecode Whether the URI decoding should be applied on the key
|
|
1510
|
+
*
|
|
1511
|
+
* @returns {string} The key part from the entry URI
|
|
1512
|
+
*
|
|
1438
1513
|
* @private
|
|
1439
1514
|
*/
|
|
1440
1515
|
ODataModel.prototype._getKey = function(oObject, bDecode) {
|
|
@@ -1452,10 +1527,13 @@ sap.ui.define([
|
|
|
1452
1527
|
};
|
|
1453
1528
|
|
|
1454
1529
|
/**
|
|
1455
|
-
* Returns the key part from the entry URI or the given context or object
|
|
1530
|
+
* Returns the key part from the entry URI or the given context or object.
|
|
1456
1531
|
*
|
|
1457
1532
|
* @param {object|sap.ui.model.Context} oObject The context or object
|
|
1458
1533
|
* @param {boolean} bDecode Whether the URI decoding should be applied on the key
|
|
1534
|
+
*
|
|
1535
|
+
* @returns {string} The key part from the entry URI
|
|
1536
|
+
*
|
|
1459
1537
|
* @public
|
|
1460
1538
|
*/
|
|
1461
1539
|
ODataModel.prototype.getKey = function(oObject, bDecode) {
|
|
@@ -1463,11 +1541,17 @@ sap.ui.define([
|
|
|
1463
1541
|
};
|
|
1464
1542
|
|
|
1465
1543
|
/**
|
|
1466
|
-
* Creates the key from the given collection name and property map
|
|
1544
|
+
* Creates the key from the given collection name and property map.
|
|
1545
|
+
*
|
|
1546
|
+
* @param {string} sCollection
|
|
1547
|
+
* The name of the collection
|
|
1548
|
+
* @param {object} oKeyProperties
|
|
1549
|
+
* The object containing at least all the key properties of the entity type
|
|
1550
|
+
* @param {boolean} bDecode
|
|
1551
|
+
* Whether the URI decoding should be applied on the key
|
|
1552
|
+
*
|
|
1553
|
+
* @returns {string} The created key
|
|
1467
1554
|
*
|
|
1468
|
-
* @param {string} sCollection The name of the collection
|
|
1469
|
-
* @param {object} oKeyParameters The object containing at least all the key properties of the entity type
|
|
1470
|
-
* @param {boolean} bDecode Whether the URI decoding should be applied on the key
|
|
1471
1555
|
* @public
|
|
1472
1556
|
*/
|
|
1473
1557
|
ODataModel.prototype.createKey = function(sCollection, oKeyProperties, bDecode) {
|
|
@@ -1504,21 +1588,27 @@ sap.ui.define([
|
|
|
1504
1588
|
};
|
|
1505
1589
|
|
|
1506
1590
|
/**
|
|
1507
|
-
* Returns the value for the property with the given <code>sPath</code>.
|
|
1508
|
-
*
|
|
1509
|
-
* parameter determines if the navigation property should be
|
|
1591
|
+
* Returns the value for the property with the given <code>sPath</code>. If the path points to a
|
|
1592
|
+
* navigation property which has been loaded via <code>$expand</code> then the
|
|
1593
|
+
* <code>bIncludeExpandEntries</code> parameter determines if the navigation property should be
|
|
1594
|
+
* included in the returned value or not.
|
|
1510
1595
|
* Please note that this currently works for 1..1 navigation properties only.
|
|
1511
1596
|
*
|
|
1597
|
+
* @param {string} sPath
|
|
1598
|
+
* The path/name of the property
|
|
1599
|
+
* @param {object} [oContext]
|
|
1600
|
+
* The context if available to access the property value
|
|
1601
|
+
* @param {boolean} [bIncludeExpandEntries]
|
|
1602
|
+
* This parameter should be set when a URI or custom parameter with a <code>$expand</code>
|
|
1603
|
+
* System Query Option was used to retrieve associated entries embedded/inline. If true then
|
|
1604
|
+
* the getProperty function returns a desired property value/entry and includes the associated
|
|
1605
|
+
* expand entries (if any). If false the associated/expanded entry properties are removed and
|
|
1606
|
+
* not included in the desired entry as properties at all. This is useful for performing
|
|
1607
|
+
* updates on the base entry only. Note: A copy and not a reference of the entry will be
|
|
1608
|
+
* returned.
|
|
1609
|
+
*
|
|
1610
|
+
* @return {object} The value of the property
|
|
1512
1611
|
*
|
|
1513
|
-
* @param {string} sPath the path/name of the property
|
|
1514
|
-
* @param {object} [oContext] the context if available to access the property value
|
|
1515
|
-
* @param {boolean} [bIncludeExpandEntries=null] This parameter should be set when a URI or custom parameter
|
|
1516
|
-
* with a $expand System Query Option was used to retrieve associated entries embedded/inline.
|
|
1517
|
-
* If true then the getProperty function returns a desired property value/entry and includes the associated expand entries (if any).
|
|
1518
|
-
* If false the associated/expanded entry properties are removed and not included in the
|
|
1519
|
-
* desired entry as properties at all. This is useful for performing updates on the base entry only. Note: A copy and not a reference of the entry will be returned.
|
|
1520
|
-
* @type any
|
|
1521
|
-
* @return the value of the property
|
|
1522
1612
|
* @public
|
|
1523
1613
|
*/
|
|
1524
1614
|
ODataModel.prototype.getProperty = function(sPath, oContext, bIncludeExpandEntries) {
|
|
@@ -1547,9 +1637,12 @@ sap.ui.define([
|
|
|
1547
1637
|
};
|
|
1548
1638
|
|
|
1549
1639
|
/**
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
* @
|
|
1640
|
+
* Gets the object for the given path and context.
|
|
1641
|
+
*
|
|
1642
|
+
* @param {string} sPath A relative or absolute path
|
|
1643
|
+
* @param {object} [oContext] A context to resolve a relative path
|
|
1644
|
+
*
|
|
1645
|
+
* @returns {any} The object matching path and context
|
|
1553
1646
|
*/
|
|
1554
1647
|
ODataModel.prototype._getObject = function(sPath, oContext) {
|
|
1555
1648
|
var oNode = this.isLegacySyntax() ? this.oData : null,
|
|
@@ -1573,7 +1666,7 @@ sap.ui.define([
|
|
|
1573
1666
|
// Metadata binding resolved by ODataMetadata
|
|
1574
1667
|
oNode = this.oMetadata._getAnnotation(sResolvedPath);
|
|
1575
1668
|
}
|
|
1576
|
-
} else
|
|
1669
|
+
} else {
|
|
1577
1670
|
if (oContext) {
|
|
1578
1671
|
sKey = oContext.getPath();
|
|
1579
1672
|
// remove starting slash
|
|
@@ -1708,7 +1801,22 @@ sap.ui.define([
|
|
|
1708
1801
|
};
|
|
1709
1802
|
|
|
1710
1803
|
/**
|
|
1711
|
-
*
|
|
1804
|
+
* Submits changes from the requestQueue (queue can currently have only one request).
|
|
1805
|
+
*
|
|
1806
|
+
* @param {object} oRequest
|
|
1807
|
+
* The request
|
|
1808
|
+
* @param {boolean} bBatch
|
|
1809
|
+
* Whether the request should be sent as batch
|
|
1810
|
+
* @param {function} [fnSuccess]
|
|
1811
|
+
* A function to call on success
|
|
1812
|
+
* @param {function} [fnError]
|
|
1813
|
+
* A function to call on failure
|
|
1814
|
+
* @param {boolean} [bHandleBatchErrors]
|
|
1815
|
+
* Whether errors in batch requests should be handled
|
|
1816
|
+
* @param {boolean} [bImportData]
|
|
1817
|
+
* Whether to import the data into the model's data cache on success
|
|
1818
|
+
* @returns {object}
|
|
1819
|
+
* The request handle
|
|
1712
1820
|
*
|
|
1713
1821
|
* @private
|
|
1714
1822
|
*/
|
|
@@ -1758,6 +1866,8 @@ sap.ui.define([
|
|
|
1758
1866
|
if (fnSuccess) {
|
|
1759
1867
|
fnSuccess(oData, oResponse);
|
|
1760
1868
|
}
|
|
1869
|
+
|
|
1870
|
+
return undefined;
|
|
1761
1871
|
}
|
|
1762
1872
|
|
|
1763
1873
|
function _handleError(oError) {
|
|
@@ -1968,7 +2078,15 @@ sap.ui.define([
|
|
|
1968
2078
|
};
|
|
1969
2079
|
|
|
1970
2080
|
/**
|
|
1971
|
-
*
|
|
2081
|
+
* Error handling for requests.
|
|
2082
|
+
*
|
|
2083
|
+
* @param {object} oError
|
|
2084
|
+
* The error object
|
|
2085
|
+
*
|
|
2086
|
+
* @returns {object}
|
|
2087
|
+
* A map containing information about the error, such as <code>message</code>,
|
|
2088
|
+
* <code>statusCode</code>, <code>statusText</code> and <code>responseText</code>
|
|
2089
|
+
*
|
|
1972
2090
|
* @private
|
|
1973
2091
|
*/
|
|
1974
2092
|
ODataModel.prototype._handleError = function(oError) {
|
|
@@ -2000,15 +2118,21 @@ sap.ui.define([
|
|
|
2000
2118
|
/**
|
|
2001
2119
|
* Return requested data as object if the data has already been loaded and stored in the model.
|
|
2002
2120
|
*
|
|
2003
|
-
* @param {string} sPath
|
|
2004
|
-
*
|
|
2005
|
-
* @param {
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2121
|
+
* @param {string} sPath
|
|
2122
|
+
* A string containing the path to the data object that should be returned
|
|
2123
|
+
* @param {object} [oContext]
|
|
2124
|
+
* The optional context which is used with the sPath to retrieve the requested data
|
|
2125
|
+
* @param {boolean} [bIncludeExpandEntries]
|
|
2126
|
+
* This parameter should be set when a URI or custom parameter with a <code>$expand</code>
|
|
2127
|
+
* System Query Option was used to retrieve associated entries embedded/inline; if true then
|
|
2128
|
+
* the <code>getProperty</code> function returns a desired property value/entry and includes
|
|
2129
|
+
* the associated expand entries (if any); if false the associated/expanded entry properties
|
|
2130
|
+
* are removed and not included in the desired entry as properties at all; this is useful for
|
|
2131
|
+
* performing updates on the base entry only; note: A copy and not a reference of the entry
|
|
2132
|
+
* will be returned.
|
|
2010
2133
|
*
|
|
2011
2134
|
* @return {object} oData Object containing the requested data if the path is valid.
|
|
2135
|
+
*
|
|
2012
2136
|
* @public
|
|
2013
2137
|
* @deprecated As of version 1.6.0, please use {@link #getProperty} instead
|
|
2014
2138
|
*/
|
|
@@ -2017,7 +2141,14 @@ sap.ui.define([
|
|
|
2017
2141
|
};
|
|
2018
2142
|
|
|
2019
2143
|
/**
|
|
2020
|
-
*
|
|
2144
|
+
* Returns an ETag: either the passed sETag or tries to retrieve the ETag from the metadata of
|
|
2145
|
+
* <code>oPayload</code> or <code>sPath</code>.
|
|
2146
|
+
*
|
|
2147
|
+
* @param {string} sPath The path to metadata which could contain an ETag
|
|
2148
|
+
* @param {object} oPayload The payload which metadata could contain an ETag
|
|
2149
|
+
* @param {string} sETag ETag to return of no other ETag is found
|
|
2150
|
+
*
|
|
2151
|
+
* @returns {string} The ETag
|
|
2021
2152
|
*
|
|
2022
2153
|
* @private
|
|
2023
2154
|
*/
|
|
@@ -2025,26 +2156,33 @@ sap.ui.define([
|
|
|
2025
2156
|
var sETagHeader, sEntry, iIndex;
|
|
2026
2157
|
if (sETag) {
|
|
2027
2158
|
sETagHeader = sETag;
|
|
2028
|
-
} else {
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
sETagHeader = this.getProperty('/' + sEntry + '/__metadata/etag');
|
|
2039
|
-
}
|
|
2159
|
+
} else if (oPayload && oPayload.__metadata) {
|
|
2160
|
+
sETagHeader = oPayload.__metadata.etag;
|
|
2161
|
+
} else if (sPath) {
|
|
2162
|
+
sEntry = sPath.replace(this.sServiceUrl + '/','');
|
|
2163
|
+
iIndex = sEntry.indexOf("?");
|
|
2164
|
+
if (iIndex > -1) {
|
|
2165
|
+
sEntry = sEntry.substr(0, iIndex);
|
|
2166
|
+
}
|
|
2167
|
+
if (this.oData.hasOwnProperty(sEntry)) {
|
|
2168
|
+
sETagHeader = this.getProperty('/' + sEntry + '/__metadata/etag');
|
|
2040
2169
|
}
|
|
2041
2170
|
}
|
|
2171
|
+
|
|
2042
2172
|
return sETagHeader;
|
|
2043
2173
|
};
|
|
2174
|
+
|
|
2044
2175
|
/**
|
|
2045
|
-
*
|
|
2176
|
+
* Create a request object for changes.
|
|
2177
|
+
*
|
|
2178
|
+
* @param {string} sUrl The request URL
|
|
2179
|
+
* @param {string} sMethod The request method
|
|
2180
|
+
* @param {boolean} bAsync Whether the request should be sent asynchronously
|
|
2181
|
+
* @param {object} oPayload The payload to send with the request
|
|
2182
|
+
* @param {string} sETag The ETag for the request
|
|
2183
|
+
*
|
|
2184
|
+
* @return {object} The request object
|
|
2046
2185
|
*
|
|
2047
|
-
* @return {object} request object
|
|
2048
2186
|
* @private
|
|
2049
2187
|
*/
|
|
2050
2188
|
ODataModel.prototype._createRequest = function(sUrl, sMethod, bAsync, oPayload, sETag) {
|
|
@@ -2090,10 +2228,15 @@ sap.ui.define([
|
|
|
2090
2228
|
};
|
|
2091
2229
|
|
|
2092
2230
|
/**
|
|
2093
|
-
* Checks if a model refresh is needed, either because the data provided by the
|
|
2094
|
-
* in the model or new data is added
|
|
2231
|
+
* Checks if a model refresh is needed, either because the data provided by the
|
|
2232
|
+
* <code>oRequest</code> and <code>oResponse</code> is stored in the model or new data is added
|
|
2233
|
+
* (POST). For batch requests all embedded requests are checked separately.
|
|
2234
|
+
*
|
|
2235
|
+
* @param {object} oRequest The request which may contain change requests
|
|
2236
|
+
* @param {object} oResponse The response which may contain new data
|
|
2237
|
+
*
|
|
2238
|
+
* @return {boolean} Whether a refresh is needed
|
|
2095
2239
|
*
|
|
2096
|
-
* @return {boolean}
|
|
2097
2240
|
* @private
|
|
2098
2241
|
*/
|
|
2099
2242
|
ODataModel.prototype._isRefreshNeeded = function(oRequest, oResponse) {
|
|
@@ -2113,8 +2256,11 @@ sap.ui.define([
|
|
|
2113
2256
|
each(aErrorResponses, function(iIndex, oErrorResponse){
|
|
2114
2257
|
if (oErrorResponse.response && oErrorResponse.response.statusCode == "412") {
|
|
2115
2258
|
sErrorCode = oErrorResponse.response.statusCode;
|
|
2259
|
+
|
|
2116
2260
|
return false;
|
|
2117
2261
|
}
|
|
2262
|
+
|
|
2263
|
+
return true;
|
|
2118
2264
|
});
|
|
2119
2265
|
if (sErrorCode) {
|
|
2120
2266
|
return false;
|
|
@@ -2129,17 +2275,14 @@ sap.ui.define([
|
|
|
2129
2275
|
}
|
|
2130
2276
|
return !bRefreshNeeded; //break
|
|
2131
2277
|
});
|
|
2278
|
+
} else if (oRequest.method === "GET" ) {
|
|
2279
|
+
return false;
|
|
2280
|
+
} else if (oResponse && oResponse.statusCode == "412") {
|
|
2281
|
+
bRefreshNeeded = false;
|
|
2132
2282
|
} else {
|
|
2133
|
-
|
|
2134
|
-
return false;
|
|
2135
|
-
} else {
|
|
2136
|
-
if (oResponse && oResponse.statusCode == "412") {
|
|
2137
|
-
bRefreshNeeded = false;
|
|
2138
|
-
} else {
|
|
2139
|
-
bRefreshNeeded = true;
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2283
|
+
bRefreshNeeded = true;
|
|
2142
2284
|
}
|
|
2285
|
+
|
|
2143
2286
|
return bRefreshNeeded;
|
|
2144
2287
|
};
|
|
2145
2288
|
|
|
@@ -2420,7 +2563,7 @@ sap.ui.define([
|
|
|
2420
2563
|
|
|
2421
2564
|
if (oFunctionMetadata) {
|
|
2422
2565
|
sUrl = this._createRequestUrl(sFunctionName, oContext, null, this.bUseBatch);
|
|
2423
|
-
var sUrlURI = URI(sUrl);
|
|
2566
|
+
var sUrlURI = new URI(sUrl);
|
|
2424
2567
|
if (oFunctionMetadata.parameter != null) {
|
|
2425
2568
|
each(oParameters, function (sParameterName, oParameterValue) {
|
|
2426
2569
|
var matchingParameters = oFunctionMetadata.parameter.filter(function (oParameter) {
|
|
@@ -2453,6 +2596,8 @@ sap.ui.define([
|
|
|
2453
2596
|
return oRequestHandle;
|
|
2454
2597
|
}
|
|
2455
2598
|
}
|
|
2599
|
+
|
|
2600
|
+
return undefined;
|
|
2456
2601
|
};
|
|
2457
2602
|
|
|
2458
2603
|
/**
|
|
@@ -2537,15 +2682,25 @@ sap.ui.define([
|
|
|
2537
2682
|
};
|
|
2538
2683
|
|
|
2539
2684
|
/**
|
|
2540
|
-
* Creates a single batch operation (read or change operation) which can be used in a batch
|
|
2685
|
+
* Creates a single batch operation (read or change operation) which can be used in a batch
|
|
2686
|
+
* request.
|
|
2541
2687
|
*
|
|
2542
|
-
* @param {string} sPath
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
2545
|
-
*
|
|
2546
|
-
* @param {
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2688
|
+
* @param {string} sPath
|
|
2689
|
+
* A string containing the path to the collection or entry where the batch operation should
|
|
2690
|
+
* be performed; the path is concatenated to the <code>sServiceUrl</code> which was specified
|
|
2691
|
+
* in the model constructor
|
|
2692
|
+
* @param {string} sMethod
|
|
2693
|
+
* For the batch operation; possible values are <code>GET</code>, <code>PUT</code>,
|
|
2694
|
+
* <code>MERGE</code>, <code>POST</code> or <code>DELETE</code>
|
|
2695
|
+
* @param {object} [oData]
|
|
2696
|
+
* Optional data payload which should be created, updated, deleted in a change batch operation
|
|
2697
|
+
* @param {object} [oParameters]
|
|
2698
|
+
* Optional parameter for additional information introduced in SAPUI5 1.9.1
|
|
2699
|
+
* @param {string} [oParameters.sETag]
|
|
2700
|
+
* An ETag which can be used for concurrency control. If it is specified, it will be used in
|
|
2701
|
+
* an If-Match-Header in the request to the server for this entry.
|
|
2702
|
+
*
|
|
2703
|
+
* @returns {object} The created batch operation
|
|
2549
2704
|
* @public
|
|
2550
2705
|
*/
|
|
2551
2706
|
ODataModel.prototype.createBatchOperation = function(sPath, sMethod, oData, oParameters) {
|
|
@@ -2615,11 +2770,15 @@ sap.ui.define([
|
|
|
2615
2770
|
};
|
|
2616
2771
|
|
|
2617
2772
|
/**
|
|
2618
|
-
* Appends the read batch operations to the end of the batch stack. Only GET batch operations
|
|
2619
|
-
* If an illegal batch operation is added to the
|
|
2773
|
+
* Appends the read batch operations to the end of the batch stack. Only GET batch operations
|
|
2774
|
+
* should be included in the specified array. If an illegal batch operation is added to the
|
|
2775
|
+
* batch nothing will be performed and false will be returned.
|
|
2620
2776
|
*
|
|
2621
|
-
* @param {any[]} aReadOperations
|
|
2777
|
+
* @param {any[]} aReadOperations
|
|
2778
|
+
* An array of read batch operations created via <code>createBatchOperation</code> with
|
|
2779
|
+
* <code>sMethod = "GET"</code>
|
|
2622
2780
|
*
|
|
2781
|
+
* @returns {false|undefined} <code>false</code>, if an illegal batch operation is added
|
|
2623
2782
|
* @public
|
|
2624
2783
|
*/
|
|
2625
2784
|
ODataModel.prototype.addBatchReadOperations = function(aReadOperations) {
|
|
@@ -2634,15 +2793,26 @@ sap.ui.define([
|
|
|
2634
2793
|
return false;
|
|
2635
2794
|
}
|
|
2636
2795
|
that.aBatchOperations.push(oReadOperation);
|
|
2796
|
+
|
|
2797
|
+
return true;
|
|
2637
2798
|
});
|
|
2799
|
+
|
|
2800
|
+
return undefined;
|
|
2638
2801
|
};
|
|
2639
2802
|
|
|
2640
2803
|
/**
|
|
2641
|
-
* Appends the change batch operations to the end of the batch stack. Only PUT,
|
|
2642
|
-
*
|
|
2643
|
-
*
|
|
2804
|
+
* Appends the change batch operations to the end of the batch stack. Only <code>PUT</code,
|
|
2805
|
+
* <code>POST</code> or <code>DELETE</code> batch operations should be included in the specified
|
|
2806
|
+
* array. The operations in the array will be included in a single changeset. To embed change
|
|
2807
|
+
* operations in different change sets call this method with the corresponding change operations
|
|
2808
|
+
* again. If an illegal batch operation is added to the change set nothing will be performed and
|
|
2809
|
+
* false will be returned.
|
|
2810
|
+
*
|
|
2811
|
+
* @param {any[]} aChangeOperations
|
|
2812
|
+
* An array of change batch operations created via <code>createBatchOperation</code> with
|
|
2813
|
+
* parameter <code>sMethod = "POST"/"PUT"/"MERGE"/"DELETE"</code>
|
|
2644
2814
|
*
|
|
2645
|
-
* @
|
|
2815
|
+
* @returns {false|undefined} <code>false</code>, if an illegal batch operation is added
|
|
2646
2816
|
*
|
|
2647
2817
|
* @public
|
|
2648
2818
|
*/
|
|
@@ -2655,8 +2825,12 @@ sap.ui.define([
|
|
|
2655
2825
|
Log.warning("Batch operation should be a POST/PUT/MERGE/DELETE operation!");
|
|
2656
2826
|
return false;
|
|
2657
2827
|
}
|
|
2828
|
+
|
|
2829
|
+
return true;
|
|
2658
2830
|
});
|
|
2659
2831
|
this.aBatchOperations.push({ __changeRequests : aChangeOperations });
|
|
2832
|
+
|
|
2833
|
+
return undefined;
|
|
2660
2834
|
};
|
|
2661
2835
|
|
|
2662
2836
|
/**
|
|
@@ -2724,31 +2898,38 @@ sap.ui.define([
|
|
|
2724
2898
|
};
|
|
2725
2899
|
|
|
2726
2900
|
/**
|
|
2727
|
-
* Return the metadata object. Please note that when using the model with
|
|
2728
|
-
*
|
|
2729
|
-
*
|
|
2901
|
+
* Return the metadata object. Please note that when using the model with
|
|
2902
|
+
* <code>bLoadMetadataAsync = true</code> then this function might return <code>undefined</code
|
|
2903
|
+
* because the metadata has not been loaded yet. In this case attach to the
|
|
2904
|
+
* <code>metadataLoaded</code> event to get notified when the metadata is available and then
|
|
2905
|
+
* call this function.
|
|
2730
2906
|
*
|
|
2731
|
-
* @return {Object}
|
|
2907
|
+
* @return {Object|undefined} Metadata object
|
|
2732
2908
|
* @public
|
|
2733
2909
|
*/
|
|
2734
2910
|
ODataModel.prototype.getServiceMetadata = function() {
|
|
2735
2911
|
if (this.oMetadata && this.oMetadata.isLoaded()) {
|
|
2736
2912
|
return this.oMetadata.getServiceMetadata();
|
|
2737
2913
|
}
|
|
2914
|
+
|
|
2915
|
+
return undefined;
|
|
2738
2916
|
};
|
|
2739
2917
|
|
|
2740
2918
|
/**
|
|
2741
|
-
* Return the annotation object. Please note that when using the model with
|
|
2742
|
-
*
|
|
2743
|
-
* In this case attach to the <code>annotationsLoaded</code>
|
|
2919
|
+
* Return the annotation object. Please note that when using the model with
|
|
2920
|
+
* <code>bLoadMetadataAsync = true</code> then this function might return undefined because the
|
|
2921
|
+
* metadata has not been loaded yet. In this case attach to the <code>annotationsLoaded</code>
|
|
2922
|
+
* event to get notified when the annotations are available and then call this function.
|
|
2744
2923
|
*
|
|
2745
|
-
* @return {Object}
|
|
2924
|
+
* @return {Object|undefined} Metadata object
|
|
2746
2925
|
* @public
|
|
2747
2926
|
*/
|
|
2748
2927
|
ODataModel.prototype.getServiceAnnotations = function() {
|
|
2749
2928
|
if (this.oAnnotations && this.oAnnotations.getAnnotationsData) {
|
|
2750
2929
|
return this.oAnnotations.getAnnotationsData();
|
|
2751
2930
|
}
|
|
2931
|
+
|
|
2932
|
+
return undefined;
|
|
2752
2933
|
};
|
|
2753
2934
|
|
|
2754
2935
|
/**
|
|
@@ -2844,7 +3025,9 @@ sap.ui.define([
|
|
|
2844
3025
|
oCurrentRequest._oRef = oReqClone;
|
|
2845
3026
|
|
|
2846
3027
|
oReqClone.requestUri = oReqClone.requestUri.replace(that.sServiceUrl + '/','');
|
|
2847
|
-
|
|
3028
|
+
if (oReqClone.data._bCreate) {
|
|
3029
|
+
delete oReqClone.data._bCreate;
|
|
3030
|
+
}
|
|
2848
3031
|
aChangeRequests.push(oReqClone);
|
|
2849
3032
|
});
|
|
2850
3033
|
|
|
@@ -2940,22 +3123,31 @@ sap.ui.define([
|
|
|
2940
3123
|
};
|
|
2941
3124
|
|
|
2942
3125
|
/**
|
|
2943
|
-
* Sets a new value for the given property <code>sPropertyName</code> in the model without
|
|
2944
|
-
*
|
|
3126
|
+
* Sets a new value for the given property <code>sPropertyName</code> in the model without
|
|
3127
|
+
* triggering a server request. This can be done by the <code>submitChanges</code> method.
|
|
2945
3128
|
*
|
|
2946
|
-
*
|
|
3129
|
+
* Note: Only one entry of one collection can be updated at once. Otherwise a
|
|
3130
|
+
* <code>fireRejectChange</code> event is fired.
|
|
2947
3131
|
*
|
|
2948
|
-
*
|
|
2949
|
-
*
|
|
3132
|
+
* Before updating a different entry the existing changes of the current entry have to be
|
|
3133
|
+
* submitted or reset by the corresponding methods: <code>submitChanges</code>,
|
|
3134
|
+
* <code>resetChanges</code>.
|
|
2950
3135
|
*
|
|
2951
|
-
*
|
|
2952
|
-
*
|
|
3136
|
+
* IMPORTANT: All pending changes are reset in the model if the application triggers any kind of
|
|
3137
|
+
* refresh on that entry. Make sure to submit the pending changes first. To determine if there
|
|
3138
|
+
* are any pending changes call the <code>hasPendingChanges</code> method.
|
|
3139
|
+
*
|
|
3140
|
+
* @param {string} sPath
|
|
3141
|
+
* Path of the property to set
|
|
3142
|
+
* @param {any} oValue
|
|
3143
|
+
* Value to set the property to
|
|
3144
|
+
* @param {object} [oContext]
|
|
3145
|
+
* The context which will be used to set the property
|
|
3146
|
+
* @param {boolean} [bAsyncUpdate]
|
|
3147
|
+
* Whether to update other bindings dependent on this property asynchronously
|
|
3148
|
+
*
|
|
3149
|
+
* @return {boolean} Whether the value was set correctly
|
|
2953
3150
|
*
|
|
2954
|
-
* @param {string} sPath path of the property to set
|
|
2955
|
-
* @param {any} oValue value to set the property to
|
|
2956
|
-
* @param {object} [oContext=null] the context which will be used to set the property
|
|
2957
|
-
* @param {boolean} [bAsyncUpdate] whether to update other bindings dependent on this property asynchronously
|
|
2958
|
-
* @return {boolean} true if the value was set correctly and false if errors occurred like the entry was not found or another entry was already updated.
|
|
2959
3151
|
* @public
|
|
2960
3152
|
*/
|
|
2961
3153
|
ODataModel.prototype.setProperty = function(sPath, oValue, oContext, bAsyncUpdate) {
|
|
@@ -3090,7 +3282,13 @@ sap.ui.define([
|
|
|
3090
3282
|
};
|
|
3091
3283
|
|
|
3092
3284
|
/**
|
|
3093
|
-
* Searches the specified headers map for the specified header name and returns the found header
|
|
3285
|
+
* Searches the specified headers map for the specified header name and returns the found header
|
|
3286
|
+
* value.
|
|
3287
|
+
*
|
|
3288
|
+
* @param {string} sFindHeader The name of the header to find
|
|
3289
|
+
* @param {object} mHeaders The headers to search in
|
|
3290
|
+
*
|
|
3291
|
+
* @returns {any} The found header
|
|
3094
3292
|
*/
|
|
3095
3293
|
ODataModel.prototype._getHeader = function(sFindHeader, mHeaders) {
|
|
3096
3294
|
var sHeaderName;
|
|
@@ -3263,9 +3461,11 @@ sap.ui.define([
|
|
|
3263
3461
|
};
|
|
3264
3462
|
|
|
3265
3463
|
/**
|
|
3266
|
-
* Return value for a property. This can also be a ComplexType property
|
|
3267
|
-
*
|
|
3268
|
-
* @
|
|
3464
|
+
* Return value for a property. This can also be a ComplexType property.
|
|
3465
|
+
*
|
|
3466
|
+
* @param {string} sType The full qualified Type name
|
|
3467
|
+
*
|
|
3468
|
+
* @returns {any} The property value
|
|
3269
3469
|
* @private
|
|
3270
3470
|
*/
|
|
3271
3471
|
ODataModel.prototype._createPropertyValue = function(sType) {
|
|
@@ -3287,9 +3487,12 @@ sap.ui.define([
|
|
|
3287
3487
|
};
|
|
3288
3488
|
|
|
3289
3489
|
/**
|
|
3290
|
-
* Returns
|
|
3291
|
-
*
|
|
3292
|
-
* @param {string}
|
|
3490
|
+
* Returns <code>undefined</code>.
|
|
3491
|
+
*
|
|
3492
|
+
* @param {string} sType Unused
|
|
3493
|
+
* @param {string} sNamespace Unused
|
|
3494
|
+
*
|
|
3495
|
+
* @returns {undefined}
|
|
3293
3496
|
* @private
|
|
3294
3497
|
*/
|
|
3295
3498
|
ODataModel.prototype._getDefaultPropertyValue = function(sType, sNamespace) {
|
|
@@ -3297,7 +3500,12 @@ sap.ui.define([
|
|
|
3297
3500
|
};
|
|
3298
3501
|
|
|
3299
3502
|
/**
|
|
3300
|
-
*
|
|
3503
|
+
* Removes url params from path and make path absolute if not already.
|
|
3504
|
+
*
|
|
3505
|
+
* @param {string} sPath The path to normalize
|
|
3506
|
+
* @param {sap.ui.model.Context} oContext The context to resolve the path with
|
|
3507
|
+
*
|
|
3508
|
+
* @returns {string} The normalized path
|
|
3301
3509
|
*/
|
|
3302
3510
|
ODataModel.prototype._normalizePath = function(sPath, oContext) {
|
|
3303
3511
|
|
|
@@ -3317,7 +3525,8 @@ sap.ui.define([
|
|
|
3317
3525
|
|
|
3318
3526
|
/**
|
|
3319
3527
|
* Enable/Disable automatic updates of all Bindings after change operations
|
|
3320
|
-
*
|
|
3528
|
+
*
|
|
3529
|
+
* @param {boolean} bRefreshAfterChange Whether automatic updates should be enabled
|
|
3321
3530
|
* @public
|
|
3322
3531
|
* @since 1.16.3
|
|
3323
3532
|
*/
|
|
@@ -3325,15 +3534,23 @@ sap.ui.define([
|
|
|
3325
3534
|
this.bRefreshAfterChange = bRefreshAfterChange;
|
|
3326
3535
|
};
|
|
3327
3536
|
|
|
3537
|
+
/**
|
|
3538
|
+
* Checks if the binding matching path and context is a list.
|
|
3539
|
+
*
|
|
3540
|
+
* @param {string} sPath The path to the binding
|
|
3541
|
+
* @param {object} [oContext] The context to resolve the path with
|
|
3542
|
+
* @returns {boolean} Whether the binding is a list
|
|
3543
|
+
*/
|
|
3328
3544
|
ODataModel.prototype.isList = function(sPath, oContext) {
|
|
3329
|
-
|
|
3545
|
+
sPath = this.resolve(sPath, oContext);
|
|
3330
3546
|
return sPath && sPath.substr(sPath.lastIndexOf("/")).indexOf("(") === -1;
|
|
3331
3547
|
};
|
|
3332
3548
|
|
|
3333
3549
|
/**
|
|
3334
|
-
* Checks if path points to a metamodel property
|
|
3550
|
+
* Checks if path points to a metamodel property.
|
|
3551
|
+
*
|
|
3335
3552
|
* @param {string} sPath The binding path
|
|
3336
|
-
* @returns {boolean}
|
|
3553
|
+
* @returns {boolean} Whether the path points to a metamodel property
|
|
3337
3554
|
* @private
|
|
3338
3555
|
*/
|
|
3339
3556
|
ODataModel.prototype.isMetaModelPath = function(sPath) {
|
|
@@ -3341,11 +3558,21 @@ sap.ui.define([
|
|
|
3341
3558
|
};
|
|
3342
3559
|
|
|
3343
3560
|
/**
|
|
3344
|
-
* Wraps the
|
|
3561
|
+
* Wraps the {@link sap.ui.thirdparty.datajs#request} method and keeps track of pending requests
|
|
3562
|
+
*
|
|
3563
|
+
* @param {object} oRequest The request to send
|
|
3564
|
+
* @param {function} fnSuccess The success handler
|
|
3565
|
+
* @param {function} fnError The error handler
|
|
3566
|
+
* @param {object} oHandler Handler for data serialization
|
|
3567
|
+
* @param {object} oHttpClient HTTP client layer
|
|
3568
|
+
* @param {object} oMetadata Metadata for this request
|
|
3345
3569
|
*
|
|
3570
|
+
* @returns {object} The request handle
|
|
3346
3571
|
* @private
|
|
3347
3572
|
*/
|
|
3348
|
-
ODataModel.prototype._request = function(oRequest, fnSuccess, fnError, oHandler, oHttpClient,
|
|
3573
|
+
ODataModel.prototype._request = function(oRequest, fnSuccess, fnError, oHandler, oHttpClient,
|
|
3574
|
+
oMetadata) {
|
|
3575
|
+
var oRequestHandle;
|
|
3349
3576
|
|
|
3350
3577
|
if (this.bDestroyed) {
|
|
3351
3578
|
return {
|
|
@@ -3373,7 +3600,7 @@ sap.ui.define([
|
|
|
3373
3600
|
}
|
|
3374
3601
|
|
|
3375
3602
|
// create request with wrapped handlers
|
|
3376
|
-
|
|
3603
|
+
oRequestHandle = OData.request(
|
|
3377
3604
|
oRequest,
|
|
3378
3605
|
wrapHandler(fnSuccess || OData.defaultSuccess),
|
|
3379
3606
|
wrapHandler(fnError || OData.defaultError),
|