Qore DataProvider Module Reference 3.2.2
Loading...
Searching...
No Matches
DataProviderActionCatalog.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
24
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 *string group;
53
55
58 *string scheme;
59
61
63 data logo;
64
67
69
74
76
78 bool supports_events = False;
79
81
83 bool supports_apis = False;
84
86
88 bool supports_messages = False;
89
91
93 bool supports_find = False;
94
96
99
101
103 bool supports_create = False;
104
106
108 bool supports_upsert = False;
109
111
113 bool supports_update = False;
114
116
118 bool supports_delete = False;
119
121 bool dynamic = False;
122
124 bool hidden = False;
125
127 *hash<auto> info;
128};
129
136const DPAT_EVENT = 1;
137
139const DPAT_API = 2;
140
143
145const DPAT_FIND = 4;
146
149
151const DPAT_CREATE = 6;
152
154const DPAT_UPSERT = 7;
155
157const DPAT_UPDATE = 8;
158
160const DPAT_DELETE = 9;
162
165
166
169
171const ActionAttrMap = ...;
172
173
175const ActionNameMap = ...;
176
177
179public struct ActionOptionInfo {
182
185
188
190 string desc;
191
193 *string group;
194
197
199
201 *softlist<string> required_groups;
202
204 *softlist<string> exclusive_with;
205
208
211
214
216 *softlist<hash<AllowedValueInfo>> allowed_values;
217
220
222 *softlist<hash<AllowedValueInfo>> element_allowed_values;
223
226
229
232
234
238 *softlist<softstring> depends_on;
239
241
245 *string ref_data;
246
248
253
255
260
263
266
269
272
274
280 *string loc;
281
284
286 *softlist<softstring> on_change;
287};
288
293
296
298 string desc;
299
302};
303
307 string app;
308
310 string action;
311
313 *string group;
314
316
318 *string subtype;
319
321
323 string path;
324
326
328 *hash<string, hash<DataProviderPathVarInfo>> path_vars;
329
332
335
337 string desc;
338
340
343
345
349 *string action_val;
350
352
356 *string cls;
357
359 *hash<auto> where_add;
360
362 *hash<auto> options_add;
363
365 *hash<auto> set_add;
366
368 *hash<string, hash<ActionOptionInfo>> options;
369
372
375
378
381
384
386 *hash<DataProviderInfo> data_provider_info;
387};
388
391
392public:
394 const RequiredAppKeys = ...;
395
396
399
400
401protected:
403 static Mutex lck();
404
406 static hash<string, hash<DataProviderAppInfo>> appcache;
407
409 static hash<string, hash<DataProviderActionInfo>> top_actionmap;
410
412 static hash<string, hash<string, hash<DataProviderActionInfo>>> app_actionmap;
413
415 static hash<string, list<hash<DataProviderActionInfo>>> smap;
416
418 static hash<string, hash<string, bool>> resolve_output_types;
419
421 static hash<string, hash<auto>> initmap;
422
424 static hash<string, hash<string, code>> initactionmap;
425
427 static hash<string, hash<string, bool>> appmodmap;
428
431
432public:
433
435
440 static registerPendingApp(string app, code init);
441
443
449 static registerPendingAppAction(string app, string action, code init);
450
452
456 static registerApp(hash<DataProviderAppInfo> app);
457
459
463 static *list<string> getModulePathsForApp(string app);
464
466
475 static *hash<DataProviderAppInfo> deregisterDynamicApp(string name);
476
478
484 static registerAction(hash<DataProviderActionInfo> action);
485
487
489 static *int checkName(string name);
490
492
494 static int compareActions(hash<DataProviderActionInfo> act0, hash<DataProviderActionInfo> act1);
495
497
499 static int compareOptions(*hash<string, hash<ActionOptionInfo>> opt0, *hash<string, hash<ActionOptionInfo>> opt1);
500
502 static int compareBaseTypes(*Type t0, *Type t1);
503
505
508 static *list<hash<DataProviderAppInfo>> getAllAppsNoInit();
509
511
514 static *list<hash<DataProviderAppInfo>> getAllApps();
515
517
523 static *hash<DataProviderAppInfo> getApp(string app);
524
526
535 static hash<DataProviderAppInfo> getAppEx(string app);
536
538
543 static *list<hash<DataProviderAppInfo>> searchAppRegex(string regex_pattern, int regex_options = RE_Caseless);
544
546
552 static *list<hash<DataProviderAppInfo>> searchAppSubstr(string substr, bool ignore_case = True);
553
555
559 static *list<hash<DataProviderActionInfo>> getActionsForScheme(string scheme);
560
562
568 static *hash<string, hash<DataProviderActionInfo>> getActionHash(string app);
569
571
579 static *hash<string, hash<DataProviderActionInfo>> getActionHashEx(string app);
580
582
588 static *list<hash<DataProviderActionInfo>> getActions(string app);
589
591
599 static list<hash<DataProviderActionInfo>> getActionsEx(string app);
600
602
604 static *list<hash<DataProviderActionInfo>> getAllActions();
605
607
614 static *hash<DataProviderActionInfo> getAppAction(string app, string action);
615
617
628 static hash<DataProviderActionInfo> getAppActionEx(string app, string action);
629
631
636 static AbstractDataProvider getDataProviderForAction(hash<DataProviderActionInfo> action, *reference<hash<auto>> options);
637
639
647 static *list<hash<DataProviderActionInfo>> searchAppActionRegex(string app, string regex_pattern, int regex_options = RE_Caseless);
648
650
658 static *list<hash<DataProviderActionInfo>> searchAppActionSubstr(string app, string substr, bool ignore_case = True);
659
661
671 static *list<hash<DataProviderActionInfo>> searchAppActionRegexEx(string app, string regex_pattern, int regex_options = RE_Caseless);
672
674
684 static *list<hash<DataProviderActionInfo>> searchAppActionSubstrEx(string app, string substr, bool ignore_case = True);
685
687
692 static *list<hash<DataProviderActionInfo>> searchActionRegex(string regex_pattern, int regex_options = RE_Caseless);
693
695
700 static *list<hash<DataProviderActionInfo>> searchActionSubstr(string substr, bool ignore_case = True);
701
703 static hash<string, hash<ActionOptionInfo>> getActionOptionFromFields(hash<auto> fields, *hash<auto> additional_fields);
704
706 static hash<DataProviderActionInfo> checkAppActionOptions(string app, string action);
707
710
712 static *AbstractDataProviderType getTypeForActionOptions(hash<DataProviderActionInfo> action);
713
715protected:
716 static string normalizePath(string path);
717public:
718
719
721protected:
723public:
724
725
727private:
728 static *bool deregisterApp(string name);
729public:
730
731
733private:
734 static *bool deregisterAppIntern(string name);
735public:
736
737
739protected:
740 static doInit(hash<auto> h);
741public:
742
743
745protected:
746 static doInit(code init);
747public:
748
749};
750};
751
752namespace Priv {
753thread_local *string _mod_init_ctx;
754};
The AbstractDataProvider class.
Definition AbstractDataProvider.qc.dox.h:919
describes a data type
Definition AbstractDataProviderType.qc.dox.h:139
DataProvider action and application catalog class.
Definition DataProviderActionCatalog.qc.dox.h:390
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:412
static registerApp(hash< DataProviderAppInfo > app)
Registers a data provider application.
const DefaultDescription
Default description.
Definition DataProviderActionCatalog.qc.dox.h:430
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 hash< string, hash< string, bool > > appmodmap
Maps apps to the modules that define them: app -> module path -> True.
Definition DataProviderActionCatalog.qc.dox.h:427
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:418
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:424
static doInit(code init)
Runs initialization and catches exceptions.
static int compareActions(hash< DataProviderActionInfo > act0, hash< DataProviderActionInfo > act1)
Compares two actions for equality.
static hash< string, hash< auto > > initmap
Pending application init handler map: app -> init handler.
Definition DataProviderActionCatalog.qc.dox.h:421
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:394
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< string > getModulePathsForApp(string app)
Returns zero or more module paths for the given application.
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 *AbstractDataProviderType getTypeForActionOptions(hash< auto > action)
Returns a data type for the action options.
static *list< hash< DataProviderActionInfo > > getActionsForScheme(string scheme)
Returns all actions for a particular connection scheme.
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:409
static doInit(hash< auto > h)
Runs initialization and catches exceptions.
static hash< string, list< hash< DataProviderActionInfo > > > smap
Scheme map; keys are connection schemes.
Definition DataProviderActionCatalog.qc.dox.h:415
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...
static *AbstractDataProviderType getTypeForActionOptions(hash< DataProviderActionInfo > action)
Returns a data type for the action options.
const RequiredActionKeys
Required action key set (without action_code and path_vars, which are checked separately)
Definition DataProviderActionCatalog.qc.dox.h:398
static hash< string, hash< DataProviderAppInfo > > appcache
Top-level master application cache keyed by application name.
Definition DataProviderActionCatalog.qc.dox.h:406
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:139
const DPAT_FIND_SINGLE
Data Provider Action Type: find a single record.
Definition DataProviderActionCatalog.qc.dox.h:148
const DPAT_SEND_MESSAGE
Data Provider Action Type: send a message.
Definition DataProviderActionCatalog.qc.dox.h:142
const DPAT_EVENT
Definition DataProviderActionCatalog.qc.dox.h:136
const DPAT_UPDATE
Data Provider Action Type: update a record.
Definition DataProviderActionCatalog.qc.dox.h:157
const DPAT_DELETE
Data Provider Action Type: delete a record.
Definition DataProviderActionCatalog.qc.dox.h:160
const DPAT_UPSERT
Data Provider Action Type: upsert a record.
Definition DataProviderActionCatalog.qc.dox.h:154
const DPAT_CREATE
Data Provider Action Type: create a record.
Definition DataProviderActionCatalog.qc.dox.h:151
const DPAT_FIND
Data Provider Action Type: find all matching records.
Definition DataProviderActionCatalog.qc.dox.h:145
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:175
const ActionAttrMap
Maps action type codes to a data provider attribute string.
Definition DataProviderActionCatalog.qc.dox.h:171
const ActionCodeFlagMap
Maps action type codes to app action flags.
Definition DataProviderActionCatalog.qc.dox.h:164
const AppActionFlags
List of app action flags.
Definition DataProviderActionCatalog.qc.dox.h:168
Private definitions.
Definition AbstractDataProviderType.qc.dox.h:454
Data provider action option definition.
Definition DataProviderActionCatalog.qc.dox.h:179
bool structural_determinate
Does the value of this option determine the structure of other options?
Definition DataProviderActionCatalog.qc.dox.h:283
auto example_value
An optional example value for the option.
Definition DataProviderActionCatalog.qc.dox.h:228
*softlist< hash< AllowedValueInfo > > element_allowed_values
List of allowed values for elements of list types (enum)
Definition DataProviderActionCatalog.qc.dox.h:222
*string group
The group name for the option, if any.
Definition DataProviderActionCatalog.qc.dox.h:193
*softlist< string > required_groups
Is the option part of a required group?
Definition DataProviderActionCatalog.qc.dox.h:201
AbstractDataProviderType type
Data type of the option.
Definition DataProviderActionCatalog.qc.dox.h:181
bool readonly
Is this option read-only?
Definition DataProviderActionCatalog.qc.dox.h:268
*softlist< softstring > depends_on
A list of other options that must be set before this option can be chosen.
Definition DataProviderActionCatalog.qc.dox.h:238
*string default_ref_data
A tag allowing the default value to be returned dynamically as reference data.
Definition DataProviderActionCatalog.qc.dox.h:259
*softlist< hash< AllowedValueInfo > > allowed_values
List of allowed values (enum)
Definition DataProviderActionCatalog.qc.dox.h:216
*string loc
Option location for record-based data providers and data providers provided by a class.
Definition DataProviderActionCatalog.qc.dox.h:280
*softlist< softstring > on_change
Any information about how to react to changes.
Definition DataProviderActionCatalog.qc.dox.h:286
bool required
Is the option required or not?
Definition DataProviderActionCatalog.qc.dox.h:196
bool disabled
Is this option disabled?
Definition DataProviderActionCatalog.qc.dox.h:271
auto default_value
Any default value for the option.
Definition DataProviderActionCatalog.qc.dox.h:207
*string dynamic_type
A tag allowing the type of the option to be retrieved at runtime.
Definition DataProviderActionCatalog.qc.dox.h:262
string short_desc
Short description of the option in plain text.
Definition DataProviderActionCatalog.qc.dox.h:187
*softlist< string > exclusive_with
Is the option exclusive with other options?
Definition DataProviderActionCatalog.qc.dox.h:204
bool preselected
If the option should be preselected.
Definition DataProviderActionCatalog.qc.dox.h:265
string desc
Description of the option with markdown rendering.
Definition DataProviderActionCatalog.qc.dox.h:190
bool allowed_values_creatable
Does the option accept values not defined in allowed_values too?
Definition DataProviderActionCatalog.qc.dox.h:219
*string element_ref_data
A tag allowing element allowed values to be returned dynamically as element reference data.
Definition DataProviderActionCatalog.qc.dox.h:252
bool sensitive
Is the option value sensitive?
Definition DataProviderActionCatalog.qc.dox.h:210
*string ref_data
A tag allowing allowed values to be returned dynamically as reference data.
Definition DataProviderActionCatalog.qc.dox.h:245
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:213
string display_name
Display name of the option.
Definition DataProviderActionCatalog.qc.dox.h:184
*string validation_regex
An optional regex pattern for validating string values.
Definition DataProviderActionCatalog.qc.dox.h:231
bool element_allowed_values_creatable
Does the option accept values not defined in element_allowed_values too?
Definition DataProviderActionCatalog.qc.dox.h:225
DataProvider action definition.
Definition DataProviderActionCatalog.qc.dox.h:305
string short_desc
Action short description, plain text formatting.
Definition DataProviderActionCatalog.qc.dox.h:334
*hash< DataProviderInfo > data_provider_info
Data provider static info, useful for record-based data providers.
Definition DataProviderActionCatalog.qc.dox.h:386
bool data_dependent_options
Do options depend on the data for the call?
Definition DataProviderActionCatalog.qc.dox.h:371
*string group
The action group within the app, if any.
Definition DataProviderActionCatalog.qc.dox.h:313
*string action_val
Message or event type.
Definition DataProviderActionCatalog.qc.dox.h:349
*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:380
*hash< auto > set_add
Values to add to any "set" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:365
string path
Data provider path to action.
Definition DataProviderActionCatalog.qc.dox.h:323
string display_name
The display name for the action.
Definition DataProviderActionCatalog.qc.dox.h:331
*AbstractDataProviderType output_type
Output type for the action.
Definition DataProviderActionCatalog.qc.dox.h:374
int action_code
Action type code.
Definition DataProviderActionCatalog.qc.dox.h:342
string app
Name of the application that provides the action.
Definition DataProviderActionCatalog.qc.dox.h:307
*hash< auto > where_add
Values to add to any "where" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:359
bool has_dynamic_options
Does the action support dynamic options?
Definition DataProviderActionCatalog.qc.dox.h:377
*string subtype
Any data provider subtype.
Definition DataProviderActionCatalog.qc.dox.h:318
string desc
Action long description, markdown formatting.
Definition DataProviderActionCatalog.qc.dox.h:337
*hash< string, hash< DataProviderPathVarInfo > > path_vars
Description of any path variables.
Definition DataProviderActionCatalog.qc.dox.h:328
*hash< auto > options_add
Values to add to any "options" argument for record-based actions.
Definition DataProviderActionCatalog.qc.dox.h:362
*hash< string, hash< ActionOptionInfo > > options
Options that can be provided without a data provider.
Definition DataProviderActionCatalog.qc.dox.h:368
*string cls
The DataProvider class.
Definition DataProviderActionCatalog.qc.dox.h:356
*code get_dynamic_options
For the case when options should be generated dynamically.
Definition DataProviderActionCatalog.qc.dox.h:383
string action
The unique name for the action; unique in the application.
Definition DataProviderActionCatalog.qc.dox.h:310
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:63
bool supports_messages
If the apps supports message actions.
Definition DataProviderActionCatalog.qc.dox.h:88
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:127
bool dynamic
Was the application added dynamically?
Definition DataProviderActionCatalog.qc.dox.h:121
bool hidden
Should this app be hidden in the front end?
Definition DataProviderActionCatalog.qc.dox.h:124
bool supports_update
If the apps supports update actions.
Definition DataProviderActionCatalog.qc.dox.h:113
*string group
The application group, if any.
Definition DataProviderActionCatalog.qc.dox.h:52
string logo_mime_type
The mime type for logo.
Definition DataProviderActionCatalog.qc.dox.h:73
*string scheme
Connection scheme for the application.
Definition DataProviderActionCatalog.qc.dox.h:58
bool supports_events
If the apps supports event actions.
Definition DataProviderActionCatalog.qc.dox.h:78
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:98
string logo_file_name
The logo file name.
Definition DataProviderActionCatalog.qc.dox.h:66
bool supports_upsert
If the apps supports upsert actions.
Definition DataProviderActionCatalog.qc.dox.h:108
bool supports_apis
If the apps supports API actions.
Definition DataProviderActionCatalog.qc.dox.h:83
bool supports_create
If the apps supports create actions.
Definition DataProviderActionCatalog.qc.dox.h:103
bool supports_find
If the apps supports find actions.
Definition DataProviderActionCatalog.qc.dox.h:93
bool supports_delete
If the apps supports delete actions.
Definition DataProviderActionCatalog.qc.dox.h:118
DataProvider path var info.
Definition DataProviderActionCatalog.qc.dox.h:290
string desc
Action long description, markdown formatting.
Definition DataProviderActionCatalog.qc.dox.h:298
string display_name
The display name for the action.
Definition DataProviderActionCatalog.qc.dox.h:292
*string example_value
An optional example value for the option.
Definition DataProviderActionCatalog.qc.dox.h:301
string short_desc
Action short description, plain text formatting.
Definition DataProviderActionCatalog.qc.dox.h:295