@@ -66,6 +66,7 @@ public class Table extends BaseSchemaObject {
66
66
ALLOWABLE_KEYS .add (JSONKeyConstants .FINDERS );
67
67
ALLOWABLE_KEYS .add (JSONKeyConstants .QUESTIONS );
68
68
ALLOWABLE_KEYS .add (JSONKeyConstants .UPDATERS );
69
+ ALLOWABLE_KEYS .add (JSONKeyConstants .UPSERTERS );
69
70
ALLOWABLE_KEYS .add (JSONKeyConstants .COUNTERS );
70
71
ALLOWABLE_KEYS .add (JSONKeyConstants .DELETERS );
71
72
ALLOWABLE_KEYS .add (JSONKeyConstants .INSERTERS );
@@ -101,6 +102,7 @@ public class Table extends BaseSchemaObject {
101
102
102
103
private List <Updater > updaters = new ArrayList <>(); // a list of all of the updaters
103
104
private List <Inserter > inserters = new ArrayList <>(); // a list of all of the inserters
105
+ private List <Upserter > upserters = new ArrayList <>(); // a list of all of the upserters
104
106
private List <Deleter > deleters = new ArrayList <>(); // a list of all of the deleters
105
107
private List <Constant > constants = new ArrayList <>(); // a list of all of the constants
106
108
@@ -184,6 +186,7 @@ public void populateActions() throws H2ZeroParseException {
184
186
populateUpdaters (jsonObject );
185
187
populateDeleters (jsonObject );
186
188
populateInserters (jsonObject );
189
+ populateUpserters (jsonObject );
187
190
populateConstants (jsonObject );
188
191
populateCounters (jsonObject );
189
192
populateQuestions (jsonObject );
@@ -481,6 +484,26 @@ private void populateInserters(JSONObject jsonObject) throws H2ZeroParseExceptio
481
484
jsonObject .remove (JSONKeyConstants .INSERTERS );
482
485
}
483
486
487
+ private void populateUpserters (JSONObject jsonObject ) throws H2ZeroParseException {
488
+ JSONArray upserterJson = new JSONArray ();
489
+ try {
490
+ upserterJson = jsonObject .getJSONArray (JSONKeyConstants .UPSERTERS );
491
+ } catch (JSONException ojjsonex ) {
492
+ // do nothing - no finders is ok
493
+ }
494
+
495
+ for (int i = 0 ; i < upserterJson .length (); i ++) {
496
+ try {
497
+ JSONObject upserterObject = upserterJson .getJSONObject (i );
498
+ upserters .add (new Upserter (this , upserterObject ));
499
+ } catch (JSONException jsonex ) {
500
+ throw new H2ZeroParseException ("Could not parse upserters." , jsonex );
501
+ }
502
+ }
503
+
504
+ jsonObject .remove (JSONKeyConstants .UPSERTERS );
505
+ }
506
+
484
507
private void populateConstants (JSONObject jsonObject ) throws H2ZeroParseException {
485
508
JSONArray constantJson = new JSONArray ();
486
509
try {
@@ -501,9 +524,8 @@ private void populateConstants(JSONObject jsonObject) throws H2ZeroParseExceptio
501
524
jsonObject .remove (JSONKeyConstants .CONSTANTS );
502
525
}
503
526
504
-
505
-
506
-
527
+
528
+
507
529
// boring old getters and setters
508
530
public String getEngine () { return (this .engine ); }
509
531
public String getCharset () { return (this .charset ); }
@@ -513,6 +535,7 @@ private void populateConstants(JSONObject jsonObject) throws H2ZeroParseExceptio
513
535
514
536
public List <Updater > getUpdaters () { return (updaters ); }
515
537
public List <Inserter > getInserters () { return (inserters ); }
538
+ public List <Upserter > getUpserters () { return (upserters ); }
516
539
public List <Deleter > getDeleters () { return (deleters ); }
517
540
public List <Constant > getConstants () { return (constants ); }
518
541
0 commit comments