-
Notifications
You must be signed in to change notification settings - Fork 287
Expand file tree
/
Copy pathDatasetService.js
More file actions
126 lines (114 loc) · 4.18 KB
/
Copy pathDatasetService.js
File metadata and controls
126 lines (114 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
* This program are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
import {SuperMap} from '../SuperMap';
import {Util} from '../commontypes/Util';
import {CommonServiceBase} from './CommonServiceBase';
/**
* @class SuperMap.DatasetService
* @category iServer Data Dataset
* @classdesc 数据集查询服务。
* @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
* @param {Object} options - 参数。</br>
* @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
* @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
* @param {string}options.datasource - 要查询的数据集所在的数据源名称。</br>
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
* @param {Object} [options.headers] - 请求头。
*
*/
export class DatasetService extends CommonServiceBase {
constructor(url, options) {
super(url, options);
if(!options){
return;
}
/**
* @member {string} SuperMap.DatasetService.prototype.datasource
* @description 要查询的数据集所在的数据源名称。
*/
this.datasource = null;
/**
* @member {string} SuperMap.DatasetService.prototype.dataset
* @description 要查询的数据集名称。
*/
this.dataset = null;
if (options) {
Util.extend(this, options);
}
this.CLASS_NAME = "SuperMap.DatasetService";
}
/**
* @function SuperMap.DatasetService.prototype.destroy
* @override
*/
destroy() {
super.destroy();
var me = this;
me.datasource = null;
me.dataset = null;
}
/**
* @function SuperMap.DatasetService.prototype.getDatasetsService
* @description 执行服务,查询数据集服务。
*/
getDatasetsService(params) {
var me = this;
me.url = Util.urlPathAppend(me.url,`datasources/name/${params}/datasets`);
me.request({
method: "GET",
data: null,
scope: me,
success: me.serviceProcessCompleted,
failure: me.serviceProcessFailed
});
}
/**
* @function SuperMap.DatasetService.prototype.getDatasetService
* @description 执行服务,查询数据集信息服务。
*/
getDatasetService(datasourceName, datasetName) {
var me = this;
me.url = Util.urlPathAppend(me.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
me.request({
method: "GET",
data: null,
scope: me,
success: me.serviceProcessCompleted,
failure: me.serviceProcessFailed
});
}
/**
* @function SuperMap.DatasetService.prototype.setDatasetService
* @description 执行服务,更改数据集信息服务。
*/
setDatasetService(params) {
if (!params) {
return;
}
var me = this;
var jsonParamsStr = Util.toJSON(params);
me.request({
method: "PUT",
data: jsonParamsStr,
scope: me,
success: me.serviceProcessCompleted,
failure: me.serviceProcessFailed
});
}
/**
* @function SuperMap.DatasetService.prototype.deleteDatasetService
* @description 执行服务,删除数据集信息服务。
*/
deleteDatasetService() {
var me = this;
me.request({
method: "DELETE",
data: null,
scope: me,
success: me.serviceProcessCompleted,
failure: me.serviceProcessFailed
});
}
}
SuperMap.DatasetService = DatasetService;