Skip to content

Commit 35fdd35

Browse files
authored
Merge pull request #225 from retran/feature/handler-migration
refactor: migrate executor handlers to free functions with ExecContext
2 parents d6df1f0 + 98bd899 commit 35fdd35

File tree

86 files changed

+3823
-3094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3823
-3094
lines changed

mdl/executor/autocomplete.go

Lines changed: 140 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
// Returns qualified names for modules, entities, microflows, pages, etc.
55
package executor
66

7-
// GetModuleNames returns a list of all module names for autocomplete.
8-
func (e *Executor) GetModuleNames() []string {
7+
import "context"
8+
9+
// getModuleNames returns a list of all module names for autocomplete.
10+
func getModuleNames(ctx *ExecContext) []string {
11+
e := ctx.executor
912
if e.reader == nil {
1013
return nil
1114
}
@@ -20,12 +23,13 @@ func (e *Executor) GetModuleNames() []string {
2023
return names
2124
}
2225

23-
// GetMicroflowNames returns qualified microflow names, optionally filtered by module.
24-
func (e *Executor) GetMicroflowNames(moduleFilter string) []string {
26+
// getMicroflowNamesAC returns qualified microflow names, optionally filtered by module.
27+
func getMicroflowNamesAC(ctx *ExecContext, moduleFilter string) []string {
28+
e := ctx.executor
2529
if e.reader == nil {
2630
return nil
2731
}
28-
h, err := e.getHierarchy()
32+
h, err := getHierarchy(ctx)
2933
if err != nil {
3034
return nil
3135
}
@@ -44,12 +48,13 @@ func (e *Executor) GetMicroflowNames(moduleFilter string) []string {
4448
return names
4549
}
4650

47-
// GetEntityNames returns qualified entity names, optionally filtered by module.
48-
func (e *Executor) GetEntityNames(moduleFilter string) []string {
51+
// getEntityNamesAC returns qualified entity names, optionally filtered by module.
52+
func getEntityNamesAC(ctx *ExecContext, moduleFilter string) []string {
53+
e := ctx.executor
4954
if e.reader == nil {
5055
return nil
5156
}
52-
h, err := e.getHierarchy()
57+
h, err := getHierarchy(ctx)
5358
if err != nil {
5459
return nil
5560
}
@@ -70,12 +75,13 @@ func (e *Executor) GetEntityNames(moduleFilter string) []string {
7075
return names
7176
}
7277

73-
// GetPageNames returns qualified page names, optionally filtered by module.
74-
func (e *Executor) GetPageNames(moduleFilter string) []string {
78+
// getPageNamesAC returns qualified page names, optionally filtered by module.
79+
func getPageNamesAC(ctx *ExecContext, moduleFilter string) []string {
80+
e := ctx.executor
7581
if e.reader == nil {
7682
return nil
7783
}
78-
h, err := e.getHierarchy()
84+
h, err := getHierarchy(ctx)
7985
if err != nil {
8086
return nil
8187
}
@@ -94,12 +100,13 @@ func (e *Executor) GetPageNames(moduleFilter string) []string {
94100
return names
95101
}
96102

97-
// GetSnippetNames returns qualified snippet names, optionally filtered by module.
98-
func (e *Executor) GetSnippetNames(moduleFilter string) []string {
103+
// getSnippetNamesAC returns qualified snippet names, optionally filtered by module.
104+
func getSnippetNamesAC(ctx *ExecContext, moduleFilter string) []string {
105+
e := ctx.executor
99106
if e.reader == nil {
100107
return nil
101108
}
102-
h, err := e.getHierarchy()
109+
h, err := getHierarchy(ctx)
103110
if err != nil {
104111
return nil
105112
}
@@ -118,12 +125,13 @@ func (e *Executor) GetSnippetNames(moduleFilter string) []string {
118125
return names
119126
}
120127

121-
// GetAssociationNames returns qualified association names, optionally filtered by module.
122-
func (e *Executor) GetAssociationNames(moduleFilter string) []string {
128+
// getAssociationNamesAC returns qualified association names, optionally filtered by module.
129+
func getAssociationNamesAC(ctx *ExecContext, moduleFilter string) []string {
130+
e := ctx.executor
123131
if e.reader == nil {
124132
return nil
125133
}
126-
h, err := e.getHierarchy()
134+
h, err := getHierarchy(ctx)
127135
if err != nil {
128136
return nil
129137
}
@@ -144,12 +152,13 @@ func (e *Executor) GetAssociationNames(moduleFilter string) []string {
144152
return names
145153
}
146154

147-
// GetEnumerationNames returns qualified enumeration names, optionally filtered by module.
148-
func (e *Executor) GetEnumerationNames(moduleFilter string) []string {
155+
// getEnumerationNamesAC returns qualified enumeration names, optionally filtered by module.
156+
func getEnumerationNamesAC(ctx *ExecContext, moduleFilter string) []string {
157+
e := ctx.executor
149158
if e.reader == nil {
150159
return nil
151160
}
152-
h, err := e.getHierarchy()
161+
h, err := getHierarchy(ctx)
153162
if err != nil {
154163
return nil
155164
}
@@ -168,12 +177,13 @@ func (e *Executor) GetEnumerationNames(moduleFilter string) []string {
168177
return names
169178
}
170179

171-
// GetLayoutNames returns qualified layout names, optionally filtered by module.
172-
func (e *Executor) GetLayoutNames(moduleFilter string) []string {
180+
// getLayoutNamesAC returns qualified layout names, optionally filtered by module.
181+
func getLayoutNamesAC(ctx *ExecContext, moduleFilter string) []string {
182+
e := ctx.executor
173183
if e.reader == nil {
174184
return nil
175185
}
176-
h, err := e.getHierarchy()
186+
h, err := getHierarchy(ctx)
177187
if err != nil {
178188
return nil
179189
}
@@ -192,12 +202,13 @@ func (e *Executor) GetLayoutNames(moduleFilter string) []string {
192202
return names
193203
}
194204

195-
// GetJavaActionNames returns qualified Java action names, optionally filtered by module.
196-
func (e *Executor) GetJavaActionNames(moduleFilter string) []string {
205+
// getJavaActionNamesAC returns qualified Java action names, optionally filtered by module.
206+
func getJavaActionNamesAC(ctx *ExecContext, moduleFilter string) []string {
207+
e := ctx.executor
197208
if e.reader == nil {
198209
return nil
199210
}
200-
h, err := e.getHierarchy()
211+
h, err := getHierarchy(ctx)
201212
if err != nil {
202213
return nil
203214
}
@@ -216,12 +227,13 @@ func (e *Executor) GetJavaActionNames(moduleFilter string) []string {
216227
return names
217228
}
218229

219-
// GetODataClientNames returns qualified consumed OData service names, optionally filtered by module.
220-
func (e *Executor) GetODataClientNames(moduleFilter string) []string {
230+
// getODataClientNamesAC returns qualified consumed OData service names, optionally filtered by module.
231+
func getODataClientNamesAC(ctx *ExecContext, moduleFilter string) []string {
232+
e := ctx.executor
221233
if e.reader == nil {
222234
return nil
223235
}
224-
h, err := e.getHierarchy()
236+
h, err := getHierarchy(ctx)
225237
if err != nil {
226238
return nil
227239
}
@@ -240,12 +252,13 @@ func (e *Executor) GetODataClientNames(moduleFilter string) []string {
240252
return names
241253
}
242254

243-
// GetODataServiceNames returns qualified published OData service names, optionally filtered by module.
244-
func (e *Executor) GetODataServiceNames(moduleFilter string) []string {
255+
// getODataServiceNamesAC returns qualified published OData service names, optionally filtered by module.
256+
func getODataServiceNamesAC(ctx *ExecContext, moduleFilter string) []string {
257+
e := ctx.executor
245258
if e.reader == nil {
246259
return nil
247260
}
248-
h, err := e.getHierarchy()
261+
h, err := getHierarchy(ctx)
249262
if err != nil {
250263
return nil
251264
}
@@ -264,12 +277,13 @@ func (e *Executor) GetODataServiceNames(moduleFilter string) []string {
264277
return names
265278
}
266279

267-
// GetRestClientNames returns qualified consumed REST service names, optionally filtered by module.
268-
func (e *Executor) GetRestClientNames(moduleFilter string) []string {
280+
// getRestClientNamesAC returns qualified consumed REST service names, optionally filtered by module.
281+
func getRestClientNamesAC(ctx *ExecContext, moduleFilter string) []string {
282+
e := ctx.executor
269283
if e.reader == nil {
270284
return nil
271285
}
272-
h, err := e.getHierarchy()
286+
h, err := getHierarchy(ctx)
273287
if err != nil {
274288
return nil
275289
}
@@ -288,12 +302,13 @@ func (e *Executor) GetRestClientNames(moduleFilter string) []string {
288302
return names
289303
}
290304

291-
// GetDatabaseConnectionNames returns qualified database connection names, optionally filtered by module.
292-
func (e *Executor) GetDatabaseConnectionNames(moduleFilter string) []string {
305+
// getDatabaseConnectionNamesAC returns qualified database connection names, optionally filtered by module.
306+
func getDatabaseConnectionNamesAC(ctx *ExecContext, moduleFilter string) []string {
307+
e := ctx.executor
293308
if e.reader == nil {
294309
return nil
295310
}
296-
h, err := e.getHierarchy()
311+
h, err := getHierarchy(ctx)
297312
if err != nil {
298313
return nil
299314
}
@@ -312,12 +327,13 @@ func (e *Executor) GetDatabaseConnectionNames(moduleFilter string) []string {
312327
return names
313328
}
314329

315-
// GetBusinessEventServiceNames returns qualified business event service names, optionally filtered by module.
316-
func (e *Executor) GetBusinessEventServiceNames(moduleFilter string) []string {
330+
// getBusinessEventServiceNamesAC returns qualified business event service names, optionally filtered by module.
331+
func getBusinessEventServiceNamesAC(ctx *ExecContext, moduleFilter string) []string {
332+
e := ctx.executor
317333
if e.reader == nil {
318334
return nil
319335
}
320-
h, err := e.getHierarchy()
336+
h, err := getHierarchy(ctx)
321337
if err != nil {
322338
return nil
323339
}
@@ -336,12 +352,13 @@ func (e *Executor) GetBusinessEventServiceNames(moduleFilter string) []string {
336352
return names
337353
}
338354

339-
// GetJsonStructureNames returns qualified JSON structure names, optionally filtered by module.
340-
func (e *Executor) GetJsonStructureNames(moduleFilter string) []string {
355+
// getJsonStructureNamesAC returns qualified JSON structure names, optionally filtered by module.
356+
func getJsonStructureNamesAC(ctx *ExecContext, moduleFilter string) []string {
357+
e := ctx.executor
341358
if e.reader == nil {
342359
return nil
343360
}
344-
h, err := e.getHierarchy()
361+
h, err := getHierarchy(ctx)
345362
if err != nil {
346363
return nil
347364
}
@@ -359,3 +376,82 @@ func (e *Executor) GetJsonStructureNames(moduleFilter string) []string {
359376
}
360377
return names
361378
}
379+
380+
// ----------------------------------------------------------------------------
381+
// Exported Executor method wrappers (public API for external callers)
382+
// ----------------------------------------------------------------------------
383+
384+
// GetModuleNames returns a list of all module names for autocomplete.
385+
func (e *Executor) GetModuleNames() []string {
386+
return getModuleNames(e.newExecContext(context.Background()))
387+
}
388+
389+
// GetMicroflowNames returns qualified microflow names, optionally filtered by module.
390+
func (e *Executor) GetMicroflowNames(moduleFilter string) []string {
391+
return getMicroflowNamesAC(e.newExecContext(context.Background()), moduleFilter)
392+
}
393+
394+
// GetEntityNames returns qualified entity names, optionally filtered by module.
395+
func (e *Executor) GetEntityNames(moduleFilter string) []string {
396+
return getEntityNamesAC(e.newExecContext(context.Background()), moduleFilter)
397+
}
398+
399+
// GetPageNames returns qualified page names, optionally filtered by module.
400+
func (e *Executor) GetPageNames(moduleFilter string) []string {
401+
return getPageNamesAC(e.newExecContext(context.Background()), moduleFilter)
402+
}
403+
404+
// GetSnippetNames returns qualified snippet names, optionally filtered by module.
405+
func (e *Executor) GetSnippetNames(moduleFilter string) []string {
406+
return getSnippetNamesAC(e.newExecContext(context.Background()), moduleFilter)
407+
}
408+
409+
// GetAssociationNames returns qualified association names, optionally filtered by module.
410+
func (e *Executor) GetAssociationNames(moduleFilter string) []string {
411+
return getAssociationNamesAC(e.newExecContext(context.Background()), moduleFilter)
412+
}
413+
414+
// GetEnumerationNames returns qualified enumeration names, optionally filtered by module.
415+
func (e *Executor) GetEnumerationNames(moduleFilter string) []string {
416+
return getEnumerationNamesAC(e.newExecContext(context.Background()), moduleFilter)
417+
}
418+
419+
// GetLayoutNames returns qualified layout names, optionally filtered by module.
420+
func (e *Executor) GetLayoutNames(moduleFilter string) []string {
421+
return getLayoutNamesAC(e.newExecContext(context.Background()), moduleFilter)
422+
}
423+
424+
// GetJavaActionNames returns qualified Java action names, optionally filtered by module.
425+
func (e *Executor) GetJavaActionNames(moduleFilter string) []string {
426+
return getJavaActionNamesAC(e.newExecContext(context.Background()), moduleFilter)
427+
}
428+
429+
// GetODataClientNames returns qualified consumed OData service names, optionally filtered by module.
430+
func (e *Executor) GetODataClientNames(moduleFilter string) []string {
431+
return getODataClientNamesAC(e.newExecContext(context.Background()), moduleFilter)
432+
}
433+
434+
// GetODataServiceNames returns qualified published OData service names, optionally filtered by module.
435+
func (e *Executor) GetODataServiceNames(moduleFilter string) []string {
436+
return getODataServiceNamesAC(e.newExecContext(context.Background()), moduleFilter)
437+
}
438+
439+
// GetRestClientNames returns qualified consumed REST service names, optionally filtered by module.
440+
func (e *Executor) GetRestClientNames(moduleFilter string) []string {
441+
return getRestClientNamesAC(e.newExecContext(context.Background()), moduleFilter)
442+
}
443+
444+
// GetDatabaseConnectionNames returns qualified database connection names, optionally filtered by module.
445+
func (e *Executor) GetDatabaseConnectionNames(moduleFilter string) []string {
446+
return getDatabaseConnectionNamesAC(e.newExecContext(context.Background()), moduleFilter)
447+
}
448+
449+
// GetBusinessEventServiceNames returns qualified business event service names, optionally filtered by module.
450+
func (e *Executor) GetBusinessEventServiceNames(moduleFilter string) []string {
451+
return getBusinessEventServiceNamesAC(e.newExecContext(context.Background()), moduleFilter)
452+
}
453+
454+
// GetJsonStructureNames returns qualified JSON structure names, optionally filtered by module.
455+
func (e *Executor) GetJsonStructureNames(moduleFilter string) []string {
456+
return getJsonStructureNamesAC(e.newExecContext(context.Background()), moduleFilter)
457+
}

0 commit comments

Comments
 (0)