Qore DataProvider Module Reference 3.1
Loading...
Searching...
No Matches
DataProviderActionCatalog.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
26namespace DataProvider {
28
33public struct DataProviderAppInfo {
35
37 string name;
38
41
43 string short_desc;
44
46 string desc;
47
49 string legal;
50
52
55 *string scheme;
56
58
60 data logo;
61
64
66
71
73
75 bool supports_events = False;
76
78
80 bool supports_apis = False;
81
83
85 bool supports_messages = False;
86
88
90 bool supports_find = False;
91
93
96
98
100 bool supports_create = False;
101
103
105 bool supports_upsert = False;
106
108
110 bool supports_update = False;
111
113
115 bool supports_delete = False;
116
118 bool dynamic = False;
119
121 bool hidden = False;
122
124 *hash<auto> info;
125};
126
133const DPAT_EVENT = 1;
134
136const DPAT_API = 2;
137
140
142const DPAT_FIND = 4;
143
146
148const DPAT_CREATE = 6;
149
151const DPAT_UPSERT = 7;
152
154const DPAT_UPDATE = 8;
155
157const DPAT_DELETE = 9;
159
162
163
166
168const ActionAttrMap = ...;
169
170
172const ActionNameMap = ...;
173
174
176public struct ActionOptionInfo {
179
182
185
187 string desc;
188
191
193
195 *list<string> required_groups;
196
199
202
205
207 *softlist<hash<AllowedValueInfo>> allowed_values;
208
211
213 *softlist<hash<AllowedValueInfo>> element_allowed_values;
214
217
220
222
226 *softlist<softstring> depends_on;
227
229
233 *string ref_data;
234
236
241
243
248
251
254
257
260
262
268 *string loc;
269
272
274 *softlist<softstring> on_change;
275};
276
281
284
286 string desc;
287
290};
291
295 string app;
296
298 string action;
299
301
303 *string subtype;
304
306
308 string path;
309
311
313 *hash<string, hash<DataProviderPathVarInfo>> path_vars;
314
317
320
322 string desc;
323
325
328
330
334 *string action_val;
335
337
341 *string cls;
342
344 *hash<auto> where_add;
345
347 *hash<auto> options_add;
348
350 *hash<auto> set_add;
351
353 *hash<string, hash<ActionOptionInfo>> options;
354
357
360
363
366
369};
370
373
374public:
376 const RequiredAppKeys = ...;
377
378
381
382
383protected:
385 static Mutex lck();
386
388 static hash<string, hash<DataProviderAppInfo>> appcache;
389
391 static hash<string, hash<DataProviderActionInfo>> top_actionmap;
392
394 static hash<string, hash<string, hash<DataProviderActionInfo>>> app_actionmap;
395
397 static hash<string, list<hash<DataProviderActionInfo>>> smap;
398
400 static hash<string, hash<string, bool>> resolve_output_types;
401
403 static hash<string, code> initmap;
404
406 static hash<string, hash<string, code>> initactionmap;
407
410
411public:
412
414
419 static registerPendingApp(string app, code init);
420
422
428 static registerPendingAppAction(string app, string action, code init);
429
431
435 static registerApp(hash<DataProviderAppInfo> app);
436
438
447 static *hash<DataProviderAppInfo> deregisterDynamicApp(string name);
448
450
456 static registerAction(hash<DataProviderActionInfo> action);
457
459
461 static *int checkName(string name);
462
464
466 static int compareActions(hash<DataProviderActionInfo> act0, hash<DataProviderActionInfo> act1);
467
469
471 static int compareOptions(*hash<string, hash<ActionOptionInfo>> opt0, *hash<string, hash<ActionOptionInfo>> opt1);
472
474 static int compareBaseTypes(*Type t0, *Type t1);
475
477
480 static *list<hash<DataProviderAppInfo>> getAllAppsNoInit();
481
483
486 static *list<hash<DataProviderAppInfo>> getAllApps();
487
489
495 static *hash<DataProviderAppInfo> getApp(string app);
496
498
507 static hash<DataProviderAppInfo> getAppEx(string app);
508
510
515 static *list<hash<DataProviderAppInfo>> searchAppRegex(string regex_pattern, int regex_options = RE_Caseless);
516
518
524 static *list<hash<DataProviderAppInfo>> searchAppSubstr(string substr, bool ignore_case = True);
525
527
531 static *list<hash<DataProviderActionInfo>> getActionsForScheme(string scheme);
532
534
540 static *hash<string, hash<DataProviderActionInfo>> getActionHash(string app);
541
543
551 static *hash<string, hash<DataProviderActionInfo>> getActionHashEx(string app);
552
554
560 static *list<hash<DataProviderActionInfo>> getActions(string app);
561
563
571 static list<hash<DataProviderActionInfo>> getActionsEx(string app);
572
574
576 static *list<hash<DataProviderActionInfo>> getAllActions();
577
579
586 static *hash<DataProviderActionInfo> getAppAction(string app, string action);
587
589
600 static hash<DataProviderActionInfo> getAppActionEx(string app, string action);
601
603
608 static AbstractDataProvider getDataProviderForAction(hash<DataProviderActionInfo> action, *reference<hash<auto>> options);
609
611
619 static *list<hash<DataProviderActionInfo>> searchAppActionRegex(string app, string regex_pattern, int regex_options = RE_Caseless);
620
622
630 static *list<hash<DataProviderActionInfo>> searchAppActionSubstr(string app, string substr, bool ignore_case = True);
631
633
643 static *list<hash<DataProviderActionInfo>> searchAppActionRegexEx(string app, string regex_pattern, int regex_options = RE_Caseless);
644
646
656 static *list<hash<DataProviderActionInfo>> searchAppActionSubstrEx(string app, string substr, bool ignore_case = True);
657
659
664 static *list<hash<DataProviderActionInfo>> searchActionRegex(string regex_pattern, int regex_options = RE_Caseless);
665
667
672 static *list<hash<DataProviderActionInfo>> searchActionSubstr(string substr, bool ignore_case = True);
673
675 static hash<string, hash<ActionOptionInfo>> getActionOptionFromFields(hash<auto> fields, *hash<auto> additional_fields);
676
678 static hash<DataProviderActionInfo> checkAppActionOptions(string app, string action);
679
681protected:
682 static string normalizePath(string path);
683public:
684
685
687protected:
689public:
690
691
693private:
694 static *bool deregisterApp(string name);
695public:
696
697
699private:
700 static *bool deregisterAppIntern(string name);
701public:
702
703
705protected:
706 static doInit(code init);
707public:
708
709};
710};
The AbstractDataProvider class.
Definition AbstractDataProvider.qc.dox.h:917
describes a data type
Definition AbstractDataProviderType.qc.dox.h:139
DataProvider action and application catalog class.
Definition DataProviderActionCatalog.qc.dox.h:372
static hash< string, hash< string, hash< DataProviderActionInfo > > > app_actionmap
Action cache, the key is the application key, the second key is the action string.
Definition DataProviderActionCatalog.qc.dox.h:394
static registerApp(hash< DataProviderAppInfo > app)
Registers a data provider application.
const DefaultDescription
Default description.
Definition DataProviderActionCatalog.qc.dox.h:409
static *hash< string, hash< DataProviderActionInfo > > getActionHash(string app)
Returns a hash of all actions for the given application.
static string normalizePath(string path)
Returns a normalized path to ensure that comparisons always work.
static *list< hash< DataProviderActionInfo > > searchAppActionSubstr(string app, string substr, bool ignore_case=True)
Searches for application actions whose descriptions match a substring.
static *int checkName(string name)
Checks for a valid name.
static registerPendingAppAction(string app, string action, code init)
Registers an app action for deferred initialization / initialization on demand.
static hash< DataProviderAppInfo > getAppEx(string app)
Returns the application definition for the given application name.
static hash< string, hash< string, bool > > resolve_output_types
Set of actions requiring output type resolution; app -> action -> True.
Definition DataProviderActionCatalog.qc.dox.h:400
static int compareBaseTypes(*Type t0, *Type t1)
Compares two types for equality.
static *list< hash< DataProviderAppInfo > > getAllApps()
Returns all applications in the cache.
static *hash< DataProviderAppInfo > deregisterDynamicApp(string name)
Removes a dynamic data provider application.
static *list< hash< DataProviderAppInfo > > searchAppSubstr(string substr, bool ignore_case=True)
Searches for applications whose names or descriptions match a substring.
static hash< DataProviderActionInfo > checkAppActionOptions(string app, string action)
Check that the action has had its options initialized if necessary and return the possibly updated ac...
static registerPendingApp(string app, code init)
Registers an app for deferred initialization / initialization on demand.
static hash< string, hash< string, code > > initactionmap
Pending application action init handler map: app -> action -> init handler.
Definition DataProviderActionCatalog.qc.dox.h:406
static doInit(code init)
Runs initialization and catches exceptions.
static int compareActions(hash< DataProviderActionInfo > act0, hash< DataProviderActionInfo > act1)
Compares two actions for equality.
static Mutex lck()
Mutex for atomic operations.
static AbstractDataProvider getDataProviderForAction(hash< DataProviderActionInfo > action, *reference< hash< auto > > options)
Returns a data provider option for the given action and options.
static *list< hash< DataProviderActionInfo > > searchAppActionSubstrEx(string app, string substr, bool ignore_case=True)
Searches for application actions whose descriptions match a substring.
static *list< hash< DataProviderAppInfo > > searchAppRegex(string regex_pattern, int regex_options=RE_Caseless)
Searches for applications whose names or descriptions match a regular expression pattern.
const RequiredAppKeys
Required application key set.
Definition DataProviderActionCatalog.qc.dox.h:376
static hash< DataProviderActionInfo > getAppActionEx(string app, string action)
Returns the application definition for the given application name.
static *hash< DataProviderAppInfo > getApp(string app)
Returns the application definition for the given application name.
static *list< hash< DataProviderActionInfo > > searchAppActionRegexEx(string app, string regex_pattern, int regex_options=RE_Caseless)
Searches for application actions whose descriptions match a regular expression pattern.
static *list< hash< DataProviderActionInfo > > getActionsForScheme(string scheme)
Returns all actions for a particular connection scheme.
static hash< string, code > initmap
Pending application init handler map: app -> init handler.
Definition DataProviderActionCatalog.qc.dox.h:403
static hash< string, hash< ActionOptionInfo > > getActionOptionFromFields(hash< auto > fields, *hash< auto > additional_fields)
Converts field definitions into option descriptions.
static *hash< DataProviderActionInfo > getAppAction(string app, string action)
Returns the action definition for the given application and action.
static *list< hash< DataProviderActionInfo > > searchActionSubstr(string substr, bool ignore_case=True)
Searches for actions whose descriptions match a substring.
static hash< string, hash< DataProviderActionInfo > > top_actionmap
Master action cache, the key <app>/<action>
Definition DataProviderActionCatalog.qc.dox.h:391
static hash< string, list< hash< DataProviderActionInfo > > > smap
Scheme map; keys are connection schemes.
Definition DataProviderActionCatalog.qc.dox.h:397
static int compareOptions(*hash< string, hash< ActionOptionInfo > > opt0, *hash< string, hash< ActionOptionInfo > > opt1)
Compares two option hashes for equality.
static *list< hash< DataProviderActionInfo > > getActions(string app)
Returns all actions for the given application.
static *list< hash< DataProviderActionInfo > > searchAppActionRegex(string app, string regex_pattern, int regex_options=RE_Caseless)
Searches for application actions whose descriptions match a regular expression pattern.
static *bool deregisterAppIntern(string name)
Deregisters an app and all its actions if an exception occurs during the other module's initializatio...
static *list< hash< DataProviderActionInfo > > getAllActions()
Returns all actions in the cache.
static *list< hash< DataProviderAppInfo > > getAllAppsNoInit()
Returns all applications in the cache without initializing actions.
static *list< hash< DataProviderActionInfo > > searchActionRegex(string regex_pattern, int regex_options=RE_Caseless)
Searches for actions whose descriptions match a regular expression pattern.
static *bool deregisterApp(string name)
Deregisters an app and all its actions if an exception occurs during the other module's initializatio...
const RequiredActionKeys
Required action key set (without action_code and path_vars, which are checked separately)
Definition DataProviderActionCatalog.qc.dox.h:380
static hash< string, hash< DataProviderAppInfo > > appcache
Top-level master application cache keyed by application name.
Definition DataProviderActionCatalog.qc.dox.h:388
static list< hash< DataProviderActionInfo > > getActionsEx(string app)
Returns all actions for the given application; throws an exception if the app is not registered.
static resolveOutputTypes()
Resolves output fypes in actions.
static *hash< string, hash< DataProviderActionInfo > > getActionHashEx(string app)
Returns a hash of all actions for the given application.
static registerAction(hash< DataProviderActionInfo > action)
Registers a data provider action.
const DPAT_API
Data Provider Action Type: make an API call.
Definition DataProviderActionCatalog.qc.dox.h:136
const DPAT_FIND_SINGLE
Data Provider Action Type: find a single record.
Definition DataProviderActionCatalog.qc.dox.h:145
const DPAT_SEND_MESSAGE
Data Provider Action Type: send a message.
Definition DataProviderActionCatalog.qc.dox.h:139
const DPAT_EVENT
Definition DataProviderActionCatalog.qc.dox.h:133
const DPAT_UPDATE
Data Provider Action Type: update a record.
Definition DataProviderActionCatalog.qc.dox.h:154
const DPAT_DELETE
Data Provider Action Type: delete a record.
Definition DataProviderActionCatalog.qc.dox.h:157
const DPAT_UPSERT
Data Provider Action Type: upsert a record.
Definition DataProviderActionCatalog.qc.dox.h:151
const DPAT_CREATE
Data Provider Action Type: create a record.
Definition DataProviderActionCatalog.qc.dox.h:148
const DPAT_FIND
Data Provider Action Type: find all matching records.
Definition DataProviderActionCatalog.qc.dox.h:142
Qore AbstractDataField class definition.
Definition AbstractDataField.qc.dox.h:27
const ActionNameMap
Maps action type codes to a user-friendly name.
Definition DataProviderActionCatalog.qc.dox.h:172
const ActionAttrMap
Maps action type codes to a data provider attribute string.
Definition DataProviderActionCatalog.qc.dox.h:168
const ActionCodeFlagMap
Maps action type codes to app action flags.
Definition DataProviderActionCatalog.qc.dox.h:161
const AppActionFlags
List of app action flags.
Definition DataProviderActionCatalog.qc.dox.h:165
Data provider action option definition.
Definition DataProviderActionCatalog.qc.dox.h:176
bool structural_determinate
Does the value of this option determine the structure of other options?
Definition DataProviderActionCatalog.qc.dox.h:271
auto example_value
An optional example value for the option.
Definition DataProviderActionCatalog.qc.dox.h:219
*softlist< hash< AllowedValueInfo > > element_allowed_values
List of allowed values for elements of list types (enum)
Definition DataProviderActionCatalog.qc.dox.h:213
AbstractDataProviderType type
Data type of the option.
Definition DataProviderActionCatalog.qc.dox.h:178
bool readonly
Is this option read-only?
Definition DataProviderActionCatalog.qc.dox.h:256
*softlist< softstring > depends_on
A list of other options that must be set before this option can be chosen.
Definition DataProviderActionCatalog.qc.dox.h:226
*string default_ref_data
A tag allowing the default value to be returned dynamically as reference data.
Definition DataProviderActionCatalog.qc.dox.h:247
*softlist< hash< AllowedValueInfo > > allowed_values
List of allowed values (enum)
Definition DataProviderActionCatalog.qc.dox.h:207
*string loc
Option location for record-based data providers and data providers provided by a class.
Definition DataProviderActionCatalog.qc.dox.h:268
*softlist< softstring > on_change
Any information about how to react to changes.
Definition DataProviderActionCatalog.qc.dox.h:274
bool required
Is the option required or not?
Definition DataProviderActionCatalog.qc.dox.h:190
bool disabled
Is this option disabled?
Definition DataProviderActionCatalog.qc.dox.h:259
auto default_value
Any default value for the option.
Definition DataProviderActionCatalog.qc.dox.h:198
*string dynamic_type
A tag allowing the type of the option to be retrieved at runtime.
Definition DataProviderActionCatalog.qc.dox.h:250
string short_desc
Short description of the option in plain text.
Definition DataProviderActionCatalog.qc.dox.h:184
*list< string > required_groups
Is the option part of a required group?
Definition DataProviderActionCatalog.qc.dox.h:195
bool preselected
If the option should be preselected.
Definition DataProviderActionCatalog.qc.dox.h:253
string desc
Description of the option with markdown rendering.
Definition DataProviderActionCatalog.qc.dox.h:187
bool allowed_values_creatable
Does the option accept values not defined in allowed_values too?
Definition DataProviderActionCatalog.qc.dox.h:210
*string element_ref_data
A tag allowing element allowed values to be returned dynamically as element reference data.
Definition DataProviderActionCatalog.qc.dox.h:240
bool sensitive
Is the option value sensitive?
Definition DataProviderActionCatalog.qc.dox.h:201
*string ref_data
A tag allowing allowed values to be returned dynamically as reference data.
Definition DataProviderActionCatalog.qc.dox.h:233
bool multiselect
Are allowed values elements of the list's element type that indicate what values the list can have?
Definition DataProviderActionCatalog.qc.dox.h:204
string display_name
Display name of the option.
Definition DataProviderActionCatalog.qc.dox.h:181
bool element_allowed_values_creatable
Does the option accept values not defined in element_allowed_values too?
Definition DataProviderActionCatalog.qc.dox.h:216
DataProvider action definition.
Definition DataProviderActionCatalog.qc.dox.h:293
string short_desc
Action short description, plain text formatting.
Definition DataProviderActionCatalog.qc.dox.h:319
bool data_dependent_options
Do options depend on the data for the call?
Definition DataProviderActionCatalog.qc.dox.h:356
*string action_val
Message or event type.
Definition DataProviderActionCatalog.qc.dox.h:334
*code get_output_type
In case the output type is expensive to acquire or requires I/O, this closure can be used to set it.
Definition DataProviderActionCatalog.qc.dox.h:365
*hash< auto > set_add
Values to add to any "set" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:350
string path
Data provider path to action.
Definition DataProviderActionCatalog.qc.dox.h:308
string display_name
The display name for the action.
Definition DataProviderActionCatalog.qc.dox.h:316
*AbstractDataProviderType output_type
Output type for the action.
Definition DataProviderActionCatalog.qc.dox.h:359
int action_code
Action type code.
Definition DataProviderActionCatalog.qc.dox.h:327
string app
Name of the application that provides the action.
Definition DataProviderActionCatalog.qc.dox.h:295
*hash< auto > where_add
Values to add to any "where" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:344
bool has_dynamic_options
Does the action support dynamic options?
Definition DataProviderActionCatalog.qc.dox.h:362
*string subtype
Any data provider subtype.
Definition DataProviderActionCatalog.qc.dox.h:303
string desc
Action long description, markdown formatting.
Definition DataProviderActionCatalog.qc.dox.h:322
*hash< string, hash< DataProviderPathVarInfo > > path_vars
Description of any path variables.
Definition DataProviderActionCatalog.qc.dox.h:313
*hash< auto > options_add
Values to add to any "options" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:347
*hash< string, hash< ActionOptionInfo > > options
Options that can be provided without a data provider.
Definition DataProviderActionCatalog.qc.dox.h:353
*string cls
The DataProvider class.
Definition DataProviderActionCatalog.qc.dox.h:341
*code get_dynamic_options
For the case when options should be generated dynamically.
Definition DataProviderActionCatalog.qc.dox.h:368
string action
The unique name for the action; unique in the application.
Definition DataProviderActionCatalog.qc.dox.h:298
Application information hash.
Definition DataProviderActionCatalog.qc.dox.h:33
string short_desc
A short description for the app, plain text formatting.
Definition DataProviderActionCatalog.qc.dox.h:43
data logo
The application logo.
Definition DataProviderActionCatalog.qc.dox.h:60
bool supports_messages
If the apps supports message actions.
Definition DataProviderActionCatalog.qc.dox.h:85
string desc
Description of the application with markdown formatting.
Definition DataProviderActionCatalog.qc.dox.h:46
string display_name
The display name for the application.
Definition DataProviderActionCatalog.qc.dox.h:40
*hash< auto > info
User-defined info about the app.
Definition DataProviderActionCatalog.qc.dox.h:124
bool dynamic
Was the application added dynamically?
Definition DataProviderActionCatalog.qc.dox.h:118
bool hidden
Should this app be hidden in the front end?
Definition DataProviderActionCatalog.qc.dox.h:121
bool supports_update
If the apps supports update actions.
Definition DataProviderActionCatalog.qc.dox.h:110
string logo_mime_type
The mime type for logo.
Definition DataProviderActionCatalog.qc.dox.h:70
*string scheme
Connection scheme for the application.
Definition DataProviderActionCatalog.qc.dox.h:55
bool supports_events
If the apps supports event actions.
Definition DataProviderActionCatalog.qc.dox.h:75
string name
Unique application name.
Definition DataProviderActionCatalog.qc.dox.h:37
string legal
Any legal text, links, copyright notice(s), or disclaimer(s) related to the use of the app; markdown ...
Definition DataProviderActionCatalog.qc.dox.h:49
bool supports_find_single
If the apps supports find_single actions.
Definition DataProviderActionCatalog.qc.dox.h:95
string logo_file_name
The logo file name.
Definition DataProviderActionCatalog.qc.dox.h:63
bool supports_upsert
If the apps supports upsert actions.
Definition DataProviderActionCatalog.qc.dox.h:105
bool supports_apis
If the apps supports API actions.
Definition DataProviderActionCatalog.qc.dox.h:80
bool supports_create
If the apps supports create actions.
Definition DataProviderActionCatalog.qc.dox.h:100
bool supports_find
If the apps supports find actions.
Definition DataProviderActionCatalog.qc.dox.h:90
bool supports_delete
If the apps supports delete actions.
Definition DataProviderActionCatalog.qc.dox.h:115
DataProvider path var info.
Definition DataProviderActionCatalog.qc.dox.h:278
string desc
Action long description, markdown formatting.
Definition DataProviderActionCatalog.qc.dox.h:286
string display_name
The display name for the action.
Definition DataProviderActionCatalog.qc.dox.h:280
*string example_value
An optional example value for the option.
Definition DataProviderActionCatalog.qc.dox.h:289
string short_desc
Action short description, plain text formatting.
Definition DataProviderActionCatalog.qc.dox.h:283