igniteui-webcomponents-datasources 7.1.1-beta.1 → 7.1.1-beta.2
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/fesm2022/igniteui-webcomponents-datasources.mjs +3611 -0
- package/igniteui-webcomponents-datasources.d.ts +754 -1
- package/package.json +13 -9
- package/bundles/igniteui-webcomponents-datasources.umd.js +0 -4725
- package/bundles/igniteui-webcomponents-datasources.umd.min.js +0 -7
- package/esm2015/igniteui-webcomponents-datasources.js +0 -1
- package/esm2015/lib/Entity.js +0 -65
- package/esm2015/lib/EntityProperty.js +0 -27
- package/esm2015/lib/EntitySet.js +0 -50
- package/esm2015/lib/ODataDataSourcePage.js +0 -67
- package/esm2015/lib/ODataSchemaProvider.js +0 -123
- package/esm2015/lib/ODataVirtualDataSource.js +0 -132
- package/esm2015/lib/ODataVirtualDataSourceDataProvider.js +0 -453
- package/esm2015/lib/ODataVirtualDataSourceDataProviderWorker.js +0 -713
- package/esm2015/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +0 -86
- package/esm2015/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +0 -9
- package/esm2015/lib/RestVirtualDataSource.js +0 -272
- package/esm2015/lib/RestVirtualDataSourceDataProvider.js +0 -538
- package/esm2015/lib/RestVirtualDataSourceDataProviderWorker.js +0 -765
- package/esm2015/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +0 -162
- package/esm2015/lib/RestVirtualDataSourcePage.js +0 -67
- package/esm2015/lib/RestVirtualDataSourceProviderTaskDataHolder.js +0 -9
- package/esm2015/lib/Schema.js +0 -54
- package/esm2015/lib/util.js +0 -116
- package/esm2015/public_api.js +0 -18
- package/esm5/igniteui-webcomponents-datasources.js +0 -1
- package/esm5/lib/Entity.js +0 -79
- package/esm5/lib/EntityProperty.js +0 -41
- package/esm5/lib/EntitySet.js +0 -68
- package/esm5/lib/ODataDataSourcePage.js +0 -73
- package/esm5/lib/ODataSchemaProvider.js +0 -158
- package/esm5/lib/ODataVirtualDataSource.js +0 -169
- package/esm5/lib/ODataVirtualDataSourceDataProvider.js +0 -558
- package/esm5/lib/ODataVirtualDataSourceDataProviderWorker.js +0 -920
- package/esm5/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +0 -130
- package/esm5/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +0 -11
- package/esm5/lib/RestVirtualDataSource.js +0 -357
- package/esm5/lib/RestVirtualDataSourceDataProvider.js +0 -687
- package/esm5/lib/RestVirtualDataSourceDataProviderWorker.js +0 -967
- package/esm5/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +0 -250
- package/esm5/lib/RestVirtualDataSourcePage.js +0 -73
- package/esm5/lib/RestVirtualDataSourceProviderTaskDataHolder.js +0 -11
- package/esm5/lib/Schema.js +0 -68
- package/esm5/lib/util.js +0 -160
- package/esm5/public_api.js +0 -18
- package/fesm2015/igniteui-webcomponents-datasources.js +0 -3638
- package/fesm5/igniteui-webcomponents-datasources.js +0 -4698
- package/lib/Entity.d.ts +0 -14
- package/lib/EntityProperty.d.ts +0 -12
- package/lib/EntitySet.d.ts +0 -15
- package/lib/ODataDataSourcePage.d.ts +0 -19
- package/lib/ODataSchemaProvider.d.ts +0 -12
- package/lib/ODataVirtualDataSource.d.ts +0 -28
- package/lib/ODataVirtualDataSourceDataProvider.d.ts +0 -120
- package/lib/ODataVirtualDataSourceDataProviderWorker.d.ts +0 -57
- package/lib/ODataVirtualDataSourceDataProviderWorkerSettings.d.ts +0 -42
- package/lib/ODataVirtualDataSourceProviderTaskDataHolder.d.ts +0 -5
- package/lib/RestVirtualDataSource.d.ts +0 -86
- package/lib/RestVirtualDataSourceDataProvider.d.ts +0 -171
- package/lib/RestVirtualDataSourceDataProviderWorker.d.ts +0 -70
- package/lib/RestVirtualDataSourceDataProviderWorkerSettings.d.ts +0 -93
- package/lib/RestVirtualDataSourcePage.d.ts +0 -19
- package/lib/RestVirtualDataSourceProviderTaskDataHolder.d.ts +0 -5
- package/lib/Schema.d.ts +0 -15
- package/lib/util.d.ts +0 -27
- package/public_api.d.ts +0 -18
|
@@ -0,0 +1,3611 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
|
|
3
|
+
https://www.infragistics.com/legal/license/igultimate-la
|
|
4
|
+
https://www.infragistics.com/legal/license/igultimate-eula
|
|
5
|
+
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { fromEnum, XName, DataSourceSchemaPropertyType, XNamespace, XDocument, XmlNodeType, typeCast, XElement, ODataDataSourceSchema, AsyncVirtualDataSourceProviderTaskDataHolder, markType, AsyncVirtualDataSourceProviderWorker, SortDescriptionCollection, ListSortDirection, DataSourceSummaryScope, stringIsNullOrEmpty, Convert, DefaultSectionInformation, DataSourceSummaryOperand, DefaultSummaryResult, AsyncVirtualDataTask, AsyncDataSourcePageTaskHolder, ODataDataSourceFilterExpressionVisitor, TransactionType, AsyncVirtualDataSourceDataProviderWorkerSettings, Base, IDataSourceVirtualDataProvider_$type, FilterExpressionCollection, SummaryDescriptionCollection, DataSourcePageRequestPriority, runOn, DataSourceDataProviderSchemaChangedEventArgs, stringContains, VirtualDataSource, LocalDataSource, DefaultDataSourceSchema } from 'igniteui-webcomponents-core';
|
|
9
|
+
|
|
10
|
+
class EntityProperty {
|
|
11
|
+
constructor(name, schemaType) {
|
|
12
|
+
this._name = null;
|
|
13
|
+
this._isNullable = false;
|
|
14
|
+
this._type = null;
|
|
15
|
+
this.name = name;
|
|
16
|
+
this.type = schemaType;
|
|
17
|
+
}
|
|
18
|
+
get name() {
|
|
19
|
+
return this._name;
|
|
20
|
+
}
|
|
21
|
+
set name(value) {
|
|
22
|
+
this._name = value;
|
|
23
|
+
}
|
|
24
|
+
get isNullable() {
|
|
25
|
+
return this._isNullable;
|
|
26
|
+
}
|
|
27
|
+
set isNullable(value) {
|
|
28
|
+
this._isNullable = value;
|
|
29
|
+
}
|
|
30
|
+
get type() {
|
|
31
|
+
return this._type;
|
|
32
|
+
}
|
|
33
|
+
set type(value) {
|
|
34
|
+
this._type = value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function toArray(en) {
|
|
39
|
+
return Array.from(fromEnum(en));
|
|
40
|
+
}
|
|
41
|
+
function first(iter) {
|
|
42
|
+
for (let v of iter) {
|
|
43
|
+
return v;
|
|
44
|
+
}
|
|
45
|
+
throw new Error("Iterable contained no elements, expected at least one");
|
|
46
|
+
}
|
|
47
|
+
class LinkedList {
|
|
48
|
+
get first() {
|
|
49
|
+
return this._first;
|
|
50
|
+
}
|
|
51
|
+
get last() {
|
|
52
|
+
return this._last;
|
|
53
|
+
}
|
|
54
|
+
addFirst(item) {
|
|
55
|
+
if (this._first == null) {
|
|
56
|
+
this._first = new LinkedListNode(item);
|
|
57
|
+
this._last = this._first;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
var oldFirst = this._first;
|
|
61
|
+
this._first = new LinkedListNode(item);
|
|
62
|
+
this._first.next = oldFirst;
|
|
63
|
+
oldFirst.prev = this._first;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
addLast(item) {
|
|
67
|
+
if (this._last == null) {
|
|
68
|
+
this._first = new LinkedListNode(item);
|
|
69
|
+
this._last = this._first;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
var oldLast = this._last;
|
|
73
|
+
this._last = new LinkedListNode(item);
|
|
74
|
+
this._last.prev = oldLast;
|
|
75
|
+
oldLast.next = this._last;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
removeFirst() {
|
|
79
|
+
this.remove(this.first);
|
|
80
|
+
}
|
|
81
|
+
clear() {
|
|
82
|
+
this._first = null;
|
|
83
|
+
this._last = null;
|
|
84
|
+
}
|
|
85
|
+
contains(value) {
|
|
86
|
+
let curr = this.first;
|
|
87
|
+
while (curr != null) {
|
|
88
|
+
if (curr.value === value) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
curr = curr.next;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
removeValue(value) {
|
|
96
|
+
let curr = this.first;
|
|
97
|
+
while (curr != null) {
|
|
98
|
+
if (curr.value === value) {
|
|
99
|
+
this.remove(curr);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
curr = curr.next;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
remove(node) {
|
|
106
|
+
if (this._first == node) {
|
|
107
|
+
this._first = node.next;
|
|
108
|
+
if (node.next != null) {
|
|
109
|
+
node.next.prev = null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (this._last == node) {
|
|
113
|
+
this._last = node.prev;
|
|
114
|
+
if (node.prev != null) {
|
|
115
|
+
node.prev.next = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (node.prev != null) {
|
|
119
|
+
node.prev.next = node.next;
|
|
120
|
+
}
|
|
121
|
+
if (node.next != null) {
|
|
122
|
+
node.next.prev = node.prev;
|
|
123
|
+
}
|
|
124
|
+
node.next = null;
|
|
125
|
+
node.prev = null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class LinkedListNode {
|
|
129
|
+
get value() {
|
|
130
|
+
return this._value;
|
|
131
|
+
}
|
|
132
|
+
set value(value) {
|
|
133
|
+
this._value = value;
|
|
134
|
+
}
|
|
135
|
+
get prev() {
|
|
136
|
+
return this._prev;
|
|
137
|
+
}
|
|
138
|
+
set prev(value) {
|
|
139
|
+
this._prev = value;
|
|
140
|
+
}
|
|
141
|
+
get next() {
|
|
142
|
+
return this._next;
|
|
143
|
+
}
|
|
144
|
+
set next(value) {
|
|
145
|
+
this._next = value;
|
|
146
|
+
}
|
|
147
|
+
constructor(item) {
|
|
148
|
+
if (item !== undefined) {
|
|
149
|
+
this.value = item;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
class Entity {
|
|
155
|
+
constructor(name, entityNode) {
|
|
156
|
+
this._properties = null;
|
|
157
|
+
this._primaryKey = null;
|
|
158
|
+
this._name = null;
|
|
159
|
+
this.name = name;
|
|
160
|
+
this.loadProperties(entityNode);
|
|
161
|
+
this.loadPrimaryKey(entityNode);
|
|
162
|
+
}
|
|
163
|
+
get name() {
|
|
164
|
+
return this._name;
|
|
165
|
+
}
|
|
166
|
+
set name(value) {
|
|
167
|
+
this._name = value;
|
|
168
|
+
}
|
|
169
|
+
get properties() {
|
|
170
|
+
if (null == this._properties) {
|
|
171
|
+
this._properties = new Map();
|
|
172
|
+
}
|
|
173
|
+
return this._properties;
|
|
174
|
+
}
|
|
175
|
+
get primaryKey() {
|
|
176
|
+
if (null == this._primaryKey) {
|
|
177
|
+
this._primaryKey = [];
|
|
178
|
+
}
|
|
179
|
+
return this._primaryKey;
|
|
180
|
+
}
|
|
181
|
+
loadProperties(entityNode) {
|
|
182
|
+
let children = toArray(entityNode.elements());
|
|
183
|
+
let elementCount = children.length;
|
|
184
|
+
let nameAttr = XName.get("Name", "");
|
|
185
|
+
let typeAttr = XName.get("Type", "");
|
|
186
|
+
for (let i = 0; i < elementCount; i++) {
|
|
187
|
+
let node = children[i];
|
|
188
|
+
if (node.name.localName == "Property") {
|
|
189
|
+
let name = node.attribute(nameAttr).value;
|
|
190
|
+
let type = node.attribute(typeAttr).value;
|
|
191
|
+
this.properties.set(name, new EntityProperty(name, type));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
;
|
|
195
|
+
}
|
|
196
|
+
loadPrimaryKey(entityNode) {
|
|
197
|
+
let children = toArray(entityNode.elements());
|
|
198
|
+
let elementCount = children.length;
|
|
199
|
+
let nameAttr = XName.get("Name", "");
|
|
200
|
+
for (let i = 0; i < elementCount; i++) {
|
|
201
|
+
let node = children[i];
|
|
202
|
+
if (node.name.localName == "Key") {
|
|
203
|
+
let subChildren = toArray(node.elements());
|
|
204
|
+
let keyNodeCOunt = subChildren.length;
|
|
205
|
+
for (let j = 0; j < keyNodeCOunt; j++) {
|
|
206
|
+
let keyNode = subChildren[j];
|
|
207
|
+
if (keyNode.name.localName == "PropertyRef") {
|
|
208
|
+
this.primaryKey.push(keyNode.attribute(nameAttr).value);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
class EntitySet {
|
|
218
|
+
constructor(name, entityType) {
|
|
219
|
+
this._entityName = null;
|
|
220
|
+
this._entityNamespace = null;
|
|
221
|
+
this._entityType = null;
|
|
222
|
+
this._name = null;
|
|
223
|
+
this.name = name;
|
|
224
|
+
this.entityType = entityType;
|
|
225
|
+
if (entityType.indexOf(".") >= 0) {
|
|
226
|
+
let parts = entityType.split('.');
|
|
227
|
+
if (parts.length == 2) {
|
|
228
|
+
this.entityNamespace = parts[0];
|
|
229
|
+
this.entityName = parts[1];
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
let i = entityType.lastIndexOf('.');
|
|
233
|
+
this.entityNamespace = entityType.substr(0, i);
|
|
234
|
+
this.entityName = entityType.substr(i + 1);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
this.entityNamespace = entityType;
|
|
239
|
+
this.entityName = entityType;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
get entityName() {
|
|
243
|
+
return this._entityName;
|
|
244
|
+
}
|
|
245
|
+
set entityName(value) {
|
|
246
|
+
this._entityName = value;
|
|
247
|
+
}
|
|
248
|
+
get entityNamespace() {
|
|
249
|
+
return this._entityNamespace;
|
|
250
|
+
}
|
|
251
|
+
set entityNamespace(value) {
|
|
252
|
+
this._entityNamespace = value;
|
|
253
|
+
}
|
|
254
|
+
get entityType() {
|
|
255
|
+
return this._entityType;
|
|
256
|
+
}
|
|
257
|
+
set entityType(value) {
|
|
258
|
+
this._entityType = value;
|
|
259
|
+
}
|
|
260
|
+
get name() {
|
|
261
|
+
return this._name;
|
|
262
|
+
}
|
|
263
|
+
set name(value) {
|
|
264
|
+
this._name = value;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
class ODataDataSourcePage {
|
|
269
|
+
constructor(sourceData_, schema, groupInformation, summaryInformation, pageIndex) {
|
|
270
|
+
this._actualData = null;
|
|
271
|
+
this._schema = null;
|
|
272
|
+
this._pageIndex = 0;
|
|
273
|
+
this._groupInformation = null;
|
|
274
|
+
this._summaryInformation = null;
|
|
275
|
+
if (sourceData_ == null) {
|
|
276
|
+
this._actualData = null;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
let count = (sourceData_.value.length);
|
|
280
|
+
this._actualData = [];
|
|
281
|
+
let dateProps = new Set();
|
|
282
|
+
for (let i = 0; i < schema.propertyNames.length; i++) {
|
|
283
|
+
if (schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeValue || schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeOffsetValue) {
|
|
284
|
+
dateProps.add(schema.propertyNames[i]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
let value_;
|
|
288
|
+
for (let i_ = 0; i_ < count; i_++) {
|
|
289
|
+
let currItem_ = sourceData_.value[i_];
|
|
290
|
+
let dict = new Map();
|
|
291
|
+
let properties = Array.from(Object.keys(currItem_));
|
|
292
|
+
let values = (properties.map((k) => currItem_[k]));
|
|
293
|
+
for (let i1 = 0; i1 < properties.length; i1++) {
|
|
294
|
+
value_ = values[i1];
|
|
295
|
+
if (dateProps.has(properties[i1])) {
|
|
296
|
+
value_ = new Date(value_);
|
|
297
|
+
}
|
|
298
|
+
dict.set(properties[i1], value_);
|
|
299
|
+
}
|
|
300
|
+
this._actualData[i_] = dict;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
this._schema = schema;
|
|
304
|
+
this._groupInformation = groupInformation;
|
|
305
|
+
this._summaryInformation = summaryInformation;
|
|
306
|
+
this._pageIndex = pageIndex;
|
|
307
|
+
}
|
|
308
|
+
count() {
|
|
309
|
+
return this._actualData.length;
|
|
310
|
+
}
|
|
311
|
+
getItemAtIndex(index) {
|
|
312
|
+
return this._actualData[index];
|
|
313
|
+
}
|
|
314
|
+
getItemValueAtIndex(index, valueName) {
|
|
315
|
+
let item = this._actualData[index];
|
|
316
|
+
if (!item.has(valueName)) {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
return item.get(valueName);
|
|
320
|
+
}
|
|
321
|
+
pageIndex() {
|
|
322
|
+
return this._pageIndex;
|
|
323
|
+
}
|
|
324
|
+
schema() {
|
|
325
|
+
return this._schema;
|
|
326
|
+
}
|
|
327
|
+
getGroupInformation() {
|
|
328
|
+
return this._groupInformation;
|
|
329
|
+
}
|
|
330
|
+
getSummaryInformation() {
|
|
331
|
+
return this._summaryInformation;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
class Schema {
|
|
336
|
+
constructor(namespace, entityTypeElements, entitySetElements) {
|
|
337
|
+
this._entities = null;
|
|
338
|
+
this._entitySets = null;
|
|
339
|
+
this._namespace = null;
|
|
340
|
+
this.namespace = namespace;
|
|
341
|
+
this.loadEntities(entityTypeElements);
|
|
342
|
+
this.loadEntitySets(entitySetElements);
|
|
343
|
+
}
|
|
344
|
+
get entities() {
|
|
345
|
+
if (null == this._entities) {
|
|
346
|
+
this._entities = new Map();
|
|
347
|
+
}
|
|
348
|
+
return this._entities;
|
|
349
|
+
}
|
|
350
|
+
get entitySets() {
|
|
351
|
+
if (null == this._entitySets) {
|
|
352
|
+
this._entitySets = new Map();
|
|
353
|
+
}
|
|
354
|
+
return this._entitySets;
|
|
355
|
+
}
|
|
356
|
+
get namespace() {
|
|
357
|
+
return this._namespace;
|
|
358
|
+
}
|
|
359
|
+
set namespace(value) {
|
|
360
|
+
this._namespace = value;
|
|
361
|
+
}
|
|
362
|
+
loadEntities(entityTypeElements) {
|
|
363
|
+
let list = entityTypeElements;
|
|
364
|
+
let elementCount = list.length;
|
|
365
|
+
let name = XName.get("Name", "");
|
|
366
|
+
for (let i = 0; i < elementCount; i++) {
|
|
367
|
+
let node = list[i];
|
|
368
|
+
let entity = new Entity(node.attribute(name).value, node);
|
|
369
|
+
this.entities.set(entity.name, entity);
|
|
370
|
+
}
|
|
371
|
+
;
|
|
372
|
+
}
|
|
373
|
+
loadEntitySets(entitySetElements) {
|
|
374
|
+
let list = entitySetElements;
|
|
375
|
+
let elementCount = list.length;
|
|
376
|
+
let nameAttr = XName.get("Name", "");
|
|
377
|
+
let entityType = XName.get("EntityType", "");
|
|
378
|
+
for (let i = 0; i < elementCount; i++) {
|
|
379
|
+
let node = list[i];
|
|
380
|
+
let entitySet = new EntitySet(node.attribute(nameAttr).value, node.attribute(entityType).value);
|
|
381
|
+
this.entitySets.set(entitySet.name, entitySet);
|
|
382
|
+
}
|
|
383
|
+
;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
class ODataSchemaProvider {
|
|
388
|
+
static { this.nS = XNamespace.get("http://docs.oasis-open.org/odata/ns/edm"); }
|
|
389
|
+
constructor(metadataDocument) {
|
|
390
|
+
this._entityTypeSchemaNamespace = null;
|
|
391
|
+
this._entitySetSchemaNamespace = null;
|
|
392
|
+
this._schema = null;
|
|
393
|
+
if (null == metadataDocument) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
let xmlDoc = XDocument.parse(metadataDocument);
|
|
397
|
+
let schemaElements = toArray(first(fromEnum(first(fromEnum(xmlDoc.elements())).elements())).elements1(XName.get("Schema", ODataSchemaProvider.nS.namespaceName)));
|
|
398
|
+
if (null == schemaElements) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
let entitySetElements = null;
|
|
402
|
+
let entityTypeElements = null;
|
|
403
|
+
let elementCount = schemaElements.length;
|
|
404
|
+
let entityContainer = XName.get("EntityContainer", ODataSchemaProvider.nS.namespaceName);
|
|
405
|
+
let entitySet = XName.get("EntitySet", ODataSchemaProvider.nS.namespaceName);
|
|
406
|
+
let namespaceAttribute = XName.get("Namespace", "");
|
|
407
|
+
let entityType = XName.get("EntityType", ODataSchemaProvider.nS.namespaceName);
|
|
408
|
+
for (let i = 0; i < elementCount; i++) {
|
|
409
|
+
let node = schemaElements[i];
|
|
410
|
+
if (node.nodeType != XmlNodeType.Element) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
let schemaElement = schemaElements[i];
|
|
414
|
+
if (null == entitySetElements) {
|
|
415
|
+
let nodes = toArray(schemaElement.elements1(entityContainer));
|
|
416
|
+
if (null != nodes && nodes.length > 0) {
|
|
417
|
+
entitySetElements = toArray((typeCast(XElement.$type, nodes[0])).elements1(entitySet));
|
|
418
|
+
if (null != entitySetElements) {
|
|
419
|
+
this._entitySetSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (null == entityTypeElements) {
|
|
424
|
+
entityTypeElements = toArray(schemaElement.elements1(entityType));
|
|
425
|
+
if (null != entityTypeElements) {
|
|
426
|
+
this._entityTypeSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (null == entitySetElements || null == entityTypeElements) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
this.schema = new Schema(this._entityTypeSchemaNamespace, entityTypeElements, entitySetElements);
|
|
434
|
+
}
|
|
435
|
+
get schema() {
|
|
436
|
+
return this._schema;
|
|
437
|
+
}
|
|
438
|
+
set schema(value) {
|
|
439
|
+
this._schema = value;
|
|
440
|
+
}
|
|
441
|
+
getODataDataSourceSchema(entitySet) {
|
|
442
|
+
if (this.schema == null) {
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
let valueNames = [];
|
|
446
|
+
let valueTypes = [];
|
|
447
|
+
let primaryKey = [];
|
|
448
|
+
let es = this.schema.entitySets.get(entitySet);
|
|
449
|
+
if (null != es) {
|
|
450
|
+
let entity = this.schema.entities.get(es.entityName);
|
|
451
|
+
if (null != entity) {
|
|
452
|
+
for (let property of entity.properties.values()) {
|
|
453
|
+
valueNames.push(property.name);
|
|
454
|
+
if (property.type == "Edm.String") {
|
|
455
|
+
valueTypes.push(DataSourceSchemaPropertyType.StringValue);
|
|
456
|
+
}
|
|
457
|
+
else if (property.type == "Edm.Int16" || property.type == "Edm.Int32") {
|
|
458
|
+
valueTypes.push(DataSourceSchemaPropertyType.IntValue);
|
|
459
|
+
}
|
|
460
|
+
else if (property.type == "Edm.Double") {
|
|
461
|
+
valueTypes.push(DataSourceSchemaPropertyType.DoubleValue);
|
|
462
|
+
}
|
|
463
|
+
else if (property.type == "Edm.Single") {
|
|
464
|
+
valueTypes.push(DataSourceSchemaPropertyType.SingleValue);
|
|
465
|
+
}
|
|
466
|
+
else if (property.type == "Edm.Boolean") {
|
|
467
|
+
valueTypes.push(DataSourceSchemaPropertyType.BooleanValue);
|
|
468
|
+
}
|
|
469
|
+
else if (property.type == "Edm.Byte") {
|
|
470
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
471
|
+
}
|
|
472
|
+
else if (property.type == "Edm.DateTime" || property.type == "Edm.DateTimeOffset") {
|
|
473
|
+
valueTypes.push(DataSourceSchemaPropertyType.DateTimeValue);
|
|
474
|
+
}
|
|
475
|
+
else if (property.type == "Edm.Int64") {
|
|
476
|
+
valueTypes.push(DataSourceSchemaPropertyType.LongValue);
|
|
477
|
+
}
|
|
478
|
+
else if (property.type == "Edm.Decimal") {
|
|
479
|
+
valueTypes.push(DataSourceSchemaPropertyType.DecimalValue);
|
|
480
|
+
}
|
|
481
|
+
else if (property.type == "Edm.SByte") {
|
|
482
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
valueTypes.push(DataSourceSchemaPropertyType.ObjectValue);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
for (let k of entity.primaryKey) {
|
|
489
|
+
primaryKey.push(k);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return new ODataDataSourceSchema(valueNames, valueTypes, primaryKey);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
class ODataVirtualDataSourceProviderTaskDataHolder extends AsyncVirtualDataSourceProviderTaskDataHolder {
|
|
498
|
+
static { this.$t = markType(ODataVirtualDataSourceProviderTaskDataHolder, 'ODataVirtualDataSourceProviderTaskDataHolder', AsyncVirtualDataSourceProviderTaskDataHolder.$type); }
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
class ODataVirtualDataSourceDataProviderWorker extends AsyncVirtualDataSourceProviderWorker {
|
|
502
|
+
get sortDescriptions() {
|
|
503
|
+
return this._sortDescriptions;
|
|
504
|
+
}
|
|
505
|
+
get filterExpressions() {
|
|
506
|
+
return this._filterExpressions;
|
|
507
|
+
}
|
|
508
|
+
get desiredProperties() {
|
|
509
|
+
return this._desiredPropeties;
|
|
510
|
+
}
|
|
511
|
+
initialize() {
|
|
512
|
+
super.initialize();
|
|
513
|
+
}
|
|
514
|
+
getTaskDataHolder() {
|
|
515
|
+
let holder = new ODataVirtualDataSourceProviderTaskDataHolder();
|
|
516
|
+
return holder;
|
|
517
|
+
}
|
|
518
|
+
getCompletedTaskData(holder, completed) {
|
|
519
|
+
super.getCompletedTaskData(holder, completed);
|
|
520
|
+
}
|
|
521
|
+
removeCompletedTaskData(holder, completed) {
|
|
522
|
+
super.removeCompletedTaskData(holder, completed);
|
|
523
|
+
}
|
|
524
|
+
getTasksData(holder) {
|
|
525
|
+
super.getTasksData(holder);
|
|
526
|
+
}
|
|
527
|
+
*iter(coll) {
|
|
528
|
+
for (let i = 0; i < coll.size(); i++) {
|
|
529
|
+
yield coll.get(i);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
*iterFilter(coll) {
|
|
533
|
+
for (let i = 0; i < coll.size(); i++) {
|
|
534
|
+
yield coll.get(i);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
*iterSummaries(summaries) {
|
|
538
|
+
for (let i = 0; i < summaries.size(); i++) {
|
|
539
|
+
yield summaries.get(i);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
constructor(settings) {
|
|
543
|
+
super(settings);
|
|
544
|
+
this._baseUri = null;
|
|
545
|
+
this._entitySet = null;
|
|
546
|
+
this._sortDescriptions = null;
|
|
547
|
+
this._groupDescriptions = null;
|
|
548
|
+
this._filterExpressions = null;
|
|
549
|
+
this._summaryDescriptions = null;
|
|
550
|
+
this._desiredPropeties = null;
|
|
551
|
+
this._schemaIncludedProperties = null;
|
|
552
|
+
this._enableJsonp = true;
|
|
553
|
+
this._isAggregationSupported = false;
|
|
554
|
+
this._groupInformation = null;
|
|
555
|
+
this._summaryInformation = null;
|
|
556
|
+
this._filterString = null;
|
|
557
|
+
this._selectedString = null;
|
|
558
|
+
this.doWork = this.doWork.bind(this);
|
|
559
|
+
this._baseUri = settings.baseUri;
|
|
560
|
+
this._entitySet = settings.entitySet;
|
|
561
|
+
this._sortDescriptions = settings.sortDescriptions;
|
|
562
|
+
this._groupDescriptions = settings.groupDescriptions;
|
|
563
|
+
if (this._groupDescriptions != null && this._groupDescriptions.size() > 0) {
|
|
564
|
+
this._sortDescriptions = new SortDescriptionCollection();
|
|
565
|
+
for (let sd of this.iter(settings.sortDescriptions)) {
|
|
566
|
+
this._sortDescriptions.add(sd);
|
|
567
|
+
}
|
|
568
|
+
for (let i = 0; i < this._groupDescriptions.size(); i++) {
|
|
569
|
+
this._sortDescriptions.insert(i, this._groupDescriptions.get(i));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
this._filterExpressions = settings.filterExpressions;
|
|
573
|
+
this._desiredPropeties = settings.propertiesRequested;
|
|
574
|
+
if (settings.schemaIncludedProperties != null) {
|
|
575
|
+
this._schemaIncludedProperties = new Set();
|
|
576
|
+
for (let i = 0; i < settings.schemaIncludedProperties.length; i++) {
|
|
577
|
+
this._schemaIncludedProperties.add(settings.schemaIncludedProperties[i]);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
this._summaryDescriptions = settings.summaryDescriptions;
|
|
581
|
+
this._summaryScope = settings.summaryScope;
|
|
582
|
+
this._enableJsonp = settings.enableJsonp;
|
|
583
|
+
this._isAggregationSupported = settings.isAggregationSupported;
|
|
584
|
+
window.setTimeout(this.doWork, 100);
|
|
585
|
+
}
|
|
586
|
+
processCompletedTask(completedTask, currentDelay, pageIndex, taskDataHolder) {
|
|
587
|
+
let h = taskDataHolder;
|
|
588
|
+
let schema = null;
|
|
589
|
+
let result = null;
|
|
590
|
+
let schemaFetchCount = -1;
|
|
591
|
+
let task = completedTask.task;
|
|
592
|
+
try {
|
|
593
|
+
if (task.hasErrors) {
|
|
594
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (pageIndex == ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
598
|
+
result = task.result;
|
|
599
|
+
schemaFetchCount = (result['@odata.count']);
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
result = task.result;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
catch (e) {
|
|
606
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if (schemaFetchCount >= 0) {
|
|
610
|
+
this.actualCount = schemaFetchCount;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
this.actualCount = (result['@odata.count']);
|
|
614
|
+
}
|
|
615
|
+
schema = this.actualSchema;
|
|
616
|
+
if (schema == null) {
|
|
617
|
+
let requests = 0;
|
|
618
|
+
this.resolveSchema((s) => {
|
|
619
|
+
// resolveSchema success callback
|
|
620
|
+
this.actualSchema = s;
|
|
621
|
+
if (this._isAggregationSupported && (this._groupDescriptions.size() !== 0 || this._summaryDescriptions.size() !== 0)) {
|
|
622
|
+
if (this._groupDescriptions.size() > 0) {
|
|
623
|
+
requests++;
|
|
624
|
+
this.resolveGroupInformation((g) => {
|
|
625
|
+
// group info success
|
|
626
|
+
requests--;
|
|
627
|
+
if (requests === 0) {
|
|
628
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
629
|
+
}
|
|
630
|
+
}, () => {
|
|
631
|
+
// group info failure
|
|
632
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
633
|
+
return;
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
if (this._summaryDescriptions.size() > 0) {
|
|
637
|
+
requests++;
|
|
638
|
+
this.resolveSummaryInformation((g) => {
|
|
639
|
+
// summary info success
|
|
640
|
+
requests--;
|
|
641
|
+
if (requests === 0) {
|
|
642
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
643
|
+
}
|
|
644
|
+
}, () => {
|
|
645
|
+
// summary info failure
|
|
646
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
647
|
+
return;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
653
|
+
}
|
|
654
|
+
}, () => {
|
|
655
|
+
// resolveSchema failure callback
|
|
656
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
657
|
+
return;
|
|
658
|
+
});
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
this.finishProcessingCompletedTask(task, pageIndex, schema, result);
|
|
662
|
+
}
|
|
663
|
+
finishProcessingCompletedTask(task, pageIndex, schema, result) {
|
|
664
|
+
let executionContext;
|
|
665
|
+
let pageLoaded;
|
|
666
|
+
let groupInformation;
|
|
667
|
+
let summaryInformation;
|
|
668
|
+
this.actualSchema = schema;
|
|
669
|
+
executionContext = this.executionContext;
|
|
670
|
+
groupInformation = this._groupInformation;
|
|
671
|
+
summaryInformation = this._summaryInformation;
|
|
672
|
+
pageLoaded = this.pageLoaded;
|
|
673
|
+
let page = null;
|
|
674
|
+
if (result != null) {
|
|
675
|
+
page = new ODataDataSourcePage(result, schema, groupInformation, summaryInformation, pageIndex);
|
|
676
|
+
if (!this.isLastPage(pageIndex) && page.count() > 0 && !this.populatedActualPageSize) {
|
|
677
|
+
this.populatedActualPageSize = true;
|
|
678
|
+
this.actualPageSize = page.count();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
page = new ODataDataSourcePage(null, schema, groupInformation, summaryInformation, pageIndex);
|
|
683
|
+
}
|
|
684
|
+
if (this.pageLoaded != null) {
|
|
685
|
+
if (this.executionContext != null) {
|
|
686
|
+
if (executionContext == null || pageLoaded == null) {
|
|
687
|
+
this.shutdown();
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
executionContext.execute(() => pageLoaded(page, this.actualCount, this.actualPageSize));
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
if (pageLoaded == null) {
|
|
694
|
+
this.shutdown();
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
pageLoaded(page, this.actualCount, this.actualPageSize);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
resolveGroupInformation(finishAction, failureAction) {
|
|
702
|
+
if (this._groupInformation != null) {
|
|
703
|
+
finishAction(this._groupInformation);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
let orderBy = "";
|
|
707
|
+
let groupBy = "";
|
|
708
|
+
let filter = null;
|
|
709
|
+
let summary = "";
|
|
710
|
+
if (this._groupDescriptions == null || this._groupDescriptions.size() == 0) {
|
|
711
|
+
finishAction(null);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
filter = this._filterString;
|
|
715
|
+
this.updateFilterString();
|
|
716
|
+
if (this._groupDescriptions != null) {
|
|
717
|
+
let first1 = true;
|
|
718
|
+
for (let group of this.iter(this._groupDescriptions)) {
|
|
719
|
+
if (first1) {
|
|
720
|
+
first1 = false;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
orderBy += ", ";
|
|
724
|
+
groupBy += ", ";
|
|
725
|
+
}
|
|
726
|
+
groupBy += group.propertyName;
|
|
727
|
+
if (group.direction === ListSortDirection.Descending) {
|
|
728
|
+
orderBy += group.propertyName + " desc";
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
orderBy += group.propertyName + " asc";
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
if (this._summaryScope === DataSourceSummaryScope.Both || this._summaryScope === DataSourceSummaryScope.Groups) {
|
|
736
|
+
let summaryParameters = this.getSummaryQueryParameters(true);
|
|
737
|
+
if (!stringIsNullOrEmpty(summaryParameters)) {
|
|
738
|
+
summary = ", " + summaryParameters;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
let commandText = this._entitySet + "?$orderby=" + orderBy + "&$apply=";
|
|
742
|
+
if (!stringIsNullOrEmpty(filter)) {
|
|
743
|
+
commandText += "filter(" + filter + ")/";
|
|
744
|
+
}
|
|
745
|
+
commandText += "groupby((" + groupBy + "), aggregate($count as $__count" + summary + "))";
|
|
746
|
+
try {
|
|
747
|
+
let groupInformation = [];
|
|
748
|
+
let success_ = (data, response) => this.groupSuccess(data, response, finishAction, failureAction, groupInformation);
|
|
749
|
+
let failure_ = (err) => this.groupError(err, finishAction, failureAction, groupInformation);
|
|
750
|
+
let run_ = null;
|
|
751
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
752
|
+
var request = {
|
|
753
|
+
requestUri: this._baseUri + "/" + commandText,
|
|
754
|
+
enableJsonpCallback: this._enableJsonp,
|
|
755
|
+
method: 'GET',
|
|
756
|
+
headers: headers,
|
|
757
|
+
data: null
|
|
758
|
+
};
|
|
759
|
+
run_ = function () {
|
|
760
|
+
odatajs.oData.request(request, success_, failure_);
|
|
761
|
+
};
|
|
762
|
+
run_();
|
|
763
|
+
}
|
|
764
|
+
catch (e) {
|
|
765
|
+
failureAction();
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
groupError(err, finishAction, failureAction, groupInformation) {
|
|
769
|
+
this._groupInformation = null;
|
|
770
|
+
}
|
|
771
|
+
groupSuccess(data, response, finishAction, failureAction, groupInformation) {
|
|
772
|
+
let groupNames = [];
|
|
773
|
+
for (let group of this.iter(this._groupDescriptions)) {
|
|
774
|
+
groupNames.push(group.propertyName);
|
|
775
|
+
}
|
|
776
|
+
let groupNamesArray = groupNames;
|
|
777
|
+
if (data && data.value && data.value.length > 0) {
|
|
778
|
+
let currentIndex = 0;
|
|
779
|
+
for (let i = 0; i < data.value.length; i++) {
|
|
780
|
+
this.addGroup(groupInformation, groupNames, groupNames, currentIndex, data.value[i]);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
this._groupInformation = groupInformation;
|
|
784
|
+
finishAction(this._groupInformation);
|
|
785
|
+
}
|
|
786
|
+
addGroup(groupInformation, groupNames, groupNamesArray, currentIndex, group) {
|
|
787
|
+
let groupValues = [];
|
|
788
|
+
for (let name of groupNames) {
|
|
789
|
+
if (group[name]) {
|
|
790
|
+
groupValues.push(group[name]);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
let groupCount = 0;
|
|
794
|
+
if (group["$__count"]) {
|
|
795
|
+
groupCount = Convert.toInt321(group["$__count"]);
|
|
796
|
+
}
|
|
797
|
+
let summaryResults = null;
|
|
798
|
+
if (this._summaryScope == DataSourceSummaryScope.Both || this._summaryScope == DataSourceSummaryScope.Groups) {
|
|
799
|
+
summaryResults = this.createSummaryResults(group);
|
|
800
|
+
}
|
|
801
|
+
let groupInfo = new DefaultSectionInformation(currentIndex, currentIndex + (groupCount - 1), groupNamesArray, groupValues, summaryResults);
|
|
802
|
+
groupInformation.push(groupInfo);
|
|
803
|
+
}
|
|
804
|
+
resolveSummaryInformation(finishAction, failureAction) {
|
|
805
|
+
if (this._summaryInformation != null) {
|
|
806
|
+
finishAction(this._summaryInformation);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
let filter = null;
|
|
810
|
+
let summary = null;
|
|
811
|
+
if (this._summaryDescriptions == null ||
|
|
812
|
+
this._summaryDescriptions.size() == 0 ||
|
|
813
|
+
this._summaryScope == DataSourceSummaryScope.Groups ||
|
|
814
|
+
this._summaryScope == DataSourceSummaryScope.None) {
|
|
815
|
+
finishAction(null);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
filter = this._filterString;
|
|
819
|
+
this.updateFilterString();
|
|
820
|
+
summary = this.getSummaryQueryParameters(false);
|
|
821
|
+
let commandText = this._entitySet + "?$apply=";
|
|
822
|
+
if (!stringIsNullOrEmpty(filter)) {
|
|
823
|
+
commandText += "filter(" + filter + ")/";
|
|
824
|
+
}
|
|
825
|
+
commandText += "aggregate(" + summary + ")";
|
|
826
|
+
try {
|
|
827
|
+
let summaryInformation = [];
|
|
828
|
+
let success_ = (data, response) => this.summarySuccess(data, response, finishAction, failureAction, summaryInformation);
|
|
829
|
+
let failure_ = (err) => this.summaryError(err, finishAction, failureAction, summaryInformation);
|
|
830
|
+
let run_ = null;
|
|
831
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
832
|
+
var request = {
|
|
833
|
+
requestUri: this._baseUri + "/" + commandText,
|
|
834
|
+
enableJsonpCallback: this._enableJsonp,
|
|
835
|
+
method: 'GET',
|
|
836
|
+
headers: headers,
|
|
837
|
+
data: null
|
|
838
|
+
};
|
|
839
|
+
run_ = function () {
|
|
840
|
+
odatajs.oData.request(request, success_, failure_);
|
|
841
|
+
};
|
|
842
|
+
run_();
|
|
843
|
+
}
|
|
844
|
+
catch (e) {
|
|
845
|
+
failureAction();
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
summarySuccess(data, response, finishAction, failureAction, summaryInformation) {
|
|
849
|
+
if (data && data.value && data.value.length > 0) {
|
|
850
|
+
summaryInformation = this.createSummaryResults(data.value[0]);
|
|
851
|
+
}
|
|
852
|
+
this._summaryInformation = summaryInformation;
|
|
853
|
+
finishAction(this._summaryInformation);
|
|
854
|
+
}
|
|
855
|
+
summaryError(err, finishAction, failureAction, summaryInformation) {
|
|
856
|
+
this._summaryInformation = null;
|
|
857
|
+
}
|
|
858
|
+
getSummaryQueryParameters(ignoreCount) {
|
|
859
|
+
let result = "";
|
|
860
|
+
if (this._summaryDescriptions != null) {
|
|
861
|
+
let first = true;
|
|
862
|
+
let countExists = false;
|
|
863
|
+
for (let summary of this.iterSummaries(this._summaryDescriptions)) {
|
|
864
|
+
if (summary.operand == DataSourceSummaryOperand.Count && (ignoreCount || countExists)) {
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (!first) {
|
|
868
|
+
result += ", ";
|
|
869
|
+
}
|
|
870
|
+
switch (summary.operand) {
|
|
871
|
+
case DataSourceSummaryOperand.Average:
|
|
872
|
+
result += summary.propertyName + " with average as " + summary.propertyName + "Average";
|
|
873
|
+
break;
|
|
874
|
+
case DataSourceSummaryOperand.Min:
|
|
875
|
+
result += summary.propertyName + " with min as " + summary.propertyName + "Min";
|
|
876
|
+
break;
|
|
877
|
+
case DataSourceSummaryOperand.Max:
|
|
878
|
+
result += summary.propertyName + " with max as " + summary.propertyName + "Max";
|
|
879
|
+
break;
|
|
880
|
+
case DataSourceSummaryOperand.Sum:
|
|
881
|
+
result += summary.propertyName + " with sum as " + summary.propertyName + "Sum";
|
|
882
|
+
break;
|
|
883
|
+
case DataSourceSummaryOperand.Count:
|
|
884
|
+
result += "$count as $__count";
|
|
885
|
+
countExists = true;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
first = false;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return result;
|
|
892
|
+
}
|
|
893
|
+
createSummaryResults(data) {
|
|
894
|
+
let summaryResults = [];
|
|
895
|
+
for (let summary of this.iterSummaries(this._summaryDescriptions)) {
|
|
896
|
+
let summaryName = summary.propertyName;
|
|
897
|
+
switch (summary.operand) {
|
|
898
|
+
case DataSourceSummaryOperand.Average:
|
|
899
|
+
summaryName += "Average";
|
|
900
|
+
break;
|
|
901
|
+
case DataSourceSummaryOperand.Min:
|
|
902
|
+
summaryName += "Min";
|
|
903
|
+
break;
|
|
904
|
+
case DataSourceSummaryOperand.Max:
|
|
905
|
+
summaryName += "Max";
|
|
906
|
+
break;
|
|
907
|
+
case DataSourceSummaryOperand.Sum:
|
|
908
|
+
summaryName += "Sum";
|
|
909
|
+
break;
|
|
910
|
+
case DataSourceSummaryOperand.Count:
|
|
911
|
+
summaryName = "$__count";
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
let summaryValue = null;
|
|
915
|
+
if (data && data[summaryName]) {
|
|
916
|
+
summaryValue = data[summaryName];
|
|
917
|
+
}
|
|
918
|
+
let summaryResult = new DefaultSummaryResult(summary.propertyName, summary.operand, summaryValue);
|
|
919
|
+
summaryResults.push(summaryResult);
|
|
920
|
+
}
|
|
921
|
+
return summaryResults;
|
|
922
|
+
}
|
|
923
|
+
resolveSchema(finishAction, failureAction) {
|
|
924
|
+
let success_ = (res) => {
|
|
925
|
+
let sp = new ODataSchemaProvider(res);
|
|
926
|
+
let schema = sp.getODataDataSourceSchema(this._entitySet);
|
|
927
|
+
if (this._schemaIncludedProperties != null) {
|
|
928
|
+
let propertyNames = [];
|
|
929
|
+
let propertyTypes = [];
|
|
930
|
+
for (let i = 0; i < schema.propertyNames.length; i++) {
|
|
931
|
+
if (!this._schemaIncludedProperties.has(schema.propertyNames[i])) {
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
propertyNames.push(schema.propertyNames[i]);
|
|
935
|
+
propertyTypes.push(schema.propertyTypes[i]);
|
|
936
|
+
}
|
|
937
|
+
schema = new ODataDataSourceSchema(propertyNames, propertyTypes, schema.primaryKey);
|
|
938
|
+
}
|
|
939
|
+
finishAction(schema);
|
|
940
|
+
};
|
|
941
|
+
let failure_ = () => failureAction();
|
|
942
|
+
let baseUri_ = this._baseUri;
|
|
943
|
+
var request = new XMLHttpRequest();
|
|
944
|
+
request.onreadystatechange = function () {
|
|
945
|
+
if (request.readyState === 4) {
|
|
946
|
+
if (request.status === 200) {
|
|
947
|
+
success_(request.responseText);
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
failure_();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
request.open('Get', baseUri_ + '/$metadata');
|
|
955
|
+
request.send();
|
|
956
|
+
;
|
|
957
|
+
}
|
|
958
|
+
static { this.schemaRequestIndex = -1; }
|
|
959
|
+
makeTaskForRequest(request, retryDelay) {
|
|
960
|
+
let actualPageSize = 0;
|
|
961
|
+
let sortDescriptions = null;
|
|
962
|
+
actualPageSize = this.actualPageSize;
|
|
963
|
+
sortDescriptions = this.sortDescriptions;
|
|
964
|
+
let requestUrl = this._baseUri;
|
|
965
|
+
requestUrl += "/" + this._entitySet;
|
|
966
|
+
let queryStarted = false;
|
|
967
|
+
this.updateFilterString();
|
|
968
|
+
if (this._filterString != null) {
|
|
969
|
+
if (!queryStarted) {
|
|
970
|
+
queryStarted = true;
|
|
971
|
+
requestUrl += "?";
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
requestUrl += "&";
|
|
975
|
+
}
|
|
976
|
+
requestUrl += "$filter=" + this._filterString;
|
|
977
|
+
}
|
|
978
|
+
if (this.sortDescriptions != null) {
|
|
979
|
+
let sortString = null;
|
|
980
|
+
for (let sort of this.iter(this.sortDescriptions)) {
|
|
981
|
+
if (sortString == null) {
|
|
982
|
+
sortString = "";
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
sortString += ", ";
|
|
986
|
+
}
|
|
987
|
+
if (sort.direction == ListSortDirection.Descending) {
|
|
988
|
+
sortString += sort.propertyName + " desc";
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
sortString += sort.propertyName;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
if (sortString != null) {
|
|
995
|
+
if (!queryStarted) {
|
|
996
|
+
queryStarted = true;
|
|
997
|
+
requestUrl += "?";
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
requestUrl += "&";
|
|
1001
|
+
}
|
|
1002
|
+
requestUrl += "$orderby=" + sortString;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (this.desiredProperties != null && this.desiredProperties.length > 0) {
|
|
1006
|
+
let selectString = "";
|
|
1007
|
+
let first = true;
|
|
1008
|
+
let $t = this.desiredProperties;
|
|
1009
|
+
for (let i = 0; i < $t.length; i++) {
|
|
1010
|
+
let select = $t[i];
|
|
1011
|
+
if (first) {
|
|
1012
|
+
first = false;
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
selectString += ", ";
|
|
1016
|
+
}
|
|
1017
|
+
selectString += select;
|
|
1018
|
+
}
|
|
1019
|
+
if (!queryStarted) {
|
|
1020
|
+
queryStarted = true;
|
|
1021
|
+
requestUrl += "?";
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
requestUrl += "&";
|
|
1025
|
+
}
|
|
1026
|
+
requestUrl += "$select=" + selectString;
|
|
1027
|
+
}
|
|
1028
|
+
let task = new AsyncVirtualDataTask();
|
|
1029
|
+
if (request.index == ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
1030
|
+
this.executeRequest(requestUrl, queryStarted, 0, actualPageSize, task);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
this.executeRequest(requestUrl, queryStarted, request.index * actualPageSize, actualPageSize, task);
|
|
1034
|
+
}
|
|
1035
|
+
request.taskHolder = new AsyncDataSourcePageTaskHolder();
|
|
1036
|
+
request.taskHolder.task = task;
|
|
1037
|
+
this.tasks.add(request);
|
|
1038
|
+
}
|
|
1039
|
+
updateFilterString() {
|
|
1040
|
+
if (this.filterExpressions != null && this.filterExpressions.size() > 0 && this._filterString == null) {
|
|
1041
|
+
let sb = "";
|
|
1042
|
+
let first = true;
|
|
1043
|
+
for (let expr of this.iterFilter(this.filterExpressions)) {
|
|
1044
|
+
if (first) {
|
|
1045
|
+
first = false;
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
sb += " AND ";
|
|
1049
|
+
}
|
|
1050
|
+
let visitor = new ODataDataSourceFilterExpressionVisitor(0);
|
|
1051
|
+
visitor.visit(expr);
|
|
1052
|
+
let txt = visitor.toString();
|
|
1053
|
+
if (this.filterExpressions.size() > 1) {
|
|
1054
|
+
txt = "(" + txt + ")";
|
|
1055
|
+
}
|
|
1056
|
+
sb += (txt);
|
|
1057
|
+
}
|
|
1058
|
+
this._filterString = sb;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
executeRequest(requestUrl, queryStarted, skip, top, task) {
|
|
1062
|
+
if (!queryStarted) {
|
|
1063
|
+
queryStarted = true;
|
|
1064
|
+
requestUrl += "?";
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
requestUrl += "&";
|
|
1068
|
+
}
|
|
1069
|
+
requestUrl += "$skip=" + skip + "&$top=" + top + "&$count=true";
|
|
1070
|
+
let requestUrl_ = requestUrl;
|
|
1071
|
+
let self_ = this;
|
|
1072
|
+
let success_ = (data, response) => this.success(task, data, response);
|
|
1073
|
+
let failure_ = (err) => this.error(task, err);
|
|
1074
|
+
let run_ = null;
|
|
1075
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
1076
|
+
var request = {
|
|
1077
|
+
requestUri: requestUrl_,
|
|
1078
|
+
enableJsonpCallback: this._enableJsonp,
|
|
1079
|
+
method: 'GET',
|
|
1080
|
+
headers: headers,
|
|
1081
|
+
data: null
|
|
1082
|
+
};
|
|
1083
|
+
run_ = function () {
|
|
1084
|
+
odatajs.oData.request(request, success_, failure_);
|
|
1085
|
+
};
|
|
1086
|
+
task.run = run_;
|
|
1087
|
+
}
|
|
1088
|
+
success(t, data, response) {
|
|
1089
|
+
t.result = data;
|
|
1090
|
+
t.isCompleted = true;
|
|
1091
|
+
}
|
|
1092
|
+
error(t, result) {
|
|
1093
|
+
t.isCompleted = true;
|
|
1094
|
+
t.hasErrors = true;
|
|
1095
|
+
}
|
|
1096
|
+
createBatchRequest(changes) {
|
|
1097
|
+
const requests = [];
|
|
1098
|
+
for (let i = 0; i < changes.length; i++) {
|
|
1099
|
+
let c = changes[i];
|
|
1100
|
+
const headers = { "Content-Type": "application/json", "odata-version": "4.0" };
|
|
1101
|
+
if (c.transactionType === TransactionType.Add) {
|
|
1102
|
+
requests.push({
|
|
1103
|
+
method: "POST",
|
|
1104
|
+
id: `r${i}`,
|
|
1105
|
+
atomicityGroup: "g1",
|
|
1106
|
+
url: `${this._baseUri}/${this._entitySet}`,
|
|
1107
|
+
headers: headers,
|
|
1108
|
+
body: c.value,
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
else if (c.transactionType === TransactionType.Update) {
|
|
1112
|
+
if (c.version) {
|
|
1113
|
+
headers["If-Match"] = c.version;
|
|
1114
|
+
}
|
|
1115
|
+
requests.push({
|
|
1116
|
+
method: "PATCH",
|
|
1117
|
+
id: `r${i}`,
|
|
1118
|
+
atomicityGroup: "g1",
|
|
1119
|
+
url: `${this._baseUri}/${this.getRequestUriWithKey(c.id)}`,
|
|
1120
|
+
headers: headers,
|
|
1121
|
+
body: c.value,
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
else if (c.transactionType === TransactionType.Delete) {
|
|
1125
|
+
if (c.version) {
|
|
1126
|
+
headers["If-Match"] = c.version;
|
|
1127
|
+
}
|
|
1128
|
+
requests.push({
|
|
1129
|
+
method: "DELETE",
|
|
1130
|
+
id: `r${i}`,
|
|
1131
|
+
atomicityGroup: "g1",
|
|
1132
|
+
url: `${this._baseUri}/${this.getRequestUriWithKey(c.id)}`,
|
|
1133
|
+
headers: headers,
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
let request = {
|
|
1138
|
+
requestUri: `${this._baseUri}/$batch`,
|
|
1139
|
+
method: "POST",
|
|
1140
|
+
headers: { "Content-Type": "application/json" },
|
|
1141
|
+
body: JSON.stringify({ requests: requests })
|
|
1142
|
+
};
|
|
1143
|
+
let self = this;
|
|
1144
|
+
odatajs.oData.request(request, function (data) {
|
|
1145
|
+
if (data && data.responses) {
|
|
1146
|
+
if (data.responses.length > 0) {
|
|
1147
|
+
let success = true;
|
|
1148
|
+
let messages = [];
|
|
1149
|
+
for (let i = 0; i < data.responses.length; i++) {
|
|
1150
|
+
if (data.responses[i].status !== 200 &&
|
|
1151
|
+
data.responses[i].status !== 204) {
|
|
1152
|
+
success = false;
|
|
1153
|
+
let failedRequest = requests.filter(r => r.id == data.responses[i].id)[0];
|
|
1154
|
+
if (failedRequest) {
|
|
1155
|
+
let msg = `${failedRequest.method} request failed with code ${data.responses[i].status}`;
|
|
1156
|
+
messages.push(msg);
|
|
1157
|
+
console.error(msg);
|
|
1158
|
+
}
|
|
1159
|
+
break;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (success) {
|
|
1163
|
+
self.batchCompleted(true, true, null);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
self.batchCompleted(false, true, messages);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
self.batchCompleted(false, true, null);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}, function (error) {
|
|
1174
|
+
const messages = [];
|
|
1175
|
+
if (error && error.message) {
|
|
1176
|
+
messages.push(error.message);
|
|
1177
|
+
}
|
|
1178
|
+
self.batchCompleted(false, true, messages);
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
getRequestUriWithKey(key) {
|
|
1182
|
+
let result = "";
|
|
1183
|
+
const keys = Object.keys(key);
|
|
1184
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1185
|
+
if (i > 0) {
|
|
1186
|
+
result += ",";
|
|
1187
|
+
}
|
|
1188
|
+
result += `${keys[i]}=${key[keys[i]]}`;
|
|
1189
|
+
}
|
|
1190
|
+
return `${this._entitySet}(${result})`;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
class ODataVirtualDataSourceDataProviderWorkerSettings extends AsyncVirtualDataSourceDataProviderWorkerSettings {
|
|
1195
|
+
constructor() {
|
|
1196
|
+
super(...arguments);
|
|
1197
|
+
this._baseUri = null;
|
|
1198
|
+
this._entitySet = null;
|
|
1199
|
+
this._sortDescriptions = null;
|
|
1200
|
+
this._filterExpressions = null;
|
|
1201
|
+
this._propertiesRequested = null;
|
|
1202
|
+
this._schemaIncludedProperties = null;
|
|
1203
|
+
this._groupDescriptions = null;
|
|
1204
|
+
this._summaryDescriptions = null;
|
|
1205
|
+
}
|
|
1206
|
+
static { this.$t = markType(ODataVirtualDataSourceDataProviderWorkerSettings, 'ODataVirtualDataSourceDataProviderWorkerSettings', AsyncVirtualDataSourceDataProviderWorkerSettings.$type); }
|
|
1207
|
+
get baseUri() {
|
|
1208
|
+
return this._baseUri;
|
|
1209
|
+
}
|
|
1210
|
+
set baseUri(value) {
|
|
1211
|
+
this._baseUri = value;
|
|
1212
|
+
}
|
|
1213
|
+
get entitySet() {
|
|
1214
|
+
return this._entitySet;
|
|
1215
|
+
}
|
|
1216
|
+
set entitySet(value) {
|
|
1217
|
+
this._entitySet = value;
|
|
1218
|
+
}
|
|
1219
|
+
get sortDescriptions() {
|
|
1220
|
+
return this._sortDescriptions;
|
|
1221
|
+
}
|
|
1222
|
+
set sortDescriptions(value) {
|
|
1223
|
+
this._sortDescriptions = value;
|
|
1224
|
+
}
|
|
1225
|
+
get filterExpressions() {
|
|
1226
|
+
return this._filterExpressions;
|
|
1227
|
+
}
|
|
1228
|
+
set filterExpressions(value) {
|
|
1229
|
+
this._filterExpressions = value;
|
|
1230
|
+
}
|
|
1231
|
+
get propertiesRequested() {
|
|
1232
|
+
return this._propertiesRequested;
|
|
1233
|
+
}
|
|
1234
|
+
set propertiesRequested(value) {
|
|
1235
|
+
this._propertiesRequested = value;
|
|
1236
|
+
}
|
|
1237
|
+
get schemaIncludedProperties() {
|
|
1238
|
+
return this._schemaIncludedProperties;
|
|
1239
|
+
}
|
|
1240
|
+
set schemaIncludedProperties(value) {
|
|
1241
|
+
this._schemaIncludedProperties = value;
|
|
1242
|
+
}
|
|
1243
|
+
get groupDescriptions() {
|
|
1244
|
+
return this._groupDescriptions;
|
|
1245
|
+
}
|
|
1246
|
+
set groupDescriptions(value) {
|
|
1247
|
+
this._groupDescriptions = value;
|
|
1248
|
+
}
|
|
1249
|
+
get summaryDescriptions() {
|
|
1250
|
+
return this._summaryDescriptions;
|
|
1251
|
+
}
|
|
1252
|
+
set summaryDescriptions(value) {
|
|
1253
|
+
this._summaryDescriptions = value;
|
|
1254
|
+
}
|
|
1255
|
+
get summaryScope() {
|
|
1256
|
+
return this._summaryscope;
|
|
1257
|
+
}
|
|
1258
|
+
set summaryScope(value) {
|
|
1259
|
+
this._summaryscope = value;
|
|
1260
|
+
}
|
|
1261
|
+
get enableJsonp() {
|
|
1262
|
+
return this._enableJsonp;
|
|
1263
|
+
}
|
|
1264
|
+
set enableJsonp(isEnabled) {
|
|
1265
|
+
this._enableJsonp = isEnabled;
|
|
1266
|
+
}
|
|
1267
|
+
get isAggregationSupported() {
|
|
1268
|
+
return this._isAggregationSupported;
|
|
1269
|
+
}
|
|
1270
|
+
set isAggregationSupported(isSupported) {
|
|
1271
|
+
this._isAggregationSupported = isSupported;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
class ODataVirtualDataSourceDataProvider extends Base {
|
|
1276
|
+
static { this.$t = markType(ODataVirtualDataSourceDataProvider, 'ODataVirtualDataSourceDataProvider', Base.$type, [IDataSourceVirtualDataProvider_$type]); }
|
|
1277
|
+
constructor() {
|
|
1278
|
+
super();
|
|
1279
|
+
this._worker = null;
|
|
1280
|
+
this._requests = new LinkedList();
|
|
1281
|
+
this._callback = null;
|
|
1282
|
+
this._pageLoaded = null;
|
|
1283
|
+
this._pageSizeRequested = 50;
|
|
1284
|
+
this._baseUri = null;
|
|
1285
|
+
this._entitySet = null;
|
|
1286
|
+
this._timeoutMilliseconds = 10000;
|
|
1287
|
+
this.schemaChanged = null;
|
|
1288
|
+
this._currentFullCount = 0;
|
|
1289
|
+
this._currentSchema = null;
|
|
1290
|
+
this._executionContext = null;
|
|
1291
|
+
this._updateNotifier = null;
|
|
1292
|
+
this._deferAutoRefresh = false;
|
|
1293
|
+
this._sortDescriptions = null;
|
|
1294
|
+
this._groupDescriptions = null;
|
|
1295
|
+
this._propertiesRequested = null;
|
|
1296
|
+
this._schemaIncludedProperties = null;
|
|
1297
|
+
this._filterExpressions = null;
|
|
1298
|
+
this._summaryDescriptions = null;
|
|
1299
|
+
this._enableJsonp = true;
|
|
1300
|
+
this._schemaFetchQueued = false;
|
|
1301
|
+
this._autoRefreshQueued = false;
|
|
1302
|
+
this._batchCompleted = null;
|
|
1303
|
+
this._sortDescriptions = new SortDescriptionCollection();
|
|
1304
|
+
this._sortDescriptions.onChanged = () => this.sortDescriptions_CollectionChanged(null, null);
|
|
1305
|
+
this._groupDescriptions = new SortDescriptionCollection();
|
|
1306
|
+
this._groupDescriptions.onChanged = () => this.groupDescriptions_CollectionChanged(null, null);
|
|
1307
|
+
this._filterExpressions = new FilterExpressionCollection();
|
|
1308
|
+
this._filterExpressions.onChanged = () => this.filterExpressions_CollectionChanged(null, null);
|
|
1309
|
+
this._summaryDescriptions = new SummaryDescriptionCollection();
|
|
1310
|
+
this._summaryDescriptions.onChanged = () => this.summaryDescriptions_CollectionChanged(null, null);
|
|
1311
|
+
}
|
|
1312
|
+
filterExpressions_CollectionChanged(sender, e) {
|
|
1313
|
+
this.queueAutoRefresh();
|
|
1314
|
+
}
|
|
1315
|
+
sortDescriptions_CollectionChanged(sender, e) {
|
|
1316
|
+
this.queueAutoRefresh();
|
|
1317
|
+
}
|
|
1318
|
+
groupDescriptions_CollectionChanged(sender, e) {
|
|
1319
|
+
this.queueAutoRefresh();
|
|
1320
|
+
}
|
|
1321
|
+
summaryDescriptions_CollectionChanged(sender, e) {
|
|
1322
|
+
this.queueAutoRefresh();
|
|
1323
|
+
}
|
|
1324
|
+
addPageRequest(pageIndex, priority) {
|
|
1325
|
+
if (this.deferAutoRefresh) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
if (this._worker != null && this._worker.isShutdown) {
|
|
1329
|
+
this._worker = null;
|
|
1330
|
+
this._callback = null;
|
|
1331
|
+
}
|
|
1332
|
+
if (this._worker == null) {
|
|
1333
|
+
this.createWorker();
|
|
1334
|
+
}
|
|
1335
|
+
if (priority == DataSourcePageRequestPriority.High) {
|
|
1336
|
+
this._requests.addFirst(pageIndex);
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
this._requests.addLast(pageIndex);
|
|
1340
|
+
}
|
|
1341
|
+
if (!this._worker.addPageRequest(pageIndex, priority)) {
|
|
1342
|
+
this._worker = null;
|
|
1343
|
+
this._callback = null;
|
|
1344
|
+
this.addPageRequest(pageIndex, priority);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
createWorker() {
|
|
1348
|
+
if (!this.valid()) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
this._callback = runOn(this, this.raisePageLoaded);
|
|
1352
|
+
let settings = this.getWorkerSettings();
|
|
1353
|
+
this._worker = new ODataVirtualDataSourceDataProviderWorker(settings);
|
|
1354
|
+
}
|
|
1355
|
+
valid() {
|
|
1356
|
+
return this.entitySet != null && this.baseUri != null;
|
|
1357
|
+
}
|
|
1358
|
+
getWorkerSettings() {
|
|
1359
|
+
return ((() => {
|
|
1360
|
+
let $ret = new ODataVirtualDataSourceDataProviderWorkerSettings();
|
|
1361
|
+
$ret.baseUri = this._baseUri;
|
|
1362
|
+
$ret.entitySet = this._entitySet;
|
|
1363
|
+
$ret.pageSizeRequested = this._pageSizeRequested;
|
|
1364
|
+
$ret.timeoutMilliseconds = this._timeoutMilliseconds;
|
|
1365
|
+
$ret.pageLoaded = this._callback;
|
|
1366
|
+
$ret.batchCompleted = this._batchCompleted;
|
|
1367
|
+
$ret.executionContext = this._executionContext;
|
|
1368
|
+
$ret.sortDescriptions = this._sortDescriptions;
|
|
1369
|
+
$ret.groupDescriptions = this._groupDescriptions;
|
|
1370
|
+
$ret.filterExpressions = this._filterExpressions;
|
|
1371
|
+
$ret.propertiesRequested = this._propertiesRequested;
|
|
1372
|
+
$ret.schemaIncludedProperties = this._schemaIncludedProperties;
|
|
1373
|
+
$ret.summaryDescriptions = this._summaryDescriptions;
|
|
1374
|
+
$ret.summaryScope = this._summaryScope;
|
|
1375
|
+
$ret.enableJsonp = this._enableJsonp;
|
|
1376
|
+
$ret.isAggregationSupported = this.isAggregationSupported;
|
|
1377
|
+
return $ret;
|
|
1378
|
+
})());
|
|
1379
|
+
}
|
|
1380
|
+
removePageRequest(pageIndex) {
|
|
1381
|
+
let current = this._requests.first;
|
|
1382
|
+
while (current != null) {
|
|
1383
|
+
if (current.value == pageIndex) {
|
|
1384
|
+
this._requests.remove(current);
|
|
1385
|
+
}
|
|
1386
|
+
current = current.next;
|
|
1387
|
+
}
|
|
1388
|
+
if (this._worker == null) {
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
this._worker.removePageRequest(pageIndex);
|
|
1392
|
+
}
|
|
1393
|
+
removeAllPageRequests() {
|
|
1394
|
+
this._requests.clear();
|
|
1395
|
+
if (this._worker == null) {
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
this._worker.removeAllPageRequests();
|
|
1399
|
+
}
|
|
1400
|
+
close() {
|
|
1401
|
+
if (this._worker != null) {
|
|
1402
|
+
this._worker.shutdown();
|
|
1403
|
+
this._worker = null;
|
|
1404
|
+
this._callback = null;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
get pageLoaded() {
|
|
1408
|
+
return this._pageLoaded;
|
|
1409
|
+
}
|
|
1410
|
+
set pageLoaded(value) {
|
|
1411
|
+
this._pageLoaded = value;
|
|
1412
|
+
this.queueAutoRefresh();
|
|
1413
|
+
}
|
|
1414
|
+
raisePageLoaded(page, fullCount, actualPageSize) {
|
|
1415
|
+
if (this._pageLoaded != null) {
|
|
1416
|
+
this._currentFullCount = fullCount;
|
|
1417
|
+
if (this._currentSchema == null) {
|
|
1418
|
+
let currentSchema = null;
|
|
1419
|
+
if (page != null) {
|
|
1420
|
+
currentSchema = page.schema();
|
|
1421
|
+
}
|
|
1422
|
+
this._currentSchema = currentSchema;
|
|
1423
|
+
if (this.schemaChanged != null) {
|
|
1424
|
+
this.schemaChanged(this, new DataSourceDataProviderSchemaChangedEventArgs(this._currentSchema, this._currentFullCount));
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
if (page.pageIndex() != ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
1428
|
+
this._pageLoaded(page, fullCount, actualPageSize);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
killWorker() {
|
|
1433
|
+
if (this._worker != null) {
|
|
1434
|
+
this._worker.shutdown();
|
|
1435
|
+
this._worker = null;
|
|
1436
|
+
this._callback = null;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
get pageSizeRequested() {
|
|
1440
|
+
return this._pageSizeRequested;
|
|
1441
|
+
}
|
|
1442
|
+
set pageSizeRequested(value) {
|
|
1443
|
+
this._pageSizeRequested = value;
|
|
1444
|
+
this.queueAutoRefresh();
|
|
1445
|
+
}
|
|
1446
|
+
get baseUri() {
|
|
1447
|
+
return this._baseUri;
|
|
1448
|
+
}
|
|
1449
|
+
set baseUri(value) {
|
|
1450
|
+
let oldValue = this._baseUri;
|
|
1451
|
+
this._baseUri = value;
|
|
1452
|
+
if (oldValue != this._baseUri) {
|
|
1453
|
+
this.queueAutoRefresh();
|
|
1454
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
1455
|
+
this.queueSchemaFetch();
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
get entitySet() {
|
|
1460
|
+
return this._entitySet;
|
|
1461
|
+
}
|
|
1462
|
+
set entitySet(value) {
|
|
1463
|
+
let oldValue = this._entitySet;
|
|
1464
|
+
this._entitySet = value;
|
|
1465
|
+
if (oldValue != this._entitySet) {
|
|
1466
|
+
this.queueAutoRefresh();
|
|
1467
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
1468
|
+
this.queueSchemaFetch();
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
get timeoutMilliseconds() {
|
|
1473
|
+
return this._timeoutMilliseconds;
|
|
1474
|
+
}
|
|
1475
|
+
set timeoutMilliseconds(value) {
|
|
1476
|
+
this._timeoutMilliseconds = value;
|
|
1477
|
+
this.queueAutoRefresh();
|
|
1478
|
+
}
|
|
1479
|
+
getItemValue(item, valueName) {
|
|
1480
|
+
let dic = item;
|
|
1481
|
+
if (dic.has(valueName)) {
|
|
1482
|
+
return dic.get(valueName);
|
|
1483
|
+
}
|
|
1484
|
+
else {
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
setItemValue(item, valueName, value) {
|
|
1489
|
+
// does nothing for virtual data.
|
|
1490
|
+
}
|
|
1491
|
+
removeItem(item) {
|
|
1492
|
+
// does nothing for virtual data.
|
|
1493
|
+
}
|
|
1494
|
+
addItem(item) {
|
|
1495
|
+
// does nothing for virtual data.
|
|
1496
|
+
}
|
|
1497
|
+
get actualCount() {
|
|
1498
|
+
return this._currentFullCount;
|
|
1499
|
+
}
|
|
1500
|
+
get actualSchema() {
|
|
1501
|
+
return this._currentSchema;
|
|
1502
|
+
}
|
|
1503
|
+
get executionContext() {
|
|
1504
|
+
return this._executionContext;
|
|
1505
|
+
}
|
|
1506
|
+
set executionContext(value) {
|
|
1507
|
+
this._executionContext = value;
|
|
1508
|
+
this.queueAutoRefresh();
|
|
1509
|
+
}
|
|
1510
|
+
get updateNotifier() {
|
|
1511
|
+
return this._updateNotifier;
|
|
1512
|
+
}
|
|
1513
|
+
set updateNotifier(value) {
|
|
1514
|
+
this._updateNotifier = value;
|
|
1515
|
+
}
|
|
1516
|
+
get deferAutoRefresh() {
|
|
1517
|
+
return this._deferAutoRefresh;
|
|
1518
|
+
}
|
|
1519
|
+
set deferAutoRefresh(value) {
|
|
1520
|
+
this._deferAutoRefresh = value;
|
|
1521
|
+
if (!this._deferAutoRefresh) {
|
|
1522
|
+
this.queueAutoRefresh();
|
|
1523
|
+
}
|
|
1524
|
+
if (this._deferAutoRefresh && this.valid() && this._currentSchema == null) {
|
|
1525
|
+
this.queueSchemaFetch();
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
get isSortingSupported() {
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1531
|
+
get isGroupingSupported() {
|
|
1532
|
+
return this.isAggregationSupported;
|
|
1533
|
+
}
|
|
1534
|
+
get isFilteringSupported() {
|
|
1535
|
+
return true;
|
|
1536
|
+
}
|
|
1537
|
+
get isAggregationSupported() {
|
|
1538
|
+
return this._isAggregationSupported;
|
|
1539
|
+
}
|
|
1540
|
+
set isAggregationSupported(isSupported) {
|
|
1541
|
+
this._isAggregationSupported = isSupported;
|
|
1542
|
+
}
|
|
1543
|
+
get sortDescriptions() {
|
|
1544
|
+
return this._sortDescriptions;
|
|
1545
|
+
}
|
|
1546
|
+
get groupDescriptions() {
|
|
1547
|
+
return this._groupDescriptions;
|
|
1548
|
+
}
|
|
1549
|
+
get propertiesRequested() {
|
|
1550
|
+
return this._propertiesRequested;
|
|
1551
|
+
}
|
|
1552
|
+
set propertiesRequested(value) {
|
|
1553
|
+
this._propertiesRequested = value;
|
|
1554
|
+
this.queueAutoRefresh();
|
|
1555
|
+
}
|
|
1556
|
+
get schemaIncludedProperties() {
|
|
1557
|
+
return this._schemaIncludedProperties;
|
|
1558
|
+
}
|
|
1559
|
+
set schemaIncludedProperties(value) {
|
|
1560
|
+
this._schemaIncludedProperties = value;
|
|
1561
|
+
this.queueAutoRefresh();
|
|
1562
|
+
}
|
|
1563
|
+
get filterExpressions() {
|
|
1564
|
+
return this._filterExpressions;
|
|
1565
|
+
}
|
|
1566
|
+
get summaryDescriptions() {
|
|
1567
|
+
return this._summaryDescriptions;
|
|
1568
|
+
}
|
|
1569
|
+
get summaryScope() {
|
|
1570
|
+
return this._summaryScope;
|
|
1571
|
+
}
|
|
1572
|
+
set summaryScope(value) {
|
|
1573
|
+
this._summaryScope = value;
|
|
1574
|
+
}
|
|
1575
|
+
get enableJsonp() {
|
|
1576
|
+
return this._enableJsonp;
|
|
1577
|
+
}
|
|
1578
|
+
set enableJsonp(isEnabled) {
|
|
1579
|
+
this._enableJsonp = isEnabled;
|
|
1580
|
+
}
|
|
1581
|
+
get notifyUsingSourceIndexes() {
|
|
1582
|
+
return true;
|
|
1583
|
+
}
|
|
1584
|
+
get isItemIndexLookupSupported() {
|
|
1585
|
+
return false;
|
|
1586
|
+
}
|
|
1587
|
+
get isKeyIndexLookupSupported() {
|
|
1588
|
+
return false;
|
|
1589
|
+
}
|
|
1590
|
+
notifySetItem(index, oldItem, newItem) {
|
|
1591
|
+
if (this.updateNotifier != null) {
|
|
1592
|
+
this.updateNotifier.notifySetItem(index, oldItem, newItem);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
notifyClearItems() {
|
|
1596
|
+
if (this.updateNotifier != null) {
|
|
1597
|
+
this.updateNotifier.notifyClearItems();
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
notifyInsertItem(index, newItem) {
|
|
1601
|
+
if (this.updateNotifier != null) {
|
|
1602
|
+
this.updateNotifier.notifyInsertItem(index, newItem);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
notifyRemoveItem(index, oldItem) {
|
|
1606
|
+
if (this.updateNotifier != null) {
|
|
1607
|
+
this.updateNotifier.notifyRemoveItem(index, oldItem);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
queueSchemaFetch() {
|
|
1611
|
+
if (this._schemaFetchQueued) {
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
if (this.executionContext != null) {
|
|
1615
|
+
this._schemaFetchQueued = true;
|
|
1616
|
+
this.executionContext.enqueueAction(runOn(this, this.doSchemaFetchInternal));
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
doSchemaFetchInternal() {
|
|
1620
|
+
if (!this._schemaFetchQueued) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
this._schemaFetchQueued = false;
|
|
1624
|
+
this.schemaFetchInternal();
|
|
1625
|
+
}
|
|
1626
|
+
schemaFetchInternal() {
|
|
1627
|
+
this.schemaFetchInternalOverride();
|
|
1628
|
+
}
|
|
1629
|
+
schemaFetchInternalOverride() {
|
|
1630
|
+
if (!this.deferAutoRefresh) {
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
this.removeAllPageRequests();
|
|
1634
|
+
this.killWorker();
|
|
1635
|
+
this.createWorker();
|
|
1636
|
+
this.addSchemaRequest();
|
|
1637
|
+
}
|
|
1638
|
+
addSchemaRequest() {
|
|
1639
|
+
this._worker.addPageRequest(ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex, DataSourcePageRequestPriority.High);
|
|
1640
|
+
}
|
|
1641
|
+
queueAutoRefresh() {
|
|
1642
|
+
if (this.deferAutoRefresh) {
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
if (this._autoRefreshQueued) {
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
if (this.executionContext != null) {
|
|
1649
|
+
this._autoRefreshQueued = true;
|
|
1650
|
+
this.executionContext.enqueueAction(runOn(this, this.doRefreshInternal));
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
doRefreshInternal() {
|
|
1654
|
+
if (this.deferAutoRefresh) {
|
|
1655
|
+
this._autoRefreshQueued = false;
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
if (!this._autoRefreshQueued) {
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
this._autoRefreshQueued = false;
|
|
1662
|
+
this.refreshInternal();
|
|
1663
|
+
}
|
|
1664
|
+
refreshInternal() {
|
|
1665
|
+
this.refreshInternalOverride();
|
|
1666
|
+
}
|
|
1667
|
+
refreshInternalOverride() {
|
|
1668
|
+
this.removeAllPageRequests();
|
|
1669
|
+
this.killWorker();
|
|
1670
|
+
this.createWorker();
|
|
1671
|
+
this._worker.addPageRequest(0, DataSourcePageRequestPriority.Normal);
|
|
1672
|
+
}
|
|
1673
|
+
flushAutoRefresh() {
|
|
1674
|
+
this.doRefreshInternal();
|
|
1675
|
+
}
|
|
1676
|
+
refresh() {
|
|
1677
|
+
this.refreshInternal();
|
|
1678
|
+
}
|
|
1679
|
+
indexOfItem(item) {
|
|
1680
|
+
return -1;
|
|
1681
|
+
}
|
|
1682
|
+
indexOfKey(key) {
|
|
1683
|
+
return -1;
|
|
1684
|
+
}
|
|
1685
|
+
resolveSchemaPropertyType(propertyPath) {
|
|
1686
|
+
if (this.actualSchema == null) {
|
|
1687
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
1688
|
+
}
|
|
1689
|
+
if (stringContains(propertyPath, ".")) {
|
|
1690
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
1691
|
+
}
|
|
1692
|
+
for (let i = 0; i < this.actualSchema.propertyNames.length; i++) {
|
|
1693
|
+
let name = this.actualSchema.propertyNames[i];
|
|
1694
|
+
if (name == propertyPath) {
|
|
1695
|
+
return this.actualSchema.propertyTypes[i];
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
1699
|
+
}
|
|
1700
|
+
createBatchRequest(changes) {
|
|
1701
|
+
if (this._worker) {
|
|
1702
|
+
this._worker.createBatchRequest(changes);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
get batchCompleted() {
|
|
1706
|
+
return this._batchCompleted;
|
|
1707
|
+
}
|
|
1708
|
+
set batchCompleted(value) {
|
|
1709
|
+
this._batchCompleted = value;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
class ODataVirtualDataSource extends VirtualDataSource {
|
|
1714
|
+
constructor() {
|
|
1715
|
+
super();
|
|
1716
|
+
this._baseUri = null;
|
|
1717
|
+
this._entitySet = null;
|
|
1718
|
+
this._timeoutMilliseconds = 10000;
|
|
1719
|
+
this._isAggregationSupportedByServer = false;
|
|
1720
|
+
this._enableJsonp = true;
|
|
1721
|
+
this.dataProvider = ((() => {
|
|
1722
|
+
let $ret = new ODataVirtualDataSourceDataProvider();
|
|
1723
|
+
$ret.executionContext = this.executionContext;
|
|
1724
|
+
$ret.enableJsonp = this.enableJsonp;
|
|
1725
|
+
$ret.isAggregationSupported = this.isGroupingSupported;
|
|
1726
|
+
return $ret;
|
|
1727
|
+
})());
|
|
1728
|
+
this.externalDataSource = this;
|
|
1729
|
+
}
|
|
1730
|
+
onBaseUriChanged(oldValue, newValue) {
|
|
1731
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
1732
|
+
this.actualDataProvider.baseUri = this.baseUri;
|
|
1733
|
+
}
|
|
1734
|
+
this.queueAutoRefresh();
|
|
1735
|
+
}
|
|
1736
|
+
get baseUri() {
|
|
1737
|
+
return this._baseUri;
|
|
1738
|
+
}
|
|
1739
|
+
set baseUri(value) {
|
|
1740
|
+
let oldValue = this._baseUri;
|
|
1741
|
+
this._baseUri = value;
|
|
1742
|
+
if (oldValue != this._baseUri) {
|
|
1743
|
+
this.onBaseUriChanged(oldValue, this._baseUri);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
onEntitySetChanged(oldValue, newValue) {
|
|
1747
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
1748
|
+
this.actualDataProvider.entitySet = this.entitySet;
|
|
1749
|
+
}
|
|
1750
|
+
this.queueAutoRefresh();
|
|
1751
|
+
}
|
|
1752
|
+
get entitySet() {
|
|
1753
|
+
return this._entitySet;
|
|
1754
|
+
}
|
|
1755
|
+
set entitySet(value) {
|
|
1756
|
+
let oldValue = this._entitySet;
|
|
1757
|
+
this._entitySet = value;
|
|
1758
|
+
if (this._entitySet != oldValue) {
|
|
1759
|
+
this.onEntitySetChanged(oldValue, this._entitySet);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
onTimeoutMillisecondsChanged(oldValue, newValue) {
|
|
1763
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
1764
|
+
this.actualDataProvider.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
get timeoutMilliseconds() {
|
|
1768
|
+
return this._timeoutMilliseconds;
|
|
1769
|
+
}
|
|
1770
|
+
set timeoutMilliseconds(value) {
|
|
1771
|
+
let oldValue = this._timeoutMilliseconds;
|
|
1772
|
+
this._timeoutMilliseconds = value;
|
|
1773
|
+
if (oldValue != this._timeoutMilliseconds) {
|
|
1774
|
+
this.onTimeoutMillisecondsChanged(oldValue, this._timeoutMilliseconds);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
get isSortingSupportedOverride() {
|
|
1778
|
+
return true;
|
|
1779
|
+
}
|
|
1780
|
+
get isFilteringSupportedOverride() {
|
|
1781
|
+
return true;
|
|
1782
|
+
}
|
|
1783
|
+
get isGroupingSupportedOverride() {
|
|
1784
|
+
return this.isAggregationSupportedByServer;
|
|
1785
|
+
}
|
|
1786
|
+
get isAggregationSupportedByServer() {
|
|
1787
|
+
return this._isAggregationSupportedByServer;
|
|
1788
|
+
}
|
|
1789
|
+
set isAggregationSupportedByServer(isSupported) {
|
|
1790
|
+
this._isAggregationSupportedByServer = isSupported;
|
|
1791
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
1792
|
+
this.actualDataProvider.isAggregationSupported = isSupported;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
get enableJsonp() {
|
|
1796
|
+
return this._enableJsonp;
|
|
1797
|
+
}
|
|
1798
|
+
set enableJsonp(isEnabled) {
|
|
1799
|
+
this._enableJsonp = isEnabled;
|
|
1800
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
1801
|
+
this.actualDataProvider.enableJsonp = isEnabled;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
clone() {
|
|
1805
|
+
let dataSource = new ODataVirtualDataSource();
|
|
1806
|
+
dataSource.executionContext = this.executionContext;
|
|
1807
|
+
dataSource.includeSummaryRowsInSection = this.includeSummaryRowsInSection;
|
|
1808
|
+
dataSource.isSectionCollapsable = this.isSectionCollapsable;
|
|
1809
|
+
dataSource.isSectionExpandedDefault = this.isSectionExpandedDefault;
|
|
1810
|
+
//dataSource.isSectionHeaderNormalRow = this.isSectionHeaderNormalRow;
|
|
1811
|
+
dataSource.isSectionSummaryRowsAtBottom = this.isSectionSummaryRowsAtBottom;
|
|
1812
|
+
//dataSource.isSectionContentVisible = this.isSectionContentVisible;
|
|
1813
|
+
dataSource.primaryKey = this.primaryKey;
|
|
1814
|
+
dataSource.propertiesRequested = this.propertiesRequested;
|
|
1815
|
+
dataSource.sectionHeaderDisplayMode = this.sectionHeaderDisplayMode;
|
|
1816
|
+
dataSource.shouldEmitSectionFooters = this.shouldEmitSectionFooters;
|
|
1817
|
+
dataSource.shouldEmitSectionHeaders = this.shouldEmitSectionHeaders;
|
|
1818
|
+
dataSource.shouldEmitShiftedRows = this.shouldEmitShiftedRows;
|
|
1819
|
+
dataSource.summaryScope = this.summaryScope;
|
|
1820
|
+
for (var i = 0; i < this.groupDescriptions.size(); i++) {
|
|
1821
|
+
dataSource.groupDescriptions.add(this.groupDescriptions.get(i));
|
|
1822
|
+
}
|
|
1823
|
+
for (var i = 0; i < this.sortDescriptions.size(); i++) {
|
|
1824
|
+
dataSource.sortDescriptions.add(this.sortDescriptions.get(i));
|
|
1825
|
+
}
|
|
1826
|
+
for (var i = 0; i < this.filterExpressions.size(); i++) {
|
|
1827
|
+
dataSource.filterExpressions.add(this.filterExpressions.get(i));
|
|
1828
|
+
}
|
|
1829
|
+
for (var i = 0; i < this.summaryDescriptions.size(); i++) {
|
|
1830
|
+
dataSource.summaryDescriptions.add(this.summaryDescriptions.get(i));
|
|
1831
|
+
}
|
|
1832
|
+
dataSource.pageSizeRequested = this.pageSizeRequested;
|
|
1833
|
+
dataSource.maxCachedPages = this.maxCachedPages;
|
|
1834
|
+
dataSource.baseUri = this.baseUri;
|
|
1835
|
+
dataSource.entitySet = this.entitySet;
|
|
1836
|
+
dataSource.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
1837
|
+
dataSource.isAggregationSupportedByServer = this.isAggregationSupportedByServer;
|
|
1838
|
+
dataSource.enableJsonp = this.enableJsonp;
|
|
1839
|
+
return dataSource;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
class RestVirtualDataSourceProviderTaskDataHolder extends AsyncVirtualDataSourceProviderTaskDataHolder {
|
|
1844
|
+
static { this.$t = markType(RestVirtualDataSourceProviderTaskDataHolder, 'ODataVirtualDataSourceProviderTaskDataHolder', AsyncVirtualDataSourceProviderTaskDataHolder.$type); }
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
class RestVirtualDataSourcePage {
|
|
1848
|
+
constructor(sourceData_, schema, groupInformation, summaryInformation, pageIndex) {
|
|
1849
|
+
this._actualData = null;
|
|
1850
|
+
this._schema = null;
|
|
1851
|
+
this._pageIndex = 0;
|
|
1852
|
+
this._groupInformation = null;
|
|
1853
|
+
this._summaryInformation = null;
|
|
1854
|
+
if (sourceData_ == null) {
|
|
1855
|
+
this._actualData = null;
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
let count = (sourceData_.items.length);
|
|
1859
|
+
this._actualData = [];
|
|
1860
|
+
let dateProps = new Set();
|
|
1861
|
+
for (let i = 0; i < schema.propertyNames.length; i++) {
|
|
1862
|
+
if (schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeValue || schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeOffsetValue) {
|
|
1863
|
+
dateProps.add(schema.propertyNames[i]);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
let value_;
|
|
1867
|
+
for (let i_ = 0; i_ < count; i_++) {
|
|
1868
|
+
let currItem_ = sourceData_.items[i_];
|
|
1869
|
+
let dict = new Map();
|
|
1870
|
+
let properties = Array.from(Object.keys(currItem_));
|
|
1871
|
+
let values = (properties.map((k) => currItem_[k]));
|
|
1872
|
+
for (let i1 = 0; i1 < properties.length; i1++) {
|
|
1873
|
+
value_ = values[i1];
|
|
1874
|
+
if (dateProps.has(properties[i1])) {
|
|
1875
|
+
value_ = new Date(value_);
|
|
1876
|
+
}
|
|
1877
|
+
dict.set(properties[i1], value_);
|
|
1878
|
+
}
|
|
1879
|
+
this._actualData[i_] = dict;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
this._schema = schema;
|
|
1883
|
+
this._groupInformation = groupInformation;
|
|
1884
|
+
this._summaryInformation = summaryInformation;
|
|
1885
|
+
this._pageIndex = pageIndex;
|
|
1886
|
+
}
|
|
1887
|
+
count() {
|
|
1888
|
+
return this._actualData.length;
|
|
1889
|
+
}
|
|
1890
|
+
getItemAtIndex(index) {
|
|
1891
|
+
return this._actualData[index];
|
|
1892
|
+
}
|
|
1893
|
+
getItemValueAtIndex(index, valueName) {
|
|
1894
|
+
let item = this._actualData[index];
|
|
1895
|
+
if (!item.has(valueName)) {
|
|
1896
|
+
return null;
|
|
1897
|
+
}
|
|
1898
|
+
return item.get(valueName);
|
|
1899
|
+
}
|
|
1900
|
+
pageIndex() {
|
|
1901
|
+
return this._pageIndex;
|
|
1902
|
+
}
|
|
1903
|
+
schema() {
|
|
1904
|
+
return this._schema;
|
|
1905
|
+
}
|
|
1906
|
+
getGroupInformation() {
|
|
1907
|
+
return this._groupInformation;
|
|
1908
|
+
}
|
|
1909
|
+
getSummaryInformation() {
|
|
1910
|
+
return this._summaryInformation;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
class RestVirtualDataSourceDataProviderWorker extends AsyncVirtualDataSourceProviderWorker {
|
|
1915
|
+
get sortDescriptions() {
|
|
1916
|
+
return this._sortDescriptions;
|
|
1917
|
+
}
|
|
1918
|
+
get filterExpressions() {
|
|
1919
|
+
return this._filterExpressions;
|
|
1920
|
+
}
|
|
1921
|
+
get desiredProperties() {
|
|
1922
|
+
return this._desiredPropeties;
|
|
1923
|
+
}
|
|
1924
|
+
initialize() {
|
|
1925
|
+
super.initialize();
|
|
1926
|
+
}
|
|
1927
|
+
getTaskDataHolder() {
|
|
1928
|
+
let holder = new RestVirtualDataSourceProviderTaskDataHolder();
|
|
1929
|
+
return holder;
|
|
1930
|
+
}
|
|
1931
|
+
getCompletedTaskData(holder, completed) {
|
|
1932
|
+
super.getCompletedTaskData(holder, completed);
|
|
1933
|
+
}
|
|
1934
|
+
removeCompletedTaskData(holder, completed) {
|
|
1935
|
+
super.removeCompletedTaskData(holder, completed);
|
|
1936
|
+
}
|
|
1937
|
+
getTasksData(holder) {
|
|
1938
|
+
super.getTasksData(holder);
|
|
1939
|
+
}
|
|
1940
|
+
*iter(coll) {
|
|
1941
|
+
for (let i = 0; i < coll.size(); i++) {
|
|
1942
|
+
yield coll.get(i);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
*iterFilter(coll) {
|
|
1946
|
+
for (let i = 0; i < coll.size(); i++) {
|
|
1947
|
+
yield coll.get(i);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
*iterSummaries(summaries) {
|
|
1951
|
+
for (let i = 0; i < summaries.size(); i++) {
|
|
1952
|
+
yield summaries.get(i);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
constructor(settings) {
|
|
1956
|
+
super(settings);
|
|
1957
|
+
this._baseUri = null;
|
|
1958
|
+
this._entitySet = null;
|
|
1959
|
+
this._sortDescriptions = null;
|
|
1960
|
+
this._groupDescriptions = null;
|
|
1961
|
+
this._filterExpressions = null;
|
|
1962
|
+
this._summaryDescriptions = null;
|
|
1963
|
+
this._desiredPropeties = null;
|
|
1964
|
+
this._schemaIncludedProperties = null;
|
|
1965
|
+
this._enableJsonp = true;
|
|
1966
|
+
this._isAggregationSupported = false;
|
|
1967
|
+
this._provideFullCount = null;
|
|
1968
|
+
this._provideOrderByParameter = null;
|
|
1969
|
+
this._provideFilterParameter = null;
|
|
1970
|
+
this._provideAggregationParameter = null;
|
|
1971
|
+
this._provideAggregatedCount = null;
|
|
1972
|
+
this._providePagingParameter = null;
|
|
1973
|
+
this._provideDesiredPropertiesParameter = null;
|
|
1974
|
+
this._provideUri = null;
|
|
1975
|
+
this._performFetch = null;
|
|
1976
|
+
this._fixedFullCount = -1;
|
|
1977
|
+
this._groupInformation = null;
|
|
1978
|
+
this._summaryInformation = null;
|
|
1979
|
+
this._filterString = null;
|
|
1980
|
+
this._selectedString = null;
|
|
1981
|
+
this.doWork = this.doWork.bind(this);
|
|
1982
|
+
this._baseUri = settings.baseUri;
|
|
1983
|
+
this._entitySet = settings.entitySet;
|
|
1984
|
+
this._sortDescriptions = settings.sortDescriptions;
|
|
1985
|
+
this._groupDescriptions = settings.groupDescriptions;
|
|
1986
|
+
if (this._groupDescriptions != null && this._groupDescriptions.size() > 0) {
|
|
1987
|
+
this._sortDescriptions = new SortDescriptionCollection();
|
|
1988
|
+
for (let sd of this.iter(settings.sortDescriptions)) {
|
|
1989
|
+
this._sortDescriptions.add(sd);
|
|
1990
|
+
}
|
|
1991
|
+
for (let i = 0; i < this._groupDescriptions.size(); i++) {
|
|
1992
|
+
this._sortDescriptions.insert(i, this._groupDescriptions.get(i));
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
this._filterExpressions = settings.filterExpressions;
|
|
1996
|
+
this._desiredPropeties = settings.propertiesRequested;
|
|
1997
|
+
if (settings.schemaIncludedProperties != null) {
|
|
1998
|
+
this._schemaIncludedProperties = new Set();
|
|
1999
|
+
for (let i = 0; i < settings.schemaIncludedProperties.length; i++) {
|
|
2000
|
+
this._schemaIncludedProperties.add(settings.schemaIncludedProperties[i]);
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
this._summaryDescriptions = settings.summaryDescriptions;
|
|
2004
|
+
this._fixedFullCount = settings.fixedFullCount;
|
|
2005
|
+
this._summaryScope = settings.summaryScope;
|
|
2006
|
+
this._enableJsonp = settings.enableJsonp;
|
|
2007
|
+
this._provideFullCount = settings.provideFullCount;
|
|
2008
|
+
this._performFetch = settings.performFetch;
|
|
2009
|
+
this._provideAggregationParameter = settings.provideAggregationParameter;
|
|
2010
|
+
this._provideFilterParameter = settings.provideFilterParameter;
|
|
2011
|
+
this._provideOrderByParameter = settings.provideOrderByParameter;
|
|
2012
|
+
this._provideUri = settings.provideUri;
|
|
2013
|
+
this._providePagingParameter = settings.providePagingParameter;
|
|
2014
|
+
this._provideDesiredPropertiesParameter = settings.provideDesiredPropertiesParameter;
|
|
2015
|
+
this._provideItems = settings.provideItems;
|
|
2016
|
+
this._provideAggregatedCount = settings.provideAggregatedCount;
|
|
2017
|
+
if (!this._provideItems) {
|
|
2018
|
+
this._provideItems = (res) => {
|
|
2019
|
+
return res ? res.items : null;
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
if (!this._provideFullCount) {
|
|
2023
|
+
this._provideFullCount = (p) => {
|
|
2024
|
+
if (p.fullCount) {
|
|
2025
|
+
return p.fullCount;
|
|
2026
|
+
}
|
|
2027
|
+
else {
|
|
2028
|
+
return this._fixedFullCount >= 0 ? this._fixedFullCount : 0;
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
if (!this._provideOrderByParameter) {
|
|
2033
|
+
this._provideOrderByParameter = (args, orderByString, orderBy) => {
|
|
2034
|
+
args.push({ name: "orderBy", value: encodeURIComponent(orderByString) });
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
if (!this._providePagingParameter) {
|
|
2038
|
+
this._providePagingParameter = (args, skip, take) => {
|
|
2039
|
+
args.push({ name: "skip", value: skip });
|
|
2040
|
+
args.push({ name: "take", value: take });
|
|
2041
|
+
};
|
|
2042
|
+
}
|
|
2043
|
+
if (!this._provideAggregationParameter) {
|
|
2044
|
+
this._provideAggregationParameter = (args, fetchCountOnly, groupByString, groupBy, summaryString, summary) => {
|
|
2045
|
+
args.push({ name: "groupBy", value: groupByString });
|
|
2046
|
+
args.push({ name: "aggregate", value: "count" });
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
if (!this._provideUri) {
|
|
2050
|
+
this._provideUri = (baseUri, entitySet, args) => {
|
|
2051
|
+
let requestUri = baseUri;
|
|
2052
|
+
requestUri += "/" + entitySet;
|
|
2053
|
+
if (args.length > 0) {
|
|
2054
|
+
requestUri += "?";
|
|
2055
|
+
}
|
|
2056
|
+
let argsString = "";
|
|
2057
|
+
for (var i = 0; i < args.length; i++) {
|
|
2058
|
+
if (i > 0) {
|
|
2059
|
+
argsString += "&";
|
|
2060
|
+
}
|
|
2061
|
+
argsString += args[i].name + "=" + args[i].value;
|
|
2062
|
+
}
|
|
2063
|
+
return requestUri + argsString;
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
this._isAggregationSupported = settings.isAggregationSupported;
|
|
2067
|
+
window.setTimeout(this.doWork, 100);
|
|
2068
|
+
}
|
|
2069
|
+
processCompletedTask(completedTask, currentDelay, pageIndex, taskDataHolder) {
|
|
2070
|
+
let h = taskDataHolder;
|
|
2071
|
+
let schema = null;
|
|
2072
|
+
let result = null;
|
|
2073
|
+
let schemaFetchCount = -1;
|
|
2074
|
+
let task = completedTask.task;
|
|
2075
|
+
try {
|
|
2076
|
+
if (task.hasErrors) {
|
|
2077
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
if (pageIndex == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
2081
|
+
result = task.result;
|
|
2082
|
+
schemaFetchCount = (this._provideFullCount(result));
|
|
2083
|
+
}
|
|
2084
|
+
else {
|
|
2085
|
+
result = task.result;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
catch (e) {
|
|
2089
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
if (schemaFetchCount >= 0) {
|
|
2093
|
+
this.actualCount = schemaFetchCount;
|
|
2094
|
+
}
|
|
2095
|
+
else {
|
|
2096
|
+
this.actualCount = (this._provideFullCount(result));
|
|
2097
|
+
}
|
|
2098
|
+
schema = this.actualSchema;
|
|
2099
|
+
if (schema == null) {
|
|
2100
|
+
let requests = 0;
|
|
2101
|
+
this.resolveSchema((s) => {
|
|
2102
|
+
// resolveSchema success callback
|
|
2103
|
+
this.actualSchema = s;
|
|
2104
|
+
if (this._isAggregationSupported && (this._groupDescriptions.size() !== 0 || this._summaryDescriptions.size() !== 0)) {
|
|
2105
|
+
if (this._groupDescriptions.size() > 0) {
|
|
2106
|
+
requests++;
|
|
2107
|
+
this.resolveGroupInformation((g) => {
|
|
2108
|
+
// group info success
|
|
2109
|
+
requests--;
|
|
2110
|
+
if (requests === 0) {
|
|
2111
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
2112
|
+
}
|
|
2113
|
+
}, () => {
|
|
2114
|
+
// group info failure
|
|
2115
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
2116
|
+
return;
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
if (this._summaryDescriptions.size() > 0) {
|
|
2120
|
+
requests++;
|
|
2121
|
+
this.resolveSummaryInformation((g) => {
|
|
2122
|
+
// summary info success
|
|
2123
|
+
requests--;
|
|
2124
|
+
if (requests === 0) {
|
|
2125
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
2126
|
+
}
|
|
2127
|
+
}, () => {
|
|
2128
|
+
// summary info failure
|
|
2129
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
2130
|
+
return;
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
else {
|
|
2135
|
+
this.finishProcessingCompletedTask(task, pageIndex, s, result);
|
|
2136
|
+
}
|
|
2137
|
+
}, () => {
|
|
2138
|
+
// resolveSchema failure callback
|
|
2139
|
+
this.retryIndex(pageIndex, currentDelay);
|
|
2140
|
+
return;
|
|
2141
|
+
});
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
this.finishProcessingCompletedTask(task, pageIndex, schema, result);
|
|
2145
|
+
}
|
|
2146
|
+
finishProcessingCompletedTask(task, pageIndex, schema, result) {
|
|
2147
|
+
let executionContext;
|
|
2148
|
+
let pageLoaded;
|
|
2149
|
+
let groupInformation;
|
|
2150
|
+
let summaryInformation;
|
|
2151
|
+
this.actualSchema = schema;
|
|
2152
|
+
executionContext = this.executionContext;
|
|
2153
|
+
groupInformation = this._groupInformation;
|
|
2154
|
+
summaryInformation = this._summaryInformation;
|
|
2155
|
+
pageLoaded = this.pageLoaded;
|
|
2156
|
+
let page = null;
|
|
2157
|
+
if (result != null) {
|
|
2158
|
+
page = new RestVirtualDataSourcePage(result, schema, groupInformation, summaryInformation, pageIndex);
|
|
2159
|
+
if (!this.isLastPage(pageIndex) && page.count() > 0 && !this.populatedActualPageSize) {
|
|
2160
|
+
this.populatedActualPageSize = true;
|
|
2161
|
+
this.actualPageSize = page.count();
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
else {
|
|
2165
|
+
page = new RestVirtualDataSourcePage(null, schema, groupInformation, summaryInformation, pageIndex);
|
|
2166
|
+
}
|
|
2167
|
+
if (this.pageLoaded != null) {
|
|
2168
|
+
if (this.executionContext != null) {
|
|
2169
|
+
if (executionContext == null || pageLoaded == null) {
|
|
2170
|
+
this.shutdown();
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
executionContext.execute(() => pageLoaded(page, this.actualCount, this.actualPageSize));
|
|
2174
|
+
}
|
|
2175
|
+
else {
|
|
2176
|
+
if (pageLoaded == null) {
|
|
2177
|
+
this.shutdown();
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
pageLoaded(page, this.actualCount, this.actualPageSize);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
resolveGroupInformation(finishAction, failureAction) {
|
|
2185
|
+
if (this._groupInformation != null) {
|
|
2186
|
+
finishAction(this._groupInformation);
|
|
2187
|
+
return;
|
|
2188
|
+
}
|
|
2189
|
+
let orderBy = "";
|
|
2190
|
+
let groupBy = "";
|
|
2191
|
+
let filter = null;
|
|
2192
|
+
let summary = "";
|
|
2193
|
+
if (this._groupDescriptions == null || this._groupDescriptions.size() == 0) {
|
|
2194
|
+
finishAction(null);
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
if (this._provideAggregationParameter == null) {
|
|
2198
|
+
finishAction(null);
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
filter = this._filterString;
|
|
2202
|
+
this.updateFilterString();
|
|
2203
|
+
if (this._groupDescriptions != null) {
|
|
2204
|
+
let first1 = true;
|
|
2205
|
+
for (let group of this.iter(this._groupDescriptions)) {
|
|
2206
|
+
if (first1) {
|
|
2207
|
+
first1 = false;
|
|
2208
|
+
}
|
|
2209
|
+
else {
|
|
2210
|
+
orderBy += ", ";
|
|
2211
|
+
groupBy += ", ";
|
|
2212
|
+
}
|
|
2213
|
+
groupBy += group.propertyName;
|
|
2214
|
+
if (group.direction === ListSortDirection.Descending) {
|
|
2215
|
+
orderBy += group.propertyName + " desc";
|
|
2216
|
+
}
|
|
2217
|
+
else {
|
|
2218
|
+
orderBy += group.propertyName + " asc";
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
if (this._summaryScope === DataSourceSummaryScope.Both || this._summaryScope === DataSourceSummaryScope.Groups) {
|
|
2223
|
+
let summaryParameters = this.getSummaryQueryParameters(true);
|
|
2224
|
+
if (!stringIsNullOrEmpty(summaryParameters)) {
|
|
2225
|
+
summary = ", " + summaryParameters;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
let args = [];
|
|
2229
|
+
if (this._provideOrderByParameter) {
|
|
2230
|
+
this._provideOrderByParameter(args, orderBy, this._groupDescriptions);
|
|
2231
|
+
}
|
|
2232
|
+
if (this._provideFilterParameter && filter != null) {
|
|
2233
|
+
this._provideFilterParameter(args, filter, this._filterExpressions);
|
|
2234
|
+
}
|
|
2235
|
+
if (this._provideAggregationParameter) {
|
|
2236
|
+
this._provideAggregationParameter(args, true, groupBy, this._groupDescriptions, summary, this._summaryDescriptions);
|
|
2237
|
+
}
|
|
2238
|
+
var uri = this._provideUri(this._baseUri, this._entitySet, args);
|
|
2239
|
+
try {
|
|
2240
|
+
let groupInformation = [];
|
|
2241
|
+
let success_ = (data, response) => this.groupSuccess(data, response, finishAction, failureAction, groupInformation);
|
|
2242
|
+
let failure_ = (err) => this.groupError(err, finishAction, failureAction, groupInformation);
|
|
2243
|
+
let run_ = null;
|
|
2244
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
2245
|
+
var request = {
|
|
2246
|
+
requestUri: uri,
|
|
2247
|
+
enableJsonpCallback: this._enableJsonp,
|
|
2248
|
+
method: 'GET',
|
|
2249
|
+
headers: headers,
|
|
2250
|
+
data: null
|
|
2251
|
+
};
|
|
2252
|
+
run_ = () => {
|
|
2253
|
+
this.fetchUri(request, success_, failure_);
|
|
2254
|
+
};
|
|
2255
|
+
run_();
|
|
2256
|
+
}
|
|
2257
|
+
catch (e) {
|
|
2258
|
+
failureAction();
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
fetchUri(request, success, failure) {
|
|
2262
|
+
if (this._performFetch) {
|
|
2263
|
+
this._performFetch(request, success, failure);
|
|
2264
|
+
}
|
|
2265
|
+
else {
|
|
2266
|
+
fetch(request.requestUri, {
|
|
2267
|
+
method: request.method,
|
|
2268
|
+
headers: request.headers,
|
|
2269
|
+
}).then((res) => {
|
|
2270
|
+
res.json().then((j) => {
|
|
2271
|
+
success(j, res);
|
|
2272
|
+
});
|
|
2273
|
+
}).catch((e) => {
|
|
2274
|
+
failure(e);
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
groupError(err, finishAction, failureAction, groupInformation) {
|
|
2279
|
+
this._groupInformation = null;
|
|
2280
|
+
}
|
|
2281
|
+
groupSuccess(data, response, finishAction, failureAction, groupInformation) {
|
|
2282
|
+
let groupNames = [];
|
|
2283
|
+
for (let group of this.iter(this._groupDescriptions)) {
|
|
2284
|
+
groupNames.push(group.propertyName);
|
|
2285
|
+
}
|
|
2286
|
+
let groupNamesArray = groupNames;
|
|
2287
|
+
let items = this._provideItems(data);
|
|
2288
|
+
if (items && items.length > 0) {
|
|
2289
|
+
let currentIndex = 0;
|
|
2290
|
+
for (let i = 0; i < items.length; i++) {
|
|
2291
|
+
this.addGroup(groupInformation, groupNames, groupNames, currentIndex, items[i]);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
this._groupInformation = groupInformation;
|
|
2295
|
+
finishAction(this._groupInformation);
|
|
2296
|
+
}
|
|
2297
|
+
addGroup(groupInformation, groupNames, groupNamesArray, currentIndex, group) {
|
|
2298
|
+
let groupValues = [];
|
|
2299
|
+
for (let name of groupNames) {
|
|
2300
|
+
if (group[name]) {
|
|
2301
|
+
groupValues.push(group[name]);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
let groupCount = 0;
|
|
2305
|
+
//todo: make this customizable
|
|
2306
|
+
if (this._provideAggregatedCount) {
|
|
2307
|
+
let ct = this._provideAggregatedCount(group);
|
|
2308
|
+
}
|
|
2309
|
+
else {
|
|
2310
|
+
if (group["aggregatedCount"]) {
|
|
2311
|
+
groupCount = Convert.toInt321(group["aggregatedCount"]);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
let summaryResults = null;
|
|
2315
|
+
if (this._summaryScope == DataSourceSummaryScope.Both || this._summaryScope == DataSourceSummaryScope.Groups) {
|
|
2316
|
+
summaryResults = this.createSummaryResults(group);
|
|
2317
|
+
}
|
|
2318
|
+
let groupInfo = new DefaultSectionInformation(currentIndex, currentIndex + (groupCount - 1), groupNamesArray, groupValues, summaryResults);
|
|
2319
|
+
groupInformation.push(groupInfo);
|
|
2320
|
+
}
|
|
2321
|
+
resolveSummaryInformation(finishAction, failureAction) {
|
|
2322
|
+
if (this._summaryInformation != null) {
|
|
2323
|
+
finishAction(this._summaryInformation);
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
let filter = null;
|
|
2327
|
+
let summary = null;
|
|
2328
|
+
if (this._summaryDescriptions == null ||
|
|
2329
|
+
this._summaryDescriptions.size() == 0 ||
|
|
2330
|
+
this._summaryScope == DataSourceSummaryScope.Groups ||
|
|
2331
|
+
this._summaryScope == DataSourceSummaryScope.None) {
|
|
2332
|
+
finishAction(null);
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2335
|
+
filter = this._filterString;
|
|
2336
|
+
this.updateFilterString();
|
|
2337
|
+
summary = this.getSummaryQueryParameters(false);
|
|
2338
|
+
let args = [];
|
|
2339
|
+
// if (this._provideOrderByParameter) {
|
|
2340
|
+
// args.push({ name: "orderBy", value: this._provideOrderByParameter(orderBy, this._sortDescriptions) });
|
|
2341
|
+
// }
|
|
2342
|
+
if (this._provideFilterParameter && filter != null) {
|
|
2343
|
+
this._provideFilterParameter(args, filter, this._filterExpressions);
|
|
2344
|
+
}
|
|
2345
|
+
if (this._provideAggregationParameter) {
|
|
2346
|
+
this._provideAggregationParameter(args, true, null, null, summary, this._summaryDescriptions);
|
|
2347
|
+
}
|
|
2348
|
+
var uri = this._provideUri(this._baseUri, this._entitySet, args);
|
|
2349
|
+
// let commandText = this._entitySet + "?$apply=";
|
|
2350
|
+
// if (!stringIsNullOrEmpty(filter)) {
|
|
2351
|
+
// commandText += "filter(" + filter + ")/";
|
|
2352
|
+
// }
|
|
2353
|
+
// commandText += "aggregate(" + summary + ")";
|
|
2354
|
+
try {
|
|
2355
|
+
let summaryInformation = [];
|
|
2356
|
+
let success_ = (data, response) => this.summarySuccess(data, response, finishAction, failureAction, summaryInformation);
|
|
2357
|
+
let failure_ = (err) => this.summaryError(err, finishAction, failureAction, summaryInformation);
|
|
2358
|
+
let run_ = null;
|
|
2359
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
2360
|
+
var request = {
|
|
2361
|
+
requestUri: uri,
|
|
2362
|
+
enableJsonpCallback: this._enableJsonp,
|
|
2363
|
+
method: 'GET',
|
|
2364
|
+
headers: headers,
|
|
2365
|
+
data: null
|
|
2366
|
+
};
|
|
2367
|
+
run_ = () => {
|
|
2368
|
+
this.fetchUri(request, success_, failure_);
|
|
2369
|
+
};
|
|
2370
|
+
run_();
|
|
2371
|
+
}
|
|
2372
|
+
catch (e) {
|
|
2373
|
+
failureAction();
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
summarySuccess(data, response, finishAction, failureAction, summaryInformation) {
|
|
2377
|
+
if (data && data.value && data.value.length > 0) {
|
|
2378
|
+
summaryInformation = this.createSummaryResults(data.value[0]);
|
|
2379
|
+
}
|
|
2380
|
+
this._summaryInformation = summaryInformation;
|
|
2381
|
+
finishAction(this._summaryInformation);
|
|
2382
|
+
}
|
|
2383
|
+
summaryError(err, finishAction, failureAction, summaryInformation) {
|
|
2384
|
+
this._summaryInformation = null;
|
|
2385
|
+
}
|
|
2386
|
+
getSummaryQueryParameters(ignoreCount) {
|
|
2387
|
+
let result = "";
|
|
2388
|
+
if (this._summaryDescriptions != null) {
|
|
2389
|
+
let first = true;
|
|
2390
|
+
let countExists = false;
|
|
2391
|
+
for (let summary of this.iterSummaries(this._summaryDescriptions)) {
|
|
2392
|
+
if (summary.operand == DataSourceSummaryOperand.Count && (ignoreCount || countExists)) {
|
|
2393
|
+
continue;
|
|
2394
|
+
}
|
|
2395
|
+
if (!first) {
|
|
2396
|
+
result += ", ";
|
|
2397
|
+
}
|
|
2398
|
+
switch (summary.operand) {
|
|
2399
|
+
case DataSourceSummaryOperand.Average:
|
|
2400
|
+
result += summary.propertyName + " with average as " + summary.propertyName + "Average";
|
|
2401
|
+
break;
|
|
2402
|
+
case DataSourceSummaryOperand.Min:
|
|
2403
|
+
result += summary.propertyName + " with min as " + summary.propertyName + "Min";
|
|
2404
|
+
break;
|
|
2405
|
+
case DataSourceSummaryOperand.Max:
|
|
2406
|
+
result += summary.propertyName + " with max as " + summary.propertyName + "Max";
|
|
2407
|
+
break;
|
|
2408
|
+
case DataSourceSummaryOperand.Sum:
|
|
2409
|
+
result += summary.propertyName + " with sum as " + summary.propertyName + "Sum";
|
|
2410
|
+
break;
|
|
2411
|
+
case DataSourceSummaryOperand.Count:
|
|
2412
|
+
result += "$count as $__count";
|
|
2413
|
+
countExists = true;
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
first = false;
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
return result;
|
|
2420
|
+
}
|
|
2421
|
+
createSummaryResults(data) {
|
|
2422
|
+
let summaryResults = [];
|
|
2423
|
+
for (let summary of this.iterSummaries(this._summaryDescriptions)) {
|
|
2424
|
+
let summaryName = summary.propertyName;
|
|
2425
|
+
switch (summary.operand) {
|
|
2426
|
+
case DataSourceSummaryOperand.Average:
|
|
2427
|
+
summaryName += "Average";
|
|
2428
|
+
break;
|
|
2429
|
+
case DataSourceSummaryOperand.Min:
|
|
2430
|
+
summaryName += "Min";
|
|
2431
|
+
break;
|
|
2432
|
+
case DataSourceSummaryOperand.Max:
|
|
2433
|
+
summaryName += "Max";
|
|
2434
|
+
break;
|
|
2435
|
+
case DataSourceSummaryOperand.Sum:
|
|
2436
|
+
summaryName += "Sum";
|
|
2437
|
+
break;
|
|
2438
|
+
case DataSourceSummaryOperand.Count:
|
|
2439
|
+
summaryName = "$__count";
|
|
2440
|
+
break;
|
|
2441
|
+
}
|
|
2442
|
+
let summaryValue = null;
|
|
2443
|
+
if (data && data[summaryName]) {
|
|
2444
|
+
summaryValue = data[summaryName];
|
|
2445
|
+
}
|
|
2446
|
+
let summaryResult = new DefaultSummaryResult(summary.propertyName, summary.operand, summaryValue);
|
|
2447
|
+
summaryResults.push(summaryResult);
|
|
2448
|
+
}
|
|
2449
|
+
return summaryResults;
|
|
2450
|
+
}
|
|
2451
|
+
resolveSchemaFromItems(items) {
|
|
2452
|
+
let lds = new LocalDataSource();
|
|
2453
|
+
lds.dataSource = items;
|
|
2454
|
+
lds.flushAutoRefresh();
|
|
2455
|
+
return lds.actualSchema;
|
|
2456
|
+
}
|
|
2457
|
+
resolveSchema(finishAction, failureAction) {
|
|
2458
|
+
if (!this._provideItems || !this._providePagingParameter) {
|
|
2459
|
+
failureAction("required providers for items and paging are not specified");
|
|
2460
|
+
return;
|
|
2461
|
+
}
|
|
2462
|
+
let success_ = (res) => {
|
|
2463
|
+
let items = this._provideItems(res);
|
|
2464
|
+
if (items && items.length > 0) {
|
|
2465
|
+
let schema = this.resolveSchemaFromItems(items);
|
|
2466
|
+
if (this._schemaIncludedProperties != null) {
|
|
2467
|
+
let propertyNames = [];
|
|
2468
|
+
let propertyTypes = [];
|
|
2469
|
+
for (let i = 0; i < schema.propertyNames.length; i++) {
|
|
2470
|
+
if (!this._schemaIncludedProperties.has(schema.propertyNames[i])) {
|
|
2471
|
+
continue;
|
|
2472
|
+
}
|
|
2473
|
+
propertyNames.push(schema.propertyNames[i]);
|
|
2474
|
+
propertyTypes.push(schema.propertyTypes[i]);
|
|
2475
|
+
}
|
|
2476
|
+
schema = new DefaultDataSourceSchema(propertyNames, propertyTypes, schema.primaryKey, schema.propertyDataIntents, schema.subSchemas);
|
|
2477
|
+
}
|
|
2478
|
+
finishAction(schema);
|
|
2479
|
+
}
|
|
2480
|
+
else {
|
|
2481
|
+
failureAction("could not find items to resolve schema");
|
|
2482
|
+
}
|
|
2483
|
+
};
|
|
2484
|
+
let failure_ = (e) => failureAction(e);
|
|
2485
|
+
let args = [];
|
|
2486
|
+
if (this._providePagingParameter) {
|
|
2487
|
+
this._providePagingParameter(args, 0, this.actualPageSize);
|
|
2488
|
+
}
|
|
2489
|
+
let uri = this._provideUri(this._baseUri, this._entitySet, args);
|
|
2490
|
+
try {
|
|
2491
|
+
let run_ = null;
|
|
2492
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
2493
|
+
var request = {
|
|
2494
|
+
requestUri: uri,
|
|
2495
|
+
enableJsonpCallback: this._enableJsonp,
|
|
2496
|
+
method: 'GET',
|
|
2497
|
+
headers: headers,
|
|
2498
|
+
data: null
|
|
2499
|
+
};
|
|
2500
|
+
run_ = () => {
|
|
2501
|
+
this.fetchUri(request, success_, failure_);
|
|
2502
|
+
};
|
|
2503
|
+
run_();
|
|
2504
|
+
}
|
|
2505
|
+
catch (e) {
|
|
2506
|
+
failureAction(e);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
static { this.schemaRequestIndex = -1; }
|
|
2510
|
+
makeTaskForRequest(request, retryDelay) {
|
|
2511
|
+
let args = [];
|
|
2512
|
+
// if (this._provideAggregationParameter) {
|
|
2513
|
+
// args.push({ name: "apply", value: this._provideAggregationParameter(true, groupBy, this._groupDescriptions, summary, this._summaryDescriptions) });
|
|
2514
|
+
// }
|
|
2515
|
+
let actualPageSize = 0;
|
|
2516
|
+
let sortDescriptions = null;
|
|
2517
|
+
actualPageSize = this.actualPageSize;
|
|
2518
|
+
sortDescriptions = this.sortDescriptions;
|
|
2519
|
+
//let requestUrl: string = this._baseUri;
|
|
2520
|
+
//requestUrl += "/" + this._entitySet;
|
|
2521
|
+
let queryStarted = false;
|
|
2522
|
+
this.updateFilterString();
|
|
2523
|
+
if (this._filterString != null) {
|
|
2524
|
+
if (this._provideFilterParameter) {
|
|
2525
|
+
this._provideFilterParameter(args, this._filterString, this._filterExpressions);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
if (this.sortDescriptions != null) {
|
|
2529
|
+
let sortString = null;
|
|
2530
|
+
for (let sort of this.iter(this.sortDescriptions)) {
|
|
2531
|
+
if (sortString == null) {
|
|
2532
|
+
sortString = "";
|
|
2533
|
+
}
|
|
2534
|
+
else {
|
|
2535
|
+
sortString += ", ";
|
|
2536
|
+
}
|
|
2537
|
+
if (sort.direction == ListSortDirection.Descending) {
|
|
2538
|
+
sortString += sort.propertyName + " desc";
|
|
2539
|
+
}
|
|
2540
|
+
else {
|
|
2541
|
+
sortString += sort.propertyName;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
if (sortString != null) {
|
|
2545
|
+
if (this._provideOrderByParameter) {
|
|
2546
|
+
this._provideOrderByParameter(args, sortString, this._sortDescriptions);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
if (this.desiredProperties != null && this.desiredProperties.length > 0) {
|
|
2551
|
+
let selectString = "";
|
|
2552
|
+
let first = true;
|
|
2553
|
+
let $t = this.desiredProperties;
|
|
2554
|
+
for (let i = 0; i < $t.length; i++) {
|
|
2555
|
+
let select = $t[i];
|
|
2556
|
+
if (first) {
|
|
2557
|
+
first = false;
|
|
2558
|
+
}
|
|
2559
|
+
else {
|
|
2560
|
+
selectString += ", ";
|
|
2561
|
+
}
|
|
2562
|
+
selectString += select;
|
|
2563
|
+
}
|
|
2564
|
+
if (this._provideDesiredPropertiesParameter) {
|
|
2565
|
+
this._provideDesiredPropertiesParameter(args, selectString, this._desiredPropeties);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
if (this._providePagingParameter) {
|
|
2569
|
+
if (request.index == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
2570
|
+
this._providePagingParameter(args, 0, actualPageSize);
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
this._providePagingParameter(args, request.index * actualPageSize, actualPageSize);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
let task = new AsyncVirtualDataTask();
|
|
2577
|
+
let uri = this._provideUri(this._baseUri, this._entitySet, args);
|
|
2578
|
+
if (request.index == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
2579
|
+
this.executeRequest(uri, queryStarted, 0, actualPageSize, task);
|
|
2580
|
+
}
|
|
2581
|
+
else {
|
|
2582
|
+
this.executeRequest(uri, queryStarted, request.index * actualPageSize, actualPageSize, task);
|
|
2583
|
+
}
|
|
2584
|
+
request.taskHolder = new AsyncDataSourcePageTaskHolder();
|
|
2585
|
+
request.taskHolder.task = task;
|
|
2586
|
+
this.tasks.add(request);
|
|
2587
|
+
}
|
|
2588
|
+
updateFilterString() {
|
|
2589
|
+
if (this.filterExpressions != null && this.filterExpressions.size() > 0 && this._filterString == null) {
|
|
2590
|
+
let sb = "";
|
|
2591
|
+
let first = true;
|
|
2592
|
+
for (let expr of this.iterFilter(this.filterExpressions)) {
|
|
2593
|
+
if (first) {
|
|
2594
|
+
first = false;
|
|
2595
|
+
}
|
|
2596
|
+
else {
|
|
2597
|
+
sb += " AND ";
|
|
2598
|
+
}
|
|
2599
|
+
let visitor = new ODataDataSourceFilterExpressionVisitor(0);
|
|
2600
|
+
visitor.visit(expr);
|
|
2601
|
+
let txt = visitor.toString();
|
|
2602
|
+
if (this.filterExpressions.size() > 1) {
|
|
2603
|
+
txt = "(" + txt + ")";
|
|
2604
|
+
}
|
|
2605
|
+
sb += (txt);
|
|
2606
|
+
}
|
|
2607
|
+
this._filterString = sb;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
executeRequest(requestUrl, queryStarted, skip, top, task) {
|
|
2611
|
+
// if (!queryStarted) {
|
|
2612
|
+
// queryStarted = true;
|
|
2613
|
+
// requestUrl += "?";
|
|
2614
|
+
// } else {
|
|
2615
|
+
// requestUrl += "&";
|
|
2616
|
+
// }
|
|
2617
|
+
// requestUrl += "$skip=" + skip + "&$top=" + top + "&$count=true";
|
|
2618
|
+
let requestUrl_ = requestUrl;
|
|
2619
|
+
let self_ = this;
|
|
2620
|
+
let success_ = (data, response) => this.success(task, data, response);
|
|
2621
|
+
let failure_ = (err) => this.error(task, err);
|
|
2622
|
+
let run_ = null;
|
|
2623
|
+
var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
2624
|
+
var request = {
|
|
2625
|
+
requestUri: requestUrl_,
|
|
2626
|
+
enableJsonpCallback: this._enableJsonp,
|
|
2627
|
+
method: 'GET',
|
|
2628
|
+
headers: headers,
|
|
2629
|
+
data: null
|
|
2630
|
+
};
|
|
2631
|
+
run_ = () => {
|
|
2632
|
+
this.fetchUri(request, success_, failure_);
|
|
2633
|
+
};
|
|
2634
|
+
task.run = run_;
|
|
2635
|
+
}
|
|
2636
|
+
success(t, data, response) {
|
|
2637
|
+
t.result = data;
|
|
2638
|
+
t.isCompleted = true;
|
|
2639
|
+
}
|
|
2640
|
+
error(t, result) {
|
|
2641
|
+
t.isCompleted = true;
|
|
2642
|
+
t.hasErrors = true;
|
|
2643
|
+
}
|
|
2644
|
+
createBatchRequest(changes) {
|
|
2645
|
+
//TODO: updates
|
|
2646
|
+
}
|
|
2647
|
+
getRequestUriWithKey(key) {
|
|
2648
|
+
let result = "";
|
|
2649
|
+
const keys = Object.keys(key);
|
|
2650
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2651
|
+
if (i > 0) {
|
|
2652
|
+
result += ",";
|
|
2653
|
+
}
|
|
2654
|
+
result += `${keys[i]}=${key[keys[i]]}`;
|
|
2655
|
+
}
|
|
2656
|
+
return `${this._entitySet}(${result})`;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
class RestVirtualDataSourceDataProviderWorkerSettings extends AsyncVirtualDataSourceDataProviderWorkerSettings {
|
|
2661
|
+
constructor() {
|
|
2662
|
+
super(...arguments);
|
|
2663
|
+
this._baseUri = null;
|
|
2664
|
+
this._entitySet = null;
|
|
2665
|
+
this._sortDescriptions = null;
|
|
2666
|
+
this._filterExpressions = null;
|
|
2667
|
+
this._propertiesRequested = null;
|
|
2668
|
+
this._schemaIncludedProperties = null;
|
|
2669
|
+
this._groupDescriptions = null;
|
|
2670
|
+
this._summaryDescriptions = null;
|
|
2671
|
+
this._fixedFullCount = -1;
|
|
2672
|
+
this._provideFullCount = null;
|
|
2673
|
+
this._provideOrderByParameter = null;
|
|
2674
|
+
this._provideFilterParameter = null;
|
|
2675
|
+
this._provideAggregationParameter = null;
|
|
2676
|
+
this._provideAggregatedCount = null;
|
|
2677
|
+
this._provideUri = null;
|
|
2678
|
+
this._providePagingParameter = null;
|
|
2679
|
+
this._provideDesiredPropertiesParameter = null;
|
|
2680
|
+
this._performFetch = null;
|
|
2681
|
+
}
|
|
2682
|
+
static { this.$t = markType(RestVirtualDataSourceDataProviderWorkerSettings, 'RestVirtualDataSourceDataProviderWorkerSettings', AsyncVirtualDataSourceDataProviderWorkerSettings.$type); }
|
|
2683
|
+
get baseUri() {
|
|
2684
|
+
return this._baseUri;
|
|
2685
|
+
}
|
|
2686
|
+
set baseUri(value) {
|
|
2687
|
+
this._baseUri = value;
|
|
2688
|
+
}
|
|
2689
|
+
get entitySet() {
|
|
2690
|
+
return this._entitySet;
|
|
2691
|
+
}
|
|
2692
|
+
set entitySet(value) {
|
|
2693
|
+
this._entitySet = value;
|
|
2694
|
+
}
|
|
2695
|
+
get sortDescriptions() {
|
|
2696
|
+
return this._sortDescriptions;
|
|
2697
|
+
}
|
|
2698
|
+
set sortDescriptions(value) {
|
|
2699
|
+
this._sortDescriptions = value;
|
|
2700
|
+
}
|
|
2701
|
+
get filterExpressions() {
|
|
2702
|
+
return this._filterExpressions;
|
|
2703
|
+
}
|
|
2704
|
+
set filterExpressions(value) {
|
|
2705
|
+
this._filterExpressions = value;
|
|
2706
|
+
}
|
|
2707
|
+
get propertiesRequested() {
|
|
2708
|
+
return this._propertiesRequested;
|
|
2709
|
+
}
|
|
2710
|
+
set propertiesRequested(value) {
|
|
2711
|
+
this._propertiesRequested = value;
|
|
2712
|
+
}
|
|
2713
|
+
get schemaIncludedProperties() {
|
|
2714
|
+
return this._schemaIncludedProperties;
|
|
2715
|
+
}
|
|
2716
|
+
set schemaIncludedProperties(value) {
|
|
2717
|
+
this._schemaIncludedProperties = value;
|
|
2718
|
+
}
|
|
2719
|
+
get groupDescriptions() {
|
|
2720
|
+
return this._groupDescriptions;
|
|
2721
|
+
}
|
|
2722
|
+
set groupDescriptions(value) {
|
|
2723
|
+
this._groupDescriptions = value;
|
|
2724
|
+
}
|
|
2725
|
+
get summaryDescriptions() {
|
|
2726
|
+
return this._summaryDescriptions;
|
|
2727
|
+
}
|
|
2728
|
+
set summaryDescriptions(value) {
|
|
2729
|
+
this._summaryDescriptions = value;
|
|
2730
|
+
}
|
|
2731
|
+
get summaryScope() {
|
|
2732
|
+
return this._summaryscope;
|
|
2733
|
+
}
|
|
2734
|
+
set summaryScope(value) {
|
|
2735
|
+
this._summaryscope = value;
|
|
2736
|
+
}
|
|
2737
|
+
get enableJsonp() {
|
|
2738
|
+
return this._enableJsonp;
|
|
2739
|
+
}
|
|
2740
|
+
set enableJsonp(isEnabled) {
|
|
2741
|
+
this._enableJsonp = isEnabled;
|
|
2742
|
+
}
|
|
2743
|
+
get isAggregationSupported() {
|
|
2744
|
+
return this._isAggregationSupported;
|
|
2745
|
+
}
|
|
2746
|
+
set isAggregationSupported(isSupported) {
|
|
2747
|
+
this._isAggregationSupported = isSupported;
|
|
2748
|
+
}
|
|
2749
|
+
get fixedFullCount() {
|
|
2750
|
+
return this._fixedFullCount;
|
|
2751
|
+
}
|
|
2752
|
+
set fixedFullCount(value) {
|
|
2753
|
+
this._fixedFullCount = value;
|
|
2754
|
+
}
|
|
2755
|
+
get provideFullCount() {
|
|
2756
|
+
return this._provideFullCount;
|
|
2757
|
+
}
|
|
2758
|
+
set provideFullCount(value) {
|
|
2759
|
+
this._provideFullCount = value;
|
|
2760
|
+
}
|
|
2761
|
+
get provideOrderByParameter() {
|
|
2762
|
+
return this._provideOrderByParameter;
|
|
2763
|
+
}
|
|
2764
|
+
set provideOrderByParameter(value) {
|
|
2765
|
+
this._provideOrderByParameter = value;
|
|
2766
|
+
}
|
|
2767
|
+
get provideFilterParameter() {
|
|
2768
|
+
return this._provideFilterParameter;
|
|
2769
|
+
}
|
|
2770
|
+
set provideFilterParameter(value) {
|
|
2771
|
+
this._provideFilterParameter = value;
|
|
2772
|
+
}
|
|
2773
|
+
get provideAggregationParameter() {
|
|
2774
|
+
return this._provideAggregationParameter;
|
|
2775
|
+
}
|
|
2776
|
+
set provideAggregationParameter(value) {
|
|
2777
|
+
this._provideAggregationParameter = value;
|
|
2778
|
+
}
|
|
2779
|
+
get provideAggregatedCount() {
|
|
2780
|
+
return this._provideAggregatedCount;
|
|
2781
|
+
}
|
|
2782
|
+
set provideAggregatedCount(value) {
|
|
2783
|
+
this._provideAggregatedCount = value;
|
|
2784
|
+
}
|
|
2785
|
+
get provideUri() {
|
|
2786
|
+
return this._provideUri;
|
|
2787
|
+
}
|
|
2788
|
+
set provideUri(value) {
|
|
2789
|
+
this._provideUri = value;
|
|
2790
|
+
}
|
|
2791
|
+
get providePagingParameter() {
|
|
2792
|
+
return this._providePagingParameter;
|
|
2793
|
+
}
|
|
2794
|
+
set providePagingParameter(value) {
|
|
2795
|
+
this._providePagingParameter = value;
|
|
2796
|
+
}
|
|
2797
|
+
get provideDesiredPropertiesParameter() {
|
|
2798
|
+
return this._provideDesiredPropertiesParameter;
|
|
2799
|
+
}
|
|
2800
|
+
set provideDesiredPropertiesParameter(value) {
|
|
2801
|
+
this._provideDesiredPropertiesParameter = value;
|
|
2802
|
+
}
|
|
2803
|
+
get provideItems() {
|
|
2804
|
+
return this._provideItems;
|
|
2805
|
+
}
|
|
2806
|
+
set provideItems(value) {
|
|
2807
|
+
this._provideItems = value;
|
|
2808
|
+
}
|
|
2809
|
+
get performFetch() {
|
|
2810
|
+
return this._performFetch;
|
|
2811
|
+
}
|
|
2812
|
+
set performFetch(value) {
|
|
2813
|
+
this._performFetch = value;
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
class RestVirtualDataSourceDataProvider extends Base {
|
|
2818
|
+
static { this.$t = markType(RestVirtualDataSourceDataProvider, 'ODataVirtualDataSourceDataProvider', Base.$type, [IDataSourceVirtualDataProvider_$type]); }
|
|
2819
|
+
constructor() {
|
|
2820
|
+
super();
|
|
2821
|
+
this._worker = null;
|
|
2822
|
+
this._requests = new LinkedList();
|
|
2823
|
+
this._callback = null;
|
|
2824
|
+
this._pageLoaded = null;
|
|
2825
|
+
this._pageSizeRequested = 50;
|
|
2826
|
+
this._baseUri = null;
|
|
2827
|
+
this._entitySet = null;
|
|
2828
|
+
this._timeoutMilliseconds = 10000;
|
|
2829
|
+
this.schemaChanged = null;
|
|
2830
|
+
this._currentFullCount = 0;
|
|
2831
|
+
this._currentSchema = null;
|
|
2832
|
+
this._executionContext = null;
|
|
2833
|
+
this._updateNotifier = null;
|
|
2834
|
+
this._deferAutoRefresh = false;
|
|
2835
|
+
this._sortDescriptions = null;
|
|
2836
|
+
this._groupDescriptions = null;
|
|
2837
|
+
this._propertiesRequested = null;
|
|
2838
|
+
this._schemaIncludedProperties = null;
|
|
2839
|
+
this._filterExpressions = null;
|
|
2840
|
+
this._summaryDescriptions = null;
|
|
2841
|
+
this._enableJsonp = true;
|
|
2842
|
+
this._fixedFullCount = -1;
|
|
2843
|
+
this._provideFullCount = null;
|
|
2844
|
+
this._provideOrderByParameter = null;
|
|
2845
|
+
this._provideFilterParameter = null;
|
|
2846
|
+
this._provideAggregationParameter = null;
|
|
2847
|
+
this._provideAggregatedCount = null;
|
|
2848
|
+
this._provideUri = null;
|
|
2849
|
+
this._performFetch = null;
|
|
2850
|
+
this._providePagingParameter = null;
|
|
2851
|
+
this._provideDesiredPropertiesParameter = null;
|
|
2852
|
+
this._schemaFetchQueued = false;
|
|
2853
|
+
this._autoRefreshQueued = false;
|
|
2854
|
+
this._sortDescriptions = new SortDescriptionCollection();
|
|
2855
|
+
this._sortDescriptions.onChanged = () => this.sortDescriptions_CollectionChanged(null, null);
|
|
2856
|
+
this._groupDescriptions = new SortDescriptionCollection();
|
|
2857
|
+
this._groupDescriptions.onChanged = () => this.groupDescriptions_CollectionChanged(null, null);
|
|
2858
|
+
this._filterExpressions = new FilterExpressionCollection();
|
|
2859
|
+
this._filterExpressions.onChanged = () => this.filterExpressions_CollectionChanged(null, null);
|
|
2860
|
+
this._summaryDescriptions = new SummaryDescriptionCollection();
|
|
2861
|
+
this._summaryDescriptions.onChanged = () => this.summaryDescriptions_CollectionChanged(null, null);
|
|
2862
|
+
}
|
|
2863
|
+
filterExpressions_CollectionChanged(sender, e) {
|
|
2864
|
+
this.queueAutoRefresh();
|
|
2865
|
+
}
|
|
2866
|
+
sortDescriptions_CollectionChanged(sender, e) {
|
|
2867
|
+
this.queueAutoRefresh();
|
|
2868
|
+
}
|
|
2869
|
+
groupDescriptions_CollectionChanged(sender, e) {
|
|
2870
|
+
this.queueAutoRefresh();
|
|
2871
|
+
}
|
|
2872
|
+
summaryDescriptions_CollectionChanged(sender, e) {
|
|
2873
|
+
this.queueAutoRefresh();
|
|
2874
|
+
}
|
|
2875
|
+
addPageRequest(pageIndex, priority) {
|
|
2876
|
+
if (this.deferAutoRefresh) {
|
|
2877
|
+
return;
|
|
2878
|
+
}
|
|
2879
|
+
if (this._worker != null && this._worker.isShutdown) {
|
|
2880
|
+
this._worker = null;
|
|
2881
|
+
this._callback = null;
|
|
2882
|
+
}
|
|
2883
|
+
if (this._worker == null) {
|
|
2884
|
+
this.createWorker();
|
|
2885
|
+
}
|
|
2886
|
+
if (priority == DataSourcePageRequestPriority.High) {
|
|
2887
|
+
this._requests.addFirst(pageIndex);
|
|
2888
|
+
}
|
|
2889
|
+
else {
|
|
2890
|
+
this._requests.addLast(pageIndex);
|
|
2891
|
+
}
|
|
2892
|
+
if (!this._worker.addPageRequest(pageIndex, priority)) {
|
|
2893
|
+
this._worker = null;
|
|
2894
|
+
this._callback = null;
|
|
2895
|
+
this.addPageRequest(pageIndex, priority);
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
createWorker() {
|
|
2899
|
+
if (!this.valid()) {
|
|
2900
|
+
return;
|
|
2901
|
+
}
|
|
2902
|
+
this._callback = runOn(this, this.raisePageLoaded);
|
|
2903
|
+
let settings = this.getWorkerSettings();
|
|
2904
|
+
this._worker = new RestVirtualDataSourceDataProviderWorker(settings);
|
|
2905
|
+
}
|
|
2906
|
+
valid() {
|
|
2907
|
+
return this.entitySet != null && this.baseUri != null;
|
|
2908
|
+
}
|
|
2909
|
+
getWorkerSettings() {
|
|
2910
|
+
return ((() => {
|
|
2911
|
+
let $ret = new RestVirtualDataSourceDataProviderWorkerSettings();
|
|
2912
|
+
$ret.baseUri = this._baseUri;
|
|
2913
|
+
$ret.entitySet = this._entitySet;
|
|
2914
|
+
$ret.pageSizeRequested = this._pageSizeRequested;
|
|
2915
|
+
$ret.timeoutMilliseconds = this._timeoutMilliseconds;
|
|
2916
|
+
$ret.pageLoaded = this._callback;
|
|
2917
|
+
$ret.executionContext = this._executionContext;
|
|
2918
|
+
$ret.sortDescriptions = this._sortDescriptions;
|
|
2919
|
+
$ret.groupDescriptions = this._groupDescriptions;
|
|
2920
|
+
$ret.filterExpressions = this._filterExpressions;
|
|
2921
|
+
$ret.propertiesRequested = this._propertiesRequested;
|
|
2922
|
+
$ret.schemaIncludedProperties = this._schemaIncludedProperties;
|
|
2923
|
+
$ret.summaryDescriptions = this._summaryDescriptions;
|
|
2924
|
+
$ret.summaryScope = this._summaryScope;
|
|
2925
|
+
$ret.enableJsonp = this._enableJsonp;
|
|
2926
|
+
$ret.isAggregationSupported = this.isAggregationSupported;
|
|
2927
|
+
$ret.performFetch = this.performFetch;
|
|
2928
|
+
$ret.provideAggregationParameter = this.provideAggregationParameter;
|
|
2929
|
+
$ret.provideAggregatedCount = this.provideAggregatedCount;
|
|
2930
|
+
$ret.provideDesiredPropertiesParameter = this.provideDesiredPropertiesParameter;
|
|
2931
|
+
$ret.provideFilterParameter = this.provideFilterParameter;
|
|
2932
|
+
$ret.provideFullCount = this.provideFullCount;
|
|
2933
|
+
$ret.provideItems = this.provideItems;
|
|
2934
|
+
$ret.provideOrderByParameter = this.provideOrderByParameter;
|
|
2935
|
+
$ret.providePagingParameter = this.providePagingParameter;
|
|
2936
|
+
$ret.provideUri = this.provideUri;
|
|
2937
|
+
$ret.fixedFullCount = this.fixedFullCount;
|
|
2938
|
+
return $ret;
|
|
2939
|
+
})());
|
|
2940
|
+
}
|
|
2941
|
+
removePageRequest(pageIndex) {
|
|
2942
|
+
let current = this._requests.first;
|
|
2943
|
+
while (current != null) {
|
|
2944
|
+
if (current.value == pageIndex) {
|
|
2945
|
+
this._requests.remove(current);
|
|
2946
|
+
}
|
|
2947
|
+
current = current.next;
|
|
2948
|
+
}
|
|
2949
|
+
if (this._worker == null) {
|
|
2950
|
+
return;
|
|
2951
|
+
}
|
|
2952
|
+
this._worker.removePageRequest(pageIndex);
|
|
2953
|
+
}
|
|
2954
|
+
removeAllPageRequests() {
|
|
2955
|
+
this._requests.clear();
|
|
2956
|
+
if (this._worker == null) {
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
this._worker.removeAllPageRequests();
|
|
2960
|
+
}
|
|
2961
|
+
close() {
|
|
2962
|
+
if (this._worker != null) {
|
|
2963
|
+
this._worker.shutdown();
|
|
2964
|
+
this._worker = null;
|
|
2965
|
+
this._callback = null;
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
get pageLoaded() {
|
|
2969
|
+
return this._pageLoaded;
|
|
2970
|
+
}
|
|
2971
|
+
set pageLoaded(value) {
|
|
2972
|
+
this._pageLoaded = value;
|
|
2973
|
+
this.queueAutoRefresh();
|
|
2974
|
+
}
|
|
2975
|
+
raisePageLoaded(page, fullCount, actualPageSize) {
|
|
2976
|
+
if (this._pageLoaded != null) {
|
|
2977
|
+
this._currentFullCount = fullCount;
|
|
2978
|
+
if (this._currentSchema == null) {
|
|
2979
|
+
let currentSchema = null;
|
|
2980
|
+
if (page != null) {
|
|
2981
|
+
currentSchema = page.schema();
|
|
2982
|
+
}
|
|
2983
|
+
this._currentSchema = currentSchema;
|
|
2984
|
+
if (this.schemaChanged != null) {
|
|
2985
|
+
this.schemaChanged(this, new DataSourceDataProviderSchemaChangedEventArgs(this._currentSchema, this._currentFullCount));
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
if (page.pageIndex() != RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
2989
|
+
this._pageLoaded(page, fullCount, actualPageSize);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
killWorker() {
|
|
2994
|
+
if (this._worker != null) {
|
|
2995
|
+
this._worker.shutdown();
|
|
2996
|
+
this._worker = null;
|
|
2997
|
+
this._callback = null;
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
get pageSizeRequested() {
|
|
3001
|
+
return this._pageSizeRequested;
|
|
3002
|
+
}
|
|
3003
|
+
set pageSizeRequested(value) {
|
|
3004
|
+
this._pageSizeRequested = value;
|
|
3005
|
+
this.queueAutoRefresh();
|
|
3006
|
+
}
|
|
3007
|
+
get baseUri() {
|
|
3008
|
+
return this._baseUri;
|
|
3009
|
+
}
|
|
3010
|
+
set baseUri(value) {
|
|
3011
|
+
let oldValue = this._baseUri;
|
|
3012
|
+
this._baseUri = value;
|
|
3013
|
+
if (oldValue != this._baseUri) {
|
|
3014
|
+
this.queueAutoRefresh();
|
|
3015
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
3016
|
+
this.queueSchemaFetch();
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
get entitySet() {
|
|
3021
|
+
return this._entitySet;
|
|
3022
|
+
}
|
|
3023
|
+
set entitySet(value) {
|
|
3024
|
+
let oldValue = this._entitySet;
|
|
3025
|
+
this._entitySet = value;
|
|
3026
|
+
if (oldValue != this._entitySet) {
|
|
3027
|
+
this.queueAutoRefresh();
|
|
3028
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
3029
|
+
this.queueSchemaFetch();
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
get timeoutMilliseconds() {
|
|
3034
|
+
return this._timeoutMilliseconds;
|
|
3035
|
+
}
|
|
3036
|
+
set timeoutMilliseconds(value) {
|
|
3037
|
+
this._timeoutMilliseconds = value;
|
|
3038
|
+
this.queueAutoRefresh();
|
|
3039
|
+
}
|
|
3040
|
+
getItemValue(item, valueName) {
|
|
3041
|
+
let dic = item;
|
|
3042
|
+
if (dic.has(valueName)) {
|
|
3043
|
+
return dic.get(valueName);
|
|
3044
|
+
}
|
|
3045
|
+
else {
|
|
3046
|
+
return null;
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
get actualCount() {
|
|
3050
|
+
return this._currentFullCount;
|
|
3051
|
+
}
|
|
3052
|
+
get actualSchema() {
|
|
3053
|
+
return this._currentSchema;
|
|
3054
|
+
}
|
|
3055
|
+
get executionContext() {
|
|
3056
|
+
return this._executionContext;
|
|
3057
|
+
}
|
|
3058
|
+
set executionContext(value) {
|
|
3059
|
+
this._executionContext = value;
|
|
3060
|
+
this.queueAutoRefresh();
|
|
3061
|
+
}
|
|
3062
|
+
get updateNotifier() {
|
|
3063
|
+
return this._updateNotifier;
|
|
3064
|
+
}
|
|
3065
|
+
set updateNotifier(value) {
|
|
3066
|
+
this._updateNotifier = value;
|
|
3067
|
+
}
|
|
3068
|
+
get deferAutoRefresh() {
|
|
3069
|
+
return this._deferAutoRefresh;
|
|
3070
|
+
}
|
|
3071
|
+
set deferAutoRefresh(value) {
|
|
3072
|
+
this._deferAutoRefresh = value;
|
|
3073
|
+
if (!this._deferAutoRefresh) {
|
|
3074
|
+
this.queueAutoRefresh();
|
|
3075
|
+
}
|
|
3076
|
+
if (this._deferAutoRefresh && this.valid() && this._currentSchema == null) {
|
|
3077
|
+
this.queueSchemaFetch();
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
get isSortingSupported() {
|
|
3081
|
+
return true;
|
|
3082
|
+
}
|
|
3083
|
+
get isGroupingSupported() {
|
|
3084
|
+
return this.isAggregationSupported;
|
|
3085
|
+
}
|
|
3086
|
+
get isFilteringSupported() {
|
|
3087
|
+
return true;
|
|
3088
|
+
}
|
|
3089
|
+
get isAggregationSupported() {
|
|
3090
|
+
return this._isAggregationSupported;
|
|
3091
|
+
}
|
|
3092
|
+
set isAggregationSupported(isSupported) {
|
|
3093
|
+
this._isAggregationSupported = isSupported;
|
|
3094
|
+
}
|
|
3095
|
+
get sortDescriptions() {
|
|
3096
|
+
return this._sortDescriptions;
|
|
3097
|
+
}
|
|
3098
|
+
get groupDescriptions() {
|
|
3099
|
+
return this._groupDescriptions;
|
|
3100
|
+
}
|
|
3101
|
+
get propertiesRequested() {
|
|
3102
|
+
return this._propertiesRequested;
|
|
3103
|
+
}
|
|
3104
|
+
set propertiesRequested(value) {
|
|
3105
|
+
this._propertiesRequested = value;
|
|
3106
|
+
this.queueAutoRefresh();
|
|
3107
|
+
}
|
|
3108
|
+
get schemaIncludedProperties() {
|
|
3109
|
+
return this._schemaIncludedProperties;
|
|
3110
|
+
}
|
|
3111
|
+
set schemaIncludedProperties(value) {
|
|
3112
|
+
this._schemaIncludedProperties = value;
|
|
3113
|
+
this.queueAutoRefresh();
|
|
3114
|
+
}
|
|
3115
|
+
get filterExpressions() {
|
|
3116
|
+
return this._filterExpressions;
|
|
3117
|
+
}
|
|
3118
|
+
get summaryDescriptions() {
|
|
3119
|
+
return this._summaryDescriptions;
|
|
3120
|
+
}
|
|
3121
|
+
get summaryScope() {
|
|
3122
|
+
return this._summaryScope;
|
|
3123
|
+
}
|
|
3124
|
+
set summaryScope(value) {
|
|
3125
|
+
this._summaryScope = value;
|
|
3126
|
+
}
|
|
3127
|
+
get enableJsonp() {
|
|
3128
|
+
return this._enableJsonp;
|
|
3129
|
+
}
|
|
3130
|
+
set enableJsonp(isEnabled) {
|
|
3131
|
+
this._enableJsonp = isEnabled;
|
|
3132
|
+
}
|
|
3133
|
+
get fixedFullCount() {
|
|
3134
|
+
return this._fixedFullCount;
|
|
3135
|
+
}
|
|
3136
|
+
set fixedFullCount(value) {
|
|
3137
|
+
this._fixedFullCount = value;
|
|
3138
|
+
}
|
|
3139
|
+
get provideFullCount() {
|
|
3140
|
+
return this._provideFullCount;
|
|
3141
|
+
}
|
|
3142
|
+
set provideFullCount(value) {
|
|
3143
|
+
this._provideFullCount = value;
|
|
3144
|
+
}
|
|
3145
|
+
get provideOrderByParameter() {
|
|
3146
|
+
return this._provideOrderByParameter;
|
|
3147
|
+
}
|
|
3148
|
+
set provideOrderByParameter(value) {
|
|
3149
|
+
this._provideOrderByParameter = value;
|
|
3150
|
+
}
|
|
3151
|
+
get provideFilterParameter() {
|
|
3152
|
+
return this._provideFilterParameter;
|
|
3153
|
+
}
|
|
3154
|
+
set provideFilterParameter(value) {
|
|
3155
|
+
this._provideFilterParameter = value;
|
|
3156
|
+
}
|
|
3157
|
+
get provideAggregationParameter() {
|
|
3158
|
+
return this._provideAggregationParameter;
|
|
3159
|
+
}
|
|
3160
|
+
set provideAggregationParameter(value) {
|
|
3161
|
+
this._provideAggregationParameter = value;
|
|
3162
|
+
}
|
|
3163
|
+
get provideAggregatedCount() {
|
|
3164
|
+
return this._provideAggregatedCount;
|
|
3165
|
+
}
|
|
3166
|
+
set provideAggregatedCount(value) {
|
|
3167
|
+
this._provideAggregatedCount = value;
|
|
3168
|
+
}
|
|
3169
|
+
get provideUri() {
|
|
3170
|
+
return this._provideUri;
|
|
3171
|
+
}
|
|
3172
|
+
set provideUri(value) {
|
|
3173
|
+
this._provideUri = value;
|
|
3174
|
+
}
|
|
3175
|
+
get performFetch() {
|
|
3176
|
+
return this._performFetch;
|
|
3177
|
+
}
|
|
3178
|
+
set performFetch(value) {
|
|
3179
|
+
this._performFetch = value;
|
|
3180
|
+
}
|
|
3181
|
+
get providePagingParameter() {
|
|
3182
|
+
return this._providePagingParameter;
|
|
3183
|
+
}
|
|
3184
|
+
set providePagingParameter(value) {
|
|
3185
|
+
this._providePagingParameter = value;
|
|
3186
|
+
}
|
|
3187
|
+
get provideDesiredPropertiesParameter() {
|
|
3188
|
+
return this._provideDesiredPropertiesParameter;
|
|
3189
|
+
}
|
|
3190
|
+
set provideDesiredPropertiesParameter(value) {
|
|
3191
|
+
this._provideDesiredPropertiesParameter = value;
|
|
3192
|
+
}
|
|
3193
|
+
get provideItems() {
|
|
3194
|
+
return this._provideItems;
|
|
3195
|
+
}
|
|
3196
|
+
set provideItems(value) {
|
|
3197
|
+
this._provideItems = value;
|
|
3198
|
+
}
|
|
3199
|
+
get notifyUsingSourceIndexes() {
|
|
3200
|
+
return true;
|
|
3201
|
+
}
|
|
3202
|
+
get isItemIndexLookupSupported() {
|
|
3203
|
+
return false;
|
|
3204
|
+
}
|
|
3205
|
+
get isKeyIndexLookupSupported() {
|
|
3206
|
+
return false;
|
|
3207
|
+
}
|
|
3208
|
+
notifySetItem(index, oldItem, newItem) {
|
|
3209
|
+
if (this.updateNotifier != null) {
|
|
3210
|
+
this.updateNotifier.notifySetItem(index, oldItem, newItem);
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
notifyClearItems() {
|
|
3214
|
+
if (this.updateNotifier != null) {
|
|
3215
|
+
this.updateNotifier.notifyClearItems();
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
notifyInsertItem(index, newItem) {
|
|
3219
|
+
if (this.updateNotifier != null) {
|
|
3220
|
+
this.updateNotifier.notifyInsertItem(index, newItem);
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
notifyRemoveItem(index, oldItem) {
|
|
3224
|
+
if (this.updateNotifier != null) {
|
|
3225
|
+
this.updateNotifier.notifyRemoveItem(index, oldItem);
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
queueSchemaFetch() {
|
|
3229
|
+
if (this._schemaFetchQueued) {
|
|
3230
|
+
return;
|
|
3231
|
+
}
|
|
3232
|
+
if (this.executionContext != null) {
|
|
3233
|
+
this._schemaFetchQueued = true;
|
|
3234
|
+
this.executionContext.enqueueAction(runOn(this, this.doSchemaFetchInternal));
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
doSchemaFetchInternal() {
|
|
3238
|
+
if (!this._schemaFetchQueued) {
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
this._schemaFetchQueued = false;
|
|
3242
|
+
this.schemaFetchInternal();
|
|
3243
|
+
}
|
|
3244
|
+
schemaFetchInternal() {
|
|
3245
|
+
this.schemaFetchInternalOverride();
|
|
3246
|
+
}
|
|
3247
|
+
schemaFetchInternalOverride() {
|
|
3248
|
+
if (!this.deferAutoRefresh) {
|
|
3249
|
+
return;
|
|
3250
|
+
}
|
|
3251
|
+
this.removeAllPageRequests();
|
|
3252
|
+
this.killWorker();
|
|
3253
|
+
this.createWorker();
|
|
3254
|
+
this.addSchemaRequest();
|
|
3255
|
+
}
|
|
3256
|
+
addSchemaRequest() {
|
|
3257
|
+
this._worker.addPageRequest(RestVirtualDataSourceDataProviderWorker.schemaRequestIndex, DataSourcePageRequestPriority.High);
|
|
3258
|
+
}
|
|
3259
|
+
queueAutoRefresh() {
|
|
3260
|
+
if (this.deferAutoRefresh) {
|
|
3261
|
+
return;
|
|
3262
|
+
}
|
|
3263
|
+
if (this._autoRefreshQueued) {
|
|
3264
|
+
return;
|
|
3265
|
+
}
|
|
3266
|
+
if (this.executionContext != null) {
|
|
3267
|
+
this._autoRefreshQueued = true;
|
|
3268
|
+
this.executionContext.enqueueAction(runOn(this, this.doRefreshInternal));
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
doRefreshInternal() {
|
|
3272
|
+
if (this.deferAutoRefresh) {
|
|
3273
|
+
this._autoRefreshQueued = false;
|
|
3274
|
+
return;
|
|
3275
|
+
}
|
|
3276
|
+
if (!this._autoRefreshQueued) {
|
|
3277
|
+
return;
|
|
3278
|
+
}
|
|
3279
|
+
this._autoRefreshQueued = false;
|
|
3280
|
+
this.refreshInternal();
|
|
3281
|
+
}
|
|
3282
|
+
refreshInternal() {
|
|
3283
|
+
this.refreshInternalOverride();
|
|
3284
|
+
}
|
|
3285
|
+
refreshInternalOverride() {
|
|
3286
|
+
this.removeAllPageRequests();
|
|
3287
|
+
this.killWorker();
|
|
3288
|
+
this.createWorker();
|
|
3289
|
+
this._worker.addPageRequest(0, DataSourcePageRequestPriority.Normal);
|
|
3290
|
+
}
|
|
3291
|
+
flushAutoRefresh() {
|
|
3292
|
+
this.doRefreshInternal();
|
|
3293
|
+
}
|
|
3294
|
+
refresh() {
|
|
3295
|
+
this.refreshInternal();
|
|
3296
|
+
}
|
|
3297
|
+
indexOfItem(item) {
|
|
3298
|
+
return -1;
|
|
3299
|
+
}
|
|
3300
|
+
indexOfKey(key) {
|
|
3301
|
+
return -1;
|
|
3302
|
+
}
|
|
3303
|
+
resolveSchemaPropertyType(propertyPath) {
|
|
3304
|
+
if (this.actualSchema == null) {
|
|
3305
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
3306
|
+
}
|
|
3307
|
+
if (stringContains(propertyPath, ".")) {
|
|
3308
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
3309
|
+
}
|
|
3310
|
+
for (let i = 0; i < this.actualSchema.propertyNames.length; i++) {
|
|
3311
|
+
let name = this.actualSchema.propertyNames[i];
|
|
3312
|
+
if (name == propertyPath) {
|
|
3313
|
+
return this.actualSchema.propertyTypes[i];
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
3317
|
+
}
|
|
3318
|
+
setItemValue(item, valueName, value) {
|
|
3319
|
+
// does nothing.
|
|
3320
|
+
}
|
|
3321
|
+
removeItem(item) {
|
|
3322
|
+
// does nothing.
|
|
3323
|
+
}
|
|
3324
|
+
addItem(item) {
|
|
3325
|
+
// does nothing.
|
|
3326
|
+
}
|
|
3327
|
+
createBatchRequest(changes) {
|
|
3328
|
+
if (this._worker != null) {
|
|
3329
|
+
this._worker.createBatchRequest(changes);
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
get batchCompleted() {
|
|
3333
|
+
return this._batchCompleted;
|
|
3334
|
+
}
|
|
3335
|
+
set batchCompleted(v) {
|
|
3336
|
+
this._batchCompleted = v;
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
class RestVirtualDataSource extends VirtualDataSource {
|
|
3341
|
+
constructor() {
|
|
3342
|
+
super();
|
|
3343
|
+
this._baseUri = null;
|
|
3344
|
+
this._isFilteringSupportedByServer = false;
|
|
3345
|
+
this._entitySet = null;
|
|
3346
|
+
this._timeoutMilliseconds = 10000;
|
|
3347
|
+
this._isAggregationSupportedByServer = false;
|
|
3348
|
+
this._enableJsonp = true;
|
|
3349
|
+
this._fixedFullCount = -1;
|
|
3350
|
+
this._provideFullCount = null;
|
|
3351
|
+
this._provideOrderByParameter = null;
|
|
3352
|
+
this._provideFilterParameter = null;
|
|
3353
|
+
this._provideAggregationParameter = null;
|
|
3354
|
+
this._provideAggregatedCount = null;
|
|
3355
|
+
this._provideUri = null;
|
|
3356
|
+
this._performFetch = null;
|
|
3357
|
+
this._providePagingParameter = null;
|
|
3358
|
+
this._provideDesiredPropertiesParameter = null;
|
|
3359
|
+
this.dataProvider = ((() => {
|
|
3360
|
+
let $ret = new RestVirtualDataSourceDataProvider();
|
|
3361
|
+
$ret.executionContext = this.executionContext;
|
|
3362
|
+
$ret.enableJsonp = this.enableJsonp;
|
|
3363
|
+
$ret.isAggregationSupported = this.isGroupingSupported;
|
|
3364
|
+
return $ret;
|
|
3365
|
+
})());
|
|
3366
|
+
this.externalDataSource = this;
|
|
3367
|
+
}
|
|
3368
|
+
onBaseUriChanged(oldValue, newValue) {
|
|
3369
|
+
if (this.actualDataProvider) {
|
|
3370
|
+
this.actualDataProvider.baseUri = this.baseUri;
|
|
3371
|
+
this.queueAutoRefresh();
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
get baseUri() {
|
|
3375
|
+
return this._baseUri;
|
|
3376
|
+
}
|
|
3377
|
+
set baseUri(value) {
|
|
3378
|
+
let oldValue = this._baseUri;
|
|
3379
|
+
this._baseUri = value;
|
|
3380
|
+
if (oldValue != this._baseUri) {
|
|
3381
|
+
this.onBaseUriChanged(oldValue, this._baseUri);
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
onEntitySetChanged(oldValue, newValue) {
|
|
3385
|
+
if (this.actualDataProvider) {
|
|
3386
|
+
this.actualDataProvider.entitySet = this.entitySet;
|
|
3387
|
+
this.queueAutoRefresh();
|
|
3388
|
+
}
|
|
3389
|
+
this.queueAutoRefresh();
|
|
3390
|
+
}
|
|
3391
|
+
set isFilteringSupportedByServer(v) {
|
|
3392
|
+
this._isFilteringSupportedByServer = v;
|
|
3393
|
+
}
|
|
3394
|
+
get isFilteringSupportedByServer() {
|
|
3395
|
+
return this._isFilteringSupportedByServer;
|
|
3396
|
+
}
|
|
3397
|
+
get_isFilteringSupported() {
|
|
3398
|
+
if (this._isFilteringSupportedByServer) {
|
|
3399
|
+
return true;
|
|
3400
|
+
}
|
|
3401
|
+
return false;
|
|
3402
|
+
}
|
|
3403
|
+
get entitySet() {
|
|
3404
|
+
return this._entitySet;
|
|
3405
|
+
}
|
|
3406
|
+
set entitySet(value) {
|
|
3407
|
+
let oldValue = this._entitySet;
|
|
3408
|
+
this._entitySet = value;
|
|
3409
|
+
if (this._entitySet != oldValue) {
|
|
3410
|
+
this.onEntitySetChanged(oldValue, this._entitySet);
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
onTimeoutMillisecondsChanged(oldValue, newValue) {
|
|
3414
|
+
if (this.actualDataProvider) {
|
|
3415
|
+
this.actualDataProvider.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
get timeoutMilliseconds() {
|
|
3419
|
+
return this._timeoutMilliseconds;
|
|
3420
|
+
}
|
|
3421
|
+
set timeoutMilliseconds(value) {
|
|
3422
|
+
let oldValue = this._timeoutMilliseconds;
|
|
3423
|
+
this._timeoutMilliseconds = value;
|
|
3424
|
+
if (oldValue != this._timeoutMilliseconds) {
|
|
3425
|
+
this.onTimeoutMillisecondsChanged(oldValue, this._timeoutMilliseconds);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
get isSortingSupportedOverride() {
|
|
3429
|
+
return true;
|
|
3430
|
+
}
|
|
3431
|
+
get isFilteringSupportedOverride() {
|
|
3432
|
+
return true;
|
|
3433
|
+
}
|
|
3434
|
+
get isGroupingSupportedOverride() {
|
|
3435
|
+
return this.isAggregationSupportedByServer;
|
|
3436
|
+
}
|
|
3437
|
+
get isAggregationSupportedByServer() {
|
|
3438
|
+
return this._isAggregationSupportedByServer;
|
|
3439
|
+
}
|
|
3440
|
+
set isAggregationSupportedByServer(isSupported) {
|
|
3441
|
+
this._isAggregationSupportedByServer = isSupported;
|
|
3442
|
+
if (this.actualDataProvider) {
|
|
3443
|
+
this.actualDataProvider.isAggregationSupported = this.isAggregationSupportedByServer;
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
get enableJsonp() {
|
|
3447
|
+
return this._enableJsonp;
|
|
3448
|
+
}
|
|
3449
|
+
set enableJsonp(isEnabled) {
|
|
3450
|
+
this._enableJsonp = isEnabled;
|
|
3451
|
+
if (this.actualDataProvider) {
|
|
3452
|
+
this.actualDataProvider.enableJsonp = this.enableJsonp;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
get fixedFullCount() {
|
|
3456
|
+
return this._fixedFullCount;
|
|
3457
|
+
}
|
|
3458
|
+
set fixedFullCount(value) {
|
|
3459
|
+
this._fixedFullCount = value;
|
|
3460
|
+
}
|
|
3461
|
+
get provideFullCount() {
|
|
3462
|
+
return this._provideFullCount;
|
|
3463
|
+
}
|
|
3464
|
+
set provideFullCount(value) {
|
|
3465
|
+
this._provideFullCount = value;
|
|
3466
|
+
if (this.actualDataProvider) {
|
|
3467
|
+
this.actualDataProvider.provideFullCount = this.provideFullCount;
|
|
3468
|
+
this.queueAutoRefresh();
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
get provideOrderByParameter() {
|
|
3472
|
+
return this._provideOrderByParameter;
|
|
3473
|
+
}
|
|
3474
|
+
set provideOrderByParameter(value) {
|
|
3475
|
+
this._provideOrderByParameter = value;
|
|
3476
|
+
if (this.actualDataProvider) {
|
|
3477
|
+
this.actualDataProvider.provideOrderByParameter = this.provideOrderByParameter;
|
|
3478
|
+
this.queueAutoRefresh();
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
get provideFilterParameter() {
|
|
3482
|
+
return this._provideFilterParameter;
|
|
3483
|
+
}
|
|
3484
|
+
set provideFilterParameter(value) {
|
|
3485
|
+
this._provideFilterParameter = value;
|
|
3486
|
+
if (this.actualDataProvider) {
|
|
3487
|
+
this.actualDataProvider.provideFilterParameter = this.provideFilterParameter;
|
|
3488
|
+
this.queueAutoRefresh();
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
get provideAggregationParameter() {
|
|
3492
|
+
return this._provideAggregationParameter;
|
|
3493
|
+
}
|
|
3494
|
+
set provideAggregationParameter(value) {
|
|
3495
|
+
this._provideAggregationParameter = value;
|
|
3496
|
+
if (this.actualDataProvider) {
|
|
3497
|
+
this.actualDataProvider.provideAggregationParameter = this.provideAggregationParameter;
|
|
3498
|
+
this.queueAutoRefresh();
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
get provideAggregatedCount() {
|
|
3502
|
+
return this._provideAggregatedCount;
|
|
3503
|
+
}
|
|
3504
|
+
set provideAggregatedCount(value) {
|
|
3505
|
+
this._provideAggregatedCount = value;
|
|
3506
|
+
if (this.actualDataProvider) {
|
|
3507
|
+
this.actualDataProvider.provideAggregatedCount = this.provideAggregatedCount;
|
|
3508
|
+
this.queueAutoRefresh();
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
get provideUri() {
|
|
3512
|
+
return this._provideUri;
|
|
3513
|
+
}
|
|
3514
|
+
set provideUri(value) {
|
|
3515
|
+
this._provideUri = value;
|
|
3516
|
+
if (this.actualDataProvider) {
|
|
3517
|
+
this.actualDataProvider.provideUri = this.provideUri;
|
|
3518
|
+
this.queueAutoRefresh();
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
get performFetch() {
|
|
3522
|
+
return this._performFetch;
|
|
3523
|
+
}
|
|
3524
|
+
set performFetch(value) {
|
|
3525
|
+
this._performFetch = value;
|
|
3526
|
+
if (this.actualDataProvider) {
|
|
3527
|
+
this.actualDataProvider.performFetch = this.performFetch;
|
|
3528
|
+
this.queueAutoRefresh();
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
get providePagingParameter() {
|
|
3532
|
+
return this._providePagingParameter;
|
|
3533
|
+
}
|
|
3534
|
+
set providePagingParameter(value) {
|
|
3535
|
+
this._providePagingParameter = value;
|
|
3536
|
+
if (this.actualDataProvider) {
|
|
3537
|
+
this.actualDataProvider.providePagingParameter = this.providePagingParameter;
|
|
3538
|
+
this.queueAutoRefresh();
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
get provideDesiredPropertiesParameter() {
|
|
3542
|
+
return this._provideDesiredPropertiesParameter;
|
|
3543
|
+
}
|
|
3544
|
+
set provideDesiredPropertiesParameter(value) {
|
|
3545
|
+
this._provideDesiredPropertiesParameter = value;
|
|
3546
|
+
if (this.actualDataProvider) {
|
|
3547
|
+
this.actualDataProvider.provideDesiredPropertiesParameter = this.provideDesiredPropertiesParameter;
|
|
3548
|
+
this.queueAutoRefresh();
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
get provideItems() {
|
|
3552
|
+
return this._provideItems;
|
|
3553
|
+
}
|
|
3554
|
+
set provideItems(value) {
|
|
3555
|
+
this._provideItems = value;
|
|
3556
|
+
if (this.actualDataProvider) {
|
|
3557
|
+
this.actualDataProvider.provideItems = this.provideItems;
|
|
3558
|
+
this.queueAutoRefresh();
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
clone() {
|
|
3562
|
+
let dataSource = new RestVirtualDataSource();
|
|
3563
|
+
dataSource.executionContext = this.executionContext;
|
|
3564
|
+
dataSource.includeSummaryRowsInSection = this.includeSummaryRowsInSection;
|
|
3565
|
+
dataSource.isSectionCollapsable = this.isSectionCollapsable;
|
|
3566
|
+
dataSource.isSectionExpandedDefault = this.isSectionExpandedDefault;
|
|
3567
|
+
//dataSource.isSectionHeaderNormalRow = this.isSectionHeaderNormalRow;
|
|
3568
|
+
dataSource.isSectionSummaryRowsAtBottom = this.isSectionSummaryRowsAtBottom;
|
|
3569
|
+
//dataSource.isSectionContentVisible = this.isSectionContentVisible;
|
|
3570
|
+
dataSource.primaryKey = this.primaryKey;
|
|
3571
|
+
dataSource.propertiesRequested = this.propertiesRequested;
|
|
3572
|
+
dataSource.sectionHeaderDisplayMode = this.sectionHeaderDisplayMode;
|
|
3573
|
+
dataSource.shouldEmitSectionFooters = this.shouldEmitSectionFooters;
|
|
3574
|
+
dataSource.shouldEmitSectionHeaders = this.shouldEmitSectionHeaders;
|
|
3575
|
+
dataSource.shouldEmitShiftedRows = this.shouldEmitShiftedRows;
|
|
3576
|
+
dataSource.summaryScope = this.summaryScope;
|
|
3577
|
+
for (var i = 0; i < this.groupDescriptions.size(); i++) {
|
|
3578
|
+
dataSource.groupDescriptions.add(this.groupDescriptions.get(i));
|
|
3579
|
+
}
|
|
3580
|
+
for (var i = 0; i < this.sortDescriptions.size(); i++) {
|
|
3581
|
+
dataSource.sortDescriptions.add(this.sortDescriptions.get(i));
|
|
3582
|
+
}
|
|
3583
|
+
for (var i = 0; i < this.filterExpressions.size(); i++) {
|
|
3584
|
+
dataSource.filterExpressions.add(this.filterExpressions.get(i));
|
|
3585
|
+
}
|
|
3586
|
+
for (var i = 0; i < this.summaryDescriptions.size(); i++) {
|
|
3587
|
+
dataSource.summaryDescriptions.add(this.summaryDescriptions.get(i));
|
|
3588
|
+
}
|
|
3589
|
+
dataSource.pageSizeRequested = this.pageSizeRequested;
|
|
3590
|
+
dataSource.maxCachedPages = this.maxCachedPages;
|
|
3591
|
+
dataSource.baseUri = this.baseUri;
|
|
3592
|
+
dataSource.entitySet = this.entitySet;
|
|
3593
|
+
dataSource.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
3594
|
+
dataSource.isAggregationSupportedByServer = this.isAggregationSupportedByServer;
|
|
3595
|
+
dataSource.enableJsonp = this.enableJsonp;
|
|
3596
|
+
dataSource.fixedFullCount = this.fixedFullCount;
|
|
3597
|
+
dataSource.provideAggregationParameter = this.provideAggregationParameter;
|
|
3598
|
+
dataSource.provideAggregatedCount = this.provideAggregatedCount;
|
|
3599
|
+
dataSource.provideFilterParameter = this.provideFilterParameter;
|
|
3600
|
+
dataSource.provideFullCount = this.provideFullCount;
|
|
3601
|
+
dataSource.provideOrderByParameter = this.provideOrderByParameter;
|
|
3602
|
+
dataSource.provideUri = this.provideUri;
|
|
3603
|
+
dataSource.performFetch = this.performFetch;
|
|
3604
|
+
dataSource.providePagingParameter = this.providePagingParameter;
|
|
3605
|
+
dataSource.provideItems = this.provideItems;
|
|
3606
|
+
dataSource.provideDesiredPropertiesParameter = this.provideDesiredPropertiesParameter;
|
|
3607
|
+
return dataSource;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3611
|
+
export { Entity, EntityProperty, EntitySet, LinkedList, LinkedListNode, ODataDataSourcePage, ODataSchemaProvider, ODataVirtualDataSource, ODataVirtualDataSourceDataProvider, ODataVirtualDataSourceDataProviderWorker, ODataVirtualDataSourceDataProviderWorkerSettings, ODataVirtualDataSourceProviderTaskDataHolder, RestVirtualDataSource, RestVirtualDataSourceDataProvider, RestVirtualDataSourceDataProviderWorker, RestVirtualDataSourceDataProviderWorkerSettings, RestVirtualDataSourcePage, RestVirtualDataSourceProviderTaskDataHolder, Schema, first, toArray };
|