Qore ServiceNowRestDataProvider Module Reference 1.2.1
Loading...
Searching...
No Matches
ServiceNowTableDataProvider.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
30 hash<string, AbstractDataField> record_type;
31
32 #! The original field type names
33 hash<string, string> field_types;
34
35 #! Hash of date/time fields for this record
36 hash<string, bool> date_time_fields;
37
38 #! Hash of boolean fields for this record
39 hash<string, bool> bool_fields;
40
41 #! Hash of integer fields for this record
42 hash<string, bool> int_fields;
43}
44
47
48public:
50 string name;
51
53 hash<auto> access;
54
56 hash<auto> meta;
57
59 const SysColumns = {
60 "sys_created_by": {
61 "internal_type": {
62 "value": "string",
63 }
64 },
65 "sys_created_on": {
66 "internal_type": {
67 "value": "glide_date_time",
68 }
69 },
70 "sys_updated_by": {
71 "internal_type": {
72 "value": "string",
73 }
74 },
75 "sys_updated_on": {
76 "internal_type": {
77 "value": "glide_date_time",
78 }
79 },
80 };
81
83 const Expressions = {
84 DP_OP_AND: {
85 "exp": AbstractDataProvider::GenericExpressions{DP_OP_AND},
86 "impl": string sub (*string ignored, auto arg) {
87 throw "WHERE-ERROR", "ServiceNow does not support nested boolean logic in queries";
88 },
89 },
91 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_EQ}, QUERY_OP_EQ),
92 "impl": string sub (string cn, auto arg) {
93 return sprintf("%s=%s", cn, arg);
94 },
95 },
97 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_NE}, QUERY_OP_NE),
98 "impl": string sub (string cn, auto arg) {
99 return sprintf("%s!=%s", cn, arg);
100 },
101 },
102 QUERY_OP_LT: {
103 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LT}, QUERY_OP_LT),
104 "impl": string sub (string cn, auto arg) {
105 return sprintf("%s<%s", cn, arg);
106 },
107 },
108 QUERY_OP_LE: {
109 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_LE}, QUERY_OP_LE),
110 "impl": string sub (string cn, auto arg) {
111 return sprintf("%s<=%s", cn, arg);
112 },
113 },
114 QUERY_OP_GT: {
115 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GT}, QUERY_OP_GT),
116 "impl": string sub (string cn, auto arg) {
117 return sprintf("%s>%s", cn, arg);
118 },
119 },
120 QUERY_OP_GE: {
121 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_GE}, QUERY_OP_GE),
122 "impl": string sub (string cn, auto arg) {
123 return sprintf("%s>=%s", cn, arg);
124 },
125 },
126 QUERY_OP_IN: {
127 "exp": sym(AbstractDataProvider::GenericExpressions{DP_SEARCH_OP_IN}, QUERY_OP_IN),
128 "impl": string sub (string cn, auto arg) {
129 return sprintf("%sIN%s", cn, (foldl $1 + "," + $2, arg));
130 },
131 },
133 "exp": <DataProviderExpressionInfo>{
134 "type": DET_Operator,
135 "label": QUERY_OP_NOTIN,
136 "name": "notin",
137 "desc": "An expression with the ServiceNow 'notin' operator",
138 "symbol": "NOTIN",
139 "args": (DataProviderSignatureFieldType, DataProviderSignatureStringValueType),
140 "return_type": AbstractDataProviderTypeMap."bool",
141 },
142 "impl": string sub (string cn, auto arg) {
143 return sprintf("%sNOTIN%s", cn, (foldl $1 + "," + $2, arg));
144 },
145 },
147 "exp": <DataProviderExpressionInfo>{
148 "type": DET_Operator,
149 "label": QUERY_OP_LIKE,
150 "name": "like",
151 "desc": "An expression with the ServiceNow 'like' operator",
152 "symbol": "LIKE",
153 "args": (DataProviderSignatureFieldType, DataProviderSignatureStringValueType),
154 "return_type": AbstractDataProviderTypeMap."bool",
155 },
156 "impl": string sub (string cn, auto arg) {
157 return sprintf("%sLIKE%s", cn, arg);
158 },
159 },
161 "exp": <DataProviderExpressionInfo>{
162 "type": DET_Operator,
163 "label": QUERY_OP_NOTLIKE,
164 "name": "notlike",
165 "desc": "An expression with the ServiceNow 'notlike' operator",
166 "symbol": "NOTLIKE",
167 "args": (DataProviderSignatureFieldType, DataProviderSignatureStringValueType),
168 "return_type": AbstractDataProviderTypeMap."bool",
169 },
170 "impl": string sub (string cn, auto arg) {
171 return sprintf("%sNOTLIKE%s", cn, arg);
172 },
173 },
175 "exp": <DataProviderExpressionInfo>{
176 "type": DET_Operator,
177 "label": QUERY_OP_STARTSWITH,
178 "name": "like",
179 "desc": "An expression with the ServiceNow 'startswith' operator",
180 "symbol": "STARTSWITH",
181 "args": (DataProviderSignatureFieldType, DataProviderSignatureStringValueType),
182 "return_type": AbstractDataProviderTypeMap."bool",
183 },
184 "impl": string sub (string cn, auto arg) {
185 return sprintf("%sSTARTSWITH%s", cn, arg);
186 },
187 },
189 "exp": <DataProviderExpressionInfo>{
190 "type": DET_Operator,
191 "label": QUERY_OP_ENDSWITH,
192 "name": "like",
193 "desc": "An expression with the ServiceNow 'endswith' operator",
194 "symbol": "ENDSWITH",
195 "args": (DataProviderSignatureFieldType, DataProviderSignatureStringValueType),
196 "return_type": AbstractDataProviderTypeMap."bool",
197 },
198 "impl": string sub (string cn, auto arg) {
199 return sprintf("%sISEMPTY", cn);
200 },
201 },
203 "exp": <DataProviderExpressionInfo>{
204 "type": DET_Operator,
205 "label": QUERY_OP_ISNOTEMPTY,
206 "name": "notlike",
207 "desc": "An expression with the ServiceNow 'isnotempty' operator",
208 "symbol": "ISNOTEMPTY",
209 "args": (DataProviderSignatureFieldType,),
210 "return_type": AbstractDataProviderTypeMap."bool",
211 },
212 "impl": string sub (string cn, auto arg) {
213 return sprintf("%sISNOTEMPTY", cn);
214 },
215 },
216 };
217
218protected:
220 hash<ServiceNowRestRecordInfo> record_info();
221
223 string uri_path = "table/";
224
225public:
226
228 constructor(ServiceNowRestClient rest, string name, hash<auto> access, hash<auto> meta) ;
229
230
232 string getName();
233
234
236 string getDesc();
237
238
239protected:
240 *hash<string, DataProvider::AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
241public:
242
243
245
250protected:
251 DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
252public:
253
254
256protected:
257 hash<DataProvider::DataProviderInfo> getStaticInfoImpl();
258public:
259
260
262
270protected:
271 *hash<auto> createRecordImpl(hash<auto> rec, *hash<auto> create_options);
272public:
273
274
276
282protected:
283 int updateRecordsImpl(hash<auto> set, hash<DataProviderExpression> where_cond, *hash<auto> search_options);
284public:
285
286
288
294protected:
295 int deleteRecordsImpl(*hash<DataProviderExpression> where_cond, *hash<auto> search_options);
296public:
297
298
300protected:
301 updateSingleRecord(string id, hash<auto> set);
302public:
303
304
306protected:
308public:
309
310
312protected:
314public:
315
316
318protected:
319 hash<DataProviderExpression> getEqualityComparisonExpression(int role, hash<DataProviderInfo> info, string key, auto value);
320public:
321
322};
323};
324
325namespace Priv {
326hash<DataProviderExpressionInfo> sym(hash<DataProviderExpressionInfo> exp, string label);
327
328};
The ServiceNowRest data provider class.
Definition: ServiceNowRestDataProviderBase.qc.dox.h:28
ServiceNowRestClient::ServiceNowRestClient rest
The REST client object for API calls.
Definition: ServiceNowRestDataProviderBase.qc.dox.h:33
The ServiceNowTableDataProvider data provider class.
Definition: ServiceNowTableDataProvider.qc.dox.h:46
const SysColumns
System columns.
Definition: ServiceNowTableDataProvider.qc.dox.h:59
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Creates the given record to the data provider.
hash< DataProviderExpression > getEqualityComparisonExpression(int role, hash< DataProviderInfo > info, string key, auto value)
Returns an equality comparison expression.
hash< auto > meta
Metadata description.
Definition: ServiceNowTableDataProvider.qc.dox.h:56
int updateRecordsImpl(hash< auto > set, hash< DataProviderExpression > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
hash< auto > access
Access description.
Definition: ServiceNowTableDataProvider.qc.dox.h:53
deleteSingleRecord(string id)
deletes a single record
updateSingleRecord(string id, hash< auto > set)
updates a single record
string uri_path
URI path prefix.
Definition: ServiceNowTableDataProvider.qc.dox.h:223
constructor(ServiceNowRestClient rest, string name, hash< auto > access, hash< auto > meta)
Creates the object from the arguments.
const Expressions
Supported expressions.
Definition: ServiceNowTableDataProvider.qc.dox.h:83
string name
Current object name.
Definition: ServiceNowTableDataProvider.qc.dox.h:50
DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
hash< ServiceNowRestRecordInfo > record_info()
Record info for the table.
hash< DataProvider::DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
int deleteRecordsImpl(*hash< DataProviderExpression > where_cond, *hash< auto > search_options)
Deletes zero or more records.
string getName()
Returns the data provider name.
string getDesc()
Returns the data provider description.
const QUERY_OP_ENDSWITH
ends with operator
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:50
const QUERY_OP_STARTSWITH
starts with operator
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:55
const QUERY_OP_IN
the Query "IN" operator for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:100
const QUERY_OP_GE
the Query greater than or equals operator (>=) for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:75
const QUERY_OP_NE
the Query not equals operator (!= or <>) for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:80
const QUERY_OP_GT
the Query greater than operator (>) for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:70
const QUERY_OP_LT
the Query less than (<) operator for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:60
const QUERY_OP_LIKE
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:40
const QUERY_OP_LE
the Query less than or equals (<=) operator for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:65
const QUERY_OP_EQ
the Query equals operator (=) for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:85
const QUERY_OP_ISNOTEMPTY
the Query "is not empty string" operator (ISNOTEMPTY) for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:95
const QUERY_OP_NOTIN
the Query "NOTIN" operator for use in queries
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:105
const QUERY_OP_NOTLIKE
not like operator
Definition: ServiceNowRestDataProviderDefs.qc.dox.h:45
Qore ServiceNowRestDataProvider module definition.
Definition: ServiceNowRestDataProvider.qc.dox.h:26
hashdecl ServiceNowRestRecordInfo
contains ServiceNow object record information
Definition: ServiceNowTableDataProvider.qc.dox.h:28