igniteui-webcomponents-datasources 7.1.1-beta.1 → 7.1.1-beta.3
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/esm2022/lib/ODataSchemaProvider.js +120 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProvider.js +450 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorker.js +710 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +83 -0
- package/esm2022/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +6 -0
- package/esm2022/lib/RestVirtualDataSourceDataProvider.js +535 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorker.js +762 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +159 -0
- package/esm2022/lib/RestVirtualDataSourceProviderTaskDataHolder.js +6 -0
- package/package.json +14 -10
- 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/ODataSchemaProvider.js +0 -123
- 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/RestVirtualDataSourceDataProvider.js +0 -538
- package/esm2015/lib/RestVirtualDataSourceDataProviderWorker.js +0 -765
- package/esm2015/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +0 -162
- package/esm2015/lib/RestVirtualDataSourceProviderTaskDataHolder.js +0 -9
- 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/igniteui-webcomponents-datasources.d.ts +0 -1
- /package/{lib → esm2022/lib}/Entity.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/Entity.js +0 -0
- /package/{lib → esm2022/lib}/EntityProperty.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/EntityProperty.js +0 -0
- /package/{lib → esm2022/lib}/EntitySet.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/EntitySet.js +0 -0
- /package/{lib → esm2022/lib}/ODataDataSourcePage.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/ODataDataSourcePage.js +0 -0
- /package/{lib → esm2022/lib}/ODataSchemaProvider.d.ts +0 -0
- /package/{lib → esm2022/lib}/ODataVirtualDataSource.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/ODataVirtualDataSource.js +0 -0
- /package/{lib → esm2022/lib}/ODataVirtualDataSourceDataProvider.d.ts +0 -0
- /package/{lib → esm2022/lib}/ODataVirtualDataSourceDataProviderWorker.d.ts +0 -0
- /package/{lib → esm2022/lib}/ODataVirtualDataSourceDataProviderWorkerSettings.d.ts +0 -0
- /package/{lib → esm2022/lib}/ODataVirtualDataSourceProviderTaskDataHolder.d.ts +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSource.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/RestVirtualDataSource.js +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSourceDataProvider.d.ts +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSourceDataProviderWorker.d.ts +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSourceDataProviderWorkerSettings.d.ts +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSourcePage.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/RestVirtualDataSourcePage.js +0 -0
- /package/{lib → esm2022/lib}/RestVirtualDataSourceProviderTaskDataHolder.d.ts +0 -0
- /package/{lib → esm2022/lib}/Schema.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/Schema.js +0 -0
- /package/{lib → esm2022/lib}/util.d.ts +0 -0
- /package/{esm2015 → esm2022}/lib/util.js +0 -0
- /package/{public_api.d.ts → esm2022/public_api.d.ts} +0 -0
- /package/{esm2015 → esm2022}/public_api.js +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Schema } from "./Schema";
|
|
2
|
+
import { XDocument } from "igniteui-webcomponents-core";
|
|
3
|
+
import { XElement } from "igniteui-webcomponents-core";
|
|
4
|
+
import { XName } from "igniteui-webcomponents-core";
|
|
5
|
+
import { XNamespace } from "igniteui-webcomponents-core";
|
|
6
|
+
import { DataSourceSchemaPropertyType } from "igniteui-webcomponents-core";
|
|
7
|
+
import { ODataDataSourceSchema } from "igniteui-webcomponents-core";
|
|
8
|
+
import { XmlNodeType } from "igniteui-webcomponents-core";
|
|
9
|
+
import { toArray, first } from './util';
|
|
10
|
+
import { fromEnum, typeCast } from "igniteui-webcomponents-core";
|
|
11
|
+
class ODataSchemaProvider {
|
|
12
|
+
static { this.nS = XNamespace.get("http://docs.oasis-open.org/odata/ns/edm"); }
|
|
13
|
+
constructor(metadataDocument) {
|
|
14
|
+
this._entityTypeSchemaNamespace = null;
|
|
15
|
+
this._entitySetSchemaNamespace = null;
|
|
16
|
+
this._schema = null;
|
|
17
|
+
if (null == metadataDocument) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let xmlDoc = XDocument.parse(metadataDocument);
|
|
21
|
+
let schemaElements = toArray(first(fromEnum(first(fromEnum(xmlDoc.elements())).elements())).elements1(XName.get("Schema", ODataSchemaProvider.nS.namespaceName)));
|
|
22
|
+
if (null == schemaElements) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let entitySetElements = null;
|
|
26
|
+
let entityTypeElements = null;
|
|
27
|
+
let elementCount = schemaElements.length;
|
|
28
|
+
let entityContainer = XName.get("EntityContainer", ODataSchemaProvider.nS.namespaceName);
|
|
29
|
+
let entitySet = XName.get("EntitySet", ODataSchemaProvider.nS.namespaceName);
|
|
30
|
+
let namespaceAttribute = XName.get("Namespace", "");
|
|
31
|
+
let entityType = XName.get("EntityType", ODataSchemaProvider.nS.namespaceName);
|
|
32
|
+
for (let i = 0; i < elementCount; i++) {
|
|
33
|
+
let node = schemaElements[i];
|
|
34
|
+
if (node.nodeType != XmlNodeType.Element) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
let schemaElement = schemaElements[i];
|
|
38
|
+
if (null == entitySetElements) {
|
|
39
|
+
let nodes = toArray(schemaElement.elements1(entityContainer));
|
|
40
|
+
if (null != nodes && nodes.length > 0) {
|
|
41
|
+
entitySetElements = toArray((typeCast(XElement.$type, nodes[0])).elements1(entitySet));
|
|
42
|
+
if (null != entitySetElements) {
|
|
43
|
+
this._entitySetSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (null == entityTypeElements) {
|
|
48
|
+
entityTypeElements = toArray(schemaElement.elements1(entityType));
|
|
49
|
+
if (null != entityTypeElements) {
|
|
50
|
+
this._entityTypeSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (null == entitySetElements || null == entityTypeElements) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.schema = new Schema(this._entityTypeSchemaNamespace, entityTypeElements, entitySetElements);
|
|
58
|
+
}
|
|
59
|
+
get schema() {
|
|
60
|
+
return this._schema;
|
|
61
|
+
}
|
|
62
|
+
set schema(value) {
|
|
63
|
+
this._schema = value;
|
|
64
|
+
}
|
|
65
|
+
getODataDataSourceSchema(entitySet) {
|
|
66
|
+
if (this.schema == null) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
let valueNames = [];
|
|
70
|
+
let valueTypes = [];
|
|
71
|
+
let primaryKey = [];
|
|
72
|
+
let es = this.schema.entitySets.get(entitySet);
|
|
73
|
+
if (null != es) {
|
|
74
|
+
let entity = this.schema.entities.get(es.entityName);
|
|
75
|
+
if (null != entity) {
|
|
76
|
+
for (let property of entity.properties.values()) {
|
|
77
|
+
valueNames.push(property.name);
|
|
78
|
+
if (property.type == "Edm.String") {
|
|
79
|
+
valueTypes.push(DataSourceSchemaPropertyType.StringValue);
|
|
80
|
+
}
|
|
81
|
+
else if (property.type == "Edm.Int16" || property.type == "Edm.Int32") {
|
|
82
|
+
valueTypes.push(DataSourceSchemaPropertyType.IntValue);
|
|
83
|
+
}
|
|
84
|
+
else if (property.type == "Edm.Double") {
|
|
85
|
+
valueTypes.push(DataSourceSchemaPropertyType.DoubleValue);
|
|
86
|
+
}
|
|
87
|
+
else if (property.type == "Edm.Single") {
|
|
88
|
+
valueTypes.push(DataSourceSchemaPropertyType.SingleValue);
|
|
89
|
+
}
|
|
90
|
+
else if (property.type == "Edm.Boolean") {
|
|
91
|
+
valueTypes.push(DataSourceSchemaPropertyType.BooleanValue);
|
|
92
|
+
}
|
|
93
|
+
else if (property.type == "Edm.Byte") {
|
|
94
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
95
|
+
}
|
|
96
|
+
else if (property.type == "Edm.DateTime" || property.type == "Edm.DateTimeOffset") {
|
|
97
|
+
valueTypes.push(DataSourceSchemaPropertyType.DateTimeValue);
|
|
98
|
+
}
|
|
99
|
+
else if (property.type == "Edm.Int64") {
|
|
100
|
+
valueTypes.push(DataSourceSchemaPropertyType.LongValue);
|
|
101
|
+
}
|
|
102
|
+
else if (property.type == "Edm.Decimal") {
|
|
103
|
+
valueTypes.push(DataSourceSchemaPropertyType.DecimalValue);
|
|
104
|
+
}
|
|
105
|
+
else if (property.type == "Edm.SByte") {
|
|
106
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
valueTypes.push(DataSourceSchemaPropertyType.ObjectValue);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (let k of entity.primaryKey) {
|
|
113
|
+
primaryKey.push(k);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return new ODataDataSourceSchema(valueNames, valueTypes, primaryKey);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export { ODataSchemaProvider };
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { Base, runOn, markType } from "igniteui-webcomponents-core";
|
|
2
|
+
import { IDataSourceVirtualDataProvider_$type } from "igniteui-webcomponents-core";
|
|
3
|
+
import { SortDescriptionCollection } from "igniteui-webcomponents-core";
|
|
4
|
+
import { FilterExpressionCollection } from "igniteui-webcomponents-core";
|
|
5
|
+
import { LinkedList } from "./util";
|
|
6
|
+
import { DataSourcePageRequestPriority } from "igniteui-webcomponents-core";
|
|
7
|
+
import { ODataVirtualDataSourceDataProviderWorker } from "./ODataVirtualDataSourceDataProviderWorker";
|
|
8
|
+
import { ODataVirtualDataSourceDataProviderWorkerSettings } from "./ODataVirtualDataSourceDataProviderWorkerSettings";
|
|
9
|
+
import { DataSourceDataProviderSchemaChangedEventArgs } from "igniteui-webcomponents-core";
|
|
10
|
+
import { DataSourceSchemaPropertyType } from "igniteui-webcomponents-core";
|
|
11
|
+
import { stringContains } from "igniteui-webcomponents-core";
|
|
12
|
+
import { SummaryDescriptionCollection } from "igniteui-webcomponents-core";
|
|
13
|
+
class ODataVirtualDataSourceDataProvider extends Base {
|
|
14
|
+
static { this.$t = markType(ODataVirtualDataSourceDataProvider, 'ODataVirtualDataSourceDataProvider', Base.$type, [IDataSourceVirtualDataProvider_$type]); }
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this._worker = null;
|
|
18
|
+
this._requests = new LinkedList();
|
|
19
|
+
this._callback = null;
|
|
20
|
+
this._pageLoaded = null;
|
|
21
|
+
this._pageSizeRequested = 50;
|
|
22
|
+
this._baseUri = null;
|
|
23
|
+
this._entitySet = null;
|
|
24
|
+
this._timeoutMilliseconds = 10000;
|
|
25
|
+
this.schemaChanged = null;
|
|
26
|
+
this._currentFullCount = 0;
|
|
27
|
+
this._currentSchema = null;
|
|
28
|
+
this._executionContext = null;
|
|
29
|
+
this._updateNotifier = null;
|
|
30
|
+
this._deferAutoRefresh = false;
|
|
31
|
+
this._sortDescriptions = null;
|
|
32
|
+
this._groupDescriptions = null;
|
|
33
|
+
this._propertiesRequested = null;
|
|
34
|
+
this._schemaIncludedProperties = null;
|
|
35
|
+
this._filterExpressions = null;
|
|
36
|
+
this._summaryDescriptions = null;
|
|
37
|
+
this._enableJsonp = true;
|
|
38
|
+
this._schemaFetchQueued = false;
|
|
39
|
+
this._autoRefreshQueued = false;
|
|
40
|
+
this._batchCompleted = null;
|
|
41
|
+
this._sortDescriptions = new SortDescriptionCollection();
|
|
42
|
+
this._sortDescriptions.onChanged = () => this.sortDescriptions_CollectionChanged(null, null);
|
|
43
|
+
this._groupDescriptions = new SortDescriptionCollection();
|
|
44
|
+
this._groupDescriptions.onChanged = () => this.groupDescriptions_CollectionChanged(null, null);
|
|
45
|
+
this._filterExpressions = new FilterExpressionCollection();
|
|
46
|
+
this._filterExpressions.onChanged = () => this.filterExpressions_CollectionChanged(null, null);
|
|
47
|
+
this._summaryDescriptions = new SummaryDescriptionCollection();
|
|
48
|
+
this._summaryDescriptions.onChanged = () => this.summaryDescriptions_CollectionChanged(null, null);
|
|
49
|
+
}
|
|
50
|
+
filterExpressions_CollectionChanged(sender, e) {
|
|
51
|
+
this.queueAutoRefresh();
|
|
52
|
+
}
|
|
53
|
+
sortDescriptions_CollectionChanged(sender, e) {
|
|
54
|
+
this.queueAutoRefresh();
|
|
55
|
+
}
|
|
56
|
+
groupDescriptions_CollectionChanged(sender, e) {
|
|
57
|
+
this.queueAutoRefresh();
|
|
58
|
+
}
|
|
59
|
+
summaryDescriptions_CollectionChanged(sender, e) {
|
|
60
|
+
this.queueAutoRefresh();
|
|
61
|
+
}
|
|
62
|
+
addPageRequest(pageIndex, priority) {
|
|
63
|
+
if (this.deferAutoRefresh) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this._worker != null && this._worker.isShutdown) {
|
|
67
|
+
this._worker = null;
|
|
68
|
+
this._callback = null;
|
|
69
|
+
}
|
|
70
|
+
if (this._worker == null) {
|
|
71
|
+
this.createWorker();
|
|
72
|
+
}
|
|
73
|
+
if (priority == DataSourcePageRequestPriority.High) {
|
|
74
|
+
this._requests.addFirst(pageIndex);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this._requests.addLast(pageIndex);
|
|
78
|
+
}
|
|
79
|
+
if (!this._worker.addPageRequest(pageIndex, priority)) {
|
|
80
|
+
this._worker = null;
|
|
81
|
+
this._callback = null;
|
|
82
|
+
this.addPageRequest(pageIndex, priority);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
createWorker() {
|
|
86
|
+
if (!this.valid()) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this._callback = runOn(this, this.raisePageLoaded);
|
|
90
|
+
let settings = this.getWorkerSettings();
|
|
91
|
+
this._worker = new ODataVirtualDataSourceDataProviderWorker(settings);
|
|
92
|
+
}
|
|
93
|
+
valid() {
|
|
94
|
+
return this.entitySet != null && this.baseUri != null;
|
|
95
|
+
}
|
|
96
|
+
getWorkerSettings() {
|
|
97
|
+
return ((() => {
|
|
98
|
+
let $ret = new ODataVirtualDataSourceDataProviderWorkerSettings();
|
|
99
|
+
$ret.baseUri = this._baseUri;
|
|
100
|
+
$ret.entitySet = this._entitySet;
|
|
101
|
+
$ret.pageSizeRequested = this._pageSizeRequested;
|
|
102
|
+
$ret.timeoutMilliseconds = this._timeoutMilliseconds;
|
|
103
|
+
$ret.pageLoaded = this._callback;
|
|
104
|
+
$ret.batchCompleted = this._batchCompleted;
|
|
105
|
+
$ret.executionContext = this._executionContext;
|
|
106
|
+
$ret.sortDescriptions = this._sortDescriptions;
|
|
107
|
+
$ret.groupDescriptions = this._groupDescriptions;
|
|
108
|
+
$ret.filterExpressions = this._filterExpressions;
|
|
109
|
+
$ret.propertiesRequested = this._propertiesRequested;
|
|
110
|
+
$ret.schemaIncludedProperties = this._schemaIncludedProperties;
|
|
111
|
+
$ret.summaryDescriptions = this._summaryDescriptions;
|
|
112
|
+
$ret.summaryScope = this._summaryScope;
|
|
113
|
+
$ret.enableJsonp = this._enableJsonp;
|
|
114
|
+
$ret.isAggregationSupported = this.isAggregationSupported;
|
|
115
|
+
return $ret;
|
|
116
|
+
})());
|
|
117
|
+
}
|
|
118
|
+
removePageRequest(pageIndex) {
|
|
119
|
+
let current = this._requests.first;
|
|
120
|
+
while (current != null) {
|
|
121
|
+
if (current.value == pageIndex) {
|
|
122
|
+
this._requests.remove(current);
|
|
123
|
+
}
|
|
124
|
+
current = current.next;
|
|
125
|
+
}
|
|
126
|
+
if (this._worker == null) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this._worker.removePageRequest(pageIndex);
|
|
130
|
+
}
|
|
131
|
+
removeAllPageRequests() {
|
|
132
|
+
this._requests.clear();
|
|
133
|
+
if (this._worker == null) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this._worker.removeAllPageRequests();
|
|
137
|
+
}
|
|
138
|
+
close() {
|
|
139
|
+
if (this._worker != null) {
|
|
140
|
+
this._worker.shutdown();
|
|
141
|
+
this._worker = null;
|
|
142
|
+
this._callback = null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
get pageLoaded() {
|
|
146
|
+
return this._pageLoaded;
|
|
147
|
+
}
|
|
148
|
+
set pageLoaded(value) {
|
|
149
|
+
this._pageLoaded = value;
|
|
150
|
+
this.queueAutoRefresh();
|
|
151
|
+
}
|
|
152
|
+
raisePageLoaded(page, fullCount, actualPageSize) {
|
|
153
|
+
if (this._pageLoaded != null) {
|
|
154
|
+
this._currentFullCount = fullCount;
|
|
155
|
+
if (this._currentSchema == null) {
|
|
156
|
+
let currentSchema = null;
|
|
157
|
+
if (page != null) {
|
|
158
|
+
currentSchema = page.schema();
|
|
159
|
+
}
|
|
160
|
+
this._currentSchema = currentSchema;
|
|
161
|
+
if (this.schemaChanged != null) {
|
|
162
|
+
this.schemaChanged(this, new DataSourceDataProviderSchemaChangedEventArgs(this._currentSchema, this._currentFullCount));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (page.pageIndex() != ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
|
|
166
|
+
this._pageLoaded(page, fullCount, actualPageSize);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
killWorker() {
|
|
171
|
+
if (this._worker != null) {
|
|
172
|
+
this._worker.shutdown();
|
|
173
|
+
this._worker = null;
|
|
174
|
+
this._callback = null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
get pageSizeRequested() {
|
|
178
|
+
return this._pageSizeRequested;
|
|
179
|
+
}
|
|
180
|
+
set pageSizeRequested(value) {
|
|
181
|
+
this._pageSizeRequested = value;
|
|
182
|
+
this.queueAutoRefresh();
|
|
183
|
+
}
|
|
184
|
+
get baseUri() {
|
|
185
|
+
return this._baseUri;
|
|
186
|
+
}
|
|
187
|
+
set baseUri(value) {
|
|
188
|
+
let oldValue = this._baseUri;
|
|
189
|
+
this._baseUri = value;
|
|
190
|
+
if (oldValue != this._baseUri) {
|
|
191
|
+
this.queueAutoRefresh();
|
|
192
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
193
|
+
this.queueSchemaFetch();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
get entitySet() {
|
|
198
|
+
return this._entitySet;
|
|
199
|
+
}
|
|
200
|
+
set entitySet(value) {
|
|
201
|
+
let oldValue = this._entitySet;
|
|
202
|
+
this._entitySet = value;
|
|
203
|
+
if (oldValue != this._entitySet) {
|
|
204
|
+
this.queueAutoRefresh();
|
|
205
|
+
if (this.valid() && this.deferAutoRefresh) {
|
|
206
|
+
this.queueSchemaFetch();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
get timeoutMilliseconds() {
|
|
211
|
+
return this._timeoutMilliseconds;
|
|
212
|
+
}
|
|
213
|
+
set timeoutMilliseconds(value) {
|
|
214
|
+
this._timeoutMilliseconds = value;
|
|
215
|
+
this.queueAutoRefresh();
|
|
216
|
+
}
|
|
217
|
+
getItemValue(item, valueName) {
|
|
218
|
+
let dic = item;
|
|
219
|
+
if (dic.has(valueName)) {
|
|
220
|
+
return dic.get(valueName);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
setItemValue(item, valueName, value) {
|
|
227
|
+
// does nothing for virtual data.
|
|
228
|
+
}
|
|
229
|
+
removeItem(item) {
|
|
230
|
+
// does nothing for virtual data.
|
|
231
|
+
}
|
|
232
|
+
addItem(item) {
|
|
233
|
+
// does nothing for virtual data.
|
|
234
|
+
}
|
|
235
|
+
get actualCount() {
|
|
236
|
+
return this._currentFullCount;
|
|
237
|
+
}
|
|
238
|
+
get actualSchema() {
|
|
239
|
+
return this._currentSchema;
|
|
240
|
+
}
|
|
241
|
+
get executionContext() {
|
|
242
|
+
return this._executionContext;
|
|
243
|
+
}
|
|
244
|
+
set executionContext(value) {
|
|
245
|
+
this._executionContext = value;
|
|
246
|
+
this.queueAutoRefresh();
|
|
247
|
+
}
|
|
248
|
+
get updateNotifier() {
|
|
249
|
+
return this._updateNotifier;
|
|
250
|
+
}
|
|
251
|
+
set updateNotifier(value) {
|
|
252
|
+
this._updateNotifier = value;
|
|
253
|
+
}
|
|
254
|
+
get deferAutoRefresh() {
|
|
255
|
+
return this._deferAutoRefresh;
|
|
256
|
+
}
|
|
257
|
+
set deferAutoRefresh(value) {
|
|
258
|
+
this._deferAutoRefresh = value;
|
|
259
|
+
if (!this._deferAutoRefresh) {
|
|
260
|
+
this.queueAutoRefresh();
|
|
261
|
+
}
|
|
262
|
+
if (this._deferAutoRefresh && this.valid() && this._currentSchema == null) {
|
|
263
|
+
this.queueSchemaFetch();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
get isSortingSupported() {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
get isGroupingSupported() {
|
|
270
|
+
return this.isAggregationSupported;
|
|
271
|
+
}
|
|
272
|
+
get isFilteringSupported() {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
get isAggregationSupported() {
|
|
276
|
+
return this._isAggregationSupported;
|
|
277
|
+
}
|
|
278
|
+
set isAggregationSupported(isSupported) {
|
|
279
|
+
this._isAggregationSupported = isSupported;
|
|
280
|
+
}
|
|
281
|
+
get sortDescriptions() {
|
|
282
|
+
return this._sortDescriptions;
|
|
283
|
+
}
|
|
284
|
+
get groupDescriptions() {
|
|
285
|
+
return this._groupDescriptions;
|
|
286
|
+
}
|
|
287
|
+
get propertiesRequested() {
|
|
288
|
+
return this._propertiesRequested;
|
|
289
|
+
}
|
|
290
|
+
set propertiesRequested(value) {
|
|
291
|
+
this._propertiesRequested = value;
|
|
292
|
+
this.queueAutoRefresh();
|
|
293
|
+
}
|
|
294
|
+
get schemaIncludedProperties() {
|
|
295
|
+
return this._schemaIncludedProperties;
|
|
296
|
+
}
|
|
297
|
+
set schemaIncludedProperties(value) {
|
|
298
|
+
this._schemaIncludedProperties = value;
|
|
299
|
+
this.queueAutoRefresh();
|
|
300
|
+
}
|
|
301
|
+
get filterExpressions() {
|
|
302
|
+
return this._filterExpressions;
|
|
303
|
+
}
|
|
304
|
+
get summaryDescriptions() {
|
|
305
|
+
return this._summaryDescriptions;
|
|
306
|
+
}
|
|
307
|
+
get summaryScope() {
|
|
308
|
+
return this._summaryScope;
|
|
309
|
+
}
|
|
310
|
+
set summaryScope(value) {
|
|
311
|
+
this._summaryScope = value;
|
|
312
|
+
}
|
|
313
|
+
get enableJsonp() {
|
|
314
|
+
return this._enableJsonp;
|
|
315
|
+
}
|
|
316
|
+
set enableJsonp(isEnabled) {
|
|
317
|
+
this._enableJsonp = isEnabled;
|
|
318
|
+
}
|
|
319
|
+
get notifyUsingSourceIndexes() {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
get isItemIndexLookupSupported() {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
get isKeyIndexLookupSupported() {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
notifySetItem(index, oldItem, newItem) {
|
|
329
|
+
if (this.updateNotifier != null) {
|
|
330
|
+
this.updateNotifier.notifySetItem(index, oldItem, newItem);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
notifyClearItems() {
|
|
334
|
+
if (this.updateNotifier != null) {
|
|
335
|
+
this.updateNotifier.notifyClearItems();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
notifyInsertItem(index, newItem) {
|
|
339
|
+
if (this.updateNotifier != null) {
|
|
340
|
+
this.updateNotifier.notifyInsertItem(index, newItem);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
notifyRemoveItem(index, oldItem) {
|
|
344
|
+
if (this.updateNotifier != null) {
|
|
345
|
+
this.updateNotifier.notifyRemoveItem(index, oldItem);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
queueSchemaFetch() {
|
|
349
|
+
if (this._schemaFetchQueued) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (this.executionContext != null) {
|
|
353
|
+
this._schemaFetchQueued = true;
|
|
354
|
+
this.executionContext.enqueueAction(runOn(this, this.doSchemaFetchInternal));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
doSchemaFetchInternal() {
|
|
358
|
+
if (!this._schemaFetchQueued) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
this._schemaFetchQueued = false;
|
|
362
|
+
this.schemaFetchInternal();
|
|
363
|
+
}
|
|
364
|
+
schemaFetchInternal() {
|
|
365
|
+
this.schemaFetchInternalOverride();
|
|
366
|
+
}
|
|
367
|
+
schemaFetchInternalOverride() {
|
|
368
|
+
if (!this.deferAutoRefresh) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
this.removeAllPageRequests();
|
|
372
|
+
this.killWorker();
|
|
373
|
+
this.createWorker();
|
|
374
|
+
this.addSchemaRequest();
|
|
375
|
+
}
|
|
376
|
+
addSchemaRequest() {
|
|
377
|
+
this._worker.addPageRequest(ODataVirtualDataSourceDataProviderWorker.schemaRequestIndex, DataSourcePageRequestPriority.High);
|
|
378
|
+
}
|
|
379
|
+
queueAutoRefresh() {
|
|
380
|
+
if (this.deferAutoRefresh) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (this._autoRefreshQueued) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (this.executionContext != null) {
|
|
387
|
+
this._autoRefreshQueued = true;
|
|
388
|
+
this.executionContext.enqueueAction(runOn(this, this.doRefreshInternal));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
doRefreshInternal() {
|
|
392
|
+
if (this.deferAutoRefresh) {
|
|
393
|
+
this._autoRefreshQueued = false;
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (!this._autoRefreshQueued) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
this._autoRefreshQueued = false;
|
|
400
|
+
this.refreshInternal();
|
|
401
|
+
}
|
|
402
|
+
refreshInternal() {
|
|
403
|
+
this.refreshInternalOverride();
|
|
404
|
+
}
|
|
405
|
+
refreshInternalOverride() {
|
|
406
|
+
this.removeAllPageRequests();
|
|
407
|
+
this.killWorker();
|
|
408
|
+
this.createWorker();
|
|
409
|
+
this._worker.addPageRequest(0, DataSourcePageRequestPriority.Normal);
|
|
410
|
+
}
|
|
411
|
+
flushAutoRefresh() {
|
|
412
|
+
this.doRefreshInternal();
|
|
413
|
+
}
|
|
414
|
+
refresh() {
|
|
415
|
+
this.refreshInternal();
|
|
416
|
+
}
|
|
417
|
+
indexOfItem(item) {
|
|
418
|
+
return -1;
|
|
419
|
+
}
|
|
420
|
+
indexOfKey(key) {
|
|
421
|
+
return -1;
|
|
422
|
+
}
|
|
423
|
+
resolveSchemaPropertyType(propertyPath) {
|
|
424
|
+
if (this.actualSchema == null) {
|
|
425
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
426
|
+
}
|
|
427
|
+
if (stringContains(propertyPath, ".")) {
|
|
428
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
429
|
+
}
|
|
430
|
+
for (let i = 0; i < this.actualSchema.propertyNames.length; i++) {
|
|
431
|
+
let name = this.actualSchema.propertyNames[i];
|
|
432
|
+
if (name == propertyPath) {
|
|
433
|
+
return this.actualSchema.propertyTypes[i];
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return DataSourceSchemaPropertyType.ObjectValue;
|
|
437
|
+
}
|
|
438
|
+
createBatchRequest(changes) {
|
|
439
|
+
if (this._worker) {
|
|
440
|
+
this._worker.createBatchRequest(changes);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
get batchCompleted() {
|
|
444
|
+
return this._batchCompleted;
|
|
445
|
+
}
|
|
446
|
+
set batchCompleted(value) {
|
|
447
|
+
this._batchCompleted = value;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
export { ODataVirtualDataSourceDataProvider };
|