@@ -36,6 +36,9 @@ class RunGenerator implements OddgenGenerator2 {
36
36
public static var RESET_PACKAGE = UtplsqlResources . getString(" PREF_RESET_PACKAGE_LABEL" )
37
37
public static var CLEAR_SCREEN = UtplsqlResources . getString(" PREF_CLEAR_SCREEN_LABEL" )
38
38
public static var INDENT_SPACES = UtplsqlResources . getString(" PREF_INDENT_SPACES_LABEL" )
39
+
40
+ // oddgen node cache
41
+ var List<Node > runnables = null ;
39
42
40
43
override isSupported (Connection conn ) {
41
44
var ret = false
@@ -75,17 +78,22 @@ class RunGenerator implements OddgenGenerator2 {
75
78
}
76
79
77
80
override getNodes (Connection conn , String parentNodeId ) {
78
- val preferences = PreferenceModel . getInstance(Preferences . preferences)
79
- val params = new LinkedHashMap<String , String > ()
80
- params. put(RESET_PACKAGE , if (preferences. resetPackage) {YES } else {NO })
81
- params. put(CLEAR_SCREEN , if (preferences. clearScreen) {YES } else {NO })
82
- params. put(INDENT_SPACES , String . valueOf(preferences. indentSpaces))
83
- val UtplsqlDao dao = new UtplsqlDao (conn)
84
- val nodes = dao. runnables
85
- for (node : nodes) {
86
- node. params = params
81
+ // oddgen asks for children for each parent node, regardless of load strategy (eager/lazy)
82
+ // oddgen does not know about the load strategy, hence caching is the responsibility of the generator
83
+ if (runnables == = null ) {
84
+ val preferences = PreferenceModel . getInstance(Preferences . preferences)
85
+ val params = new LinkedHashMap<String , String > ()
86
+ params. put(RESET_PACKAGE , if (preferences. resetPackage) {YES } else {NO })
87
+ params. put(CLEAR_SCREEN , if (preferences. clearScreen) {YES } else {NO })
88
+ params. put(INDENT_SPACES , String . valueOf(preferences. indentSpaces))
89
+ val UtplsqlDao dao = new UtplsqlDao (conn)
90
+ // load node tree eagerly (all nodes in one go)
91
+ runnables = dao. runnables
92
+ for (node : runnables) {
93
+ node. params = params
94
+ }
87
95
}
88
- return nodes
96
+ return runnables
89
97
}
90
98
91
99
override getLov (Connection conn , LinkedHashMap<String , String > params , List<Node > nodes ) {
0 commit comments