@@ -66,6 +66,7 @@ public class Table extends BaseSchemaObject {
6666 ALLOWABLE_KEYS .add (JSONKeyConstants .FINDERS );
6767 ALLOWABLE_KEYS .add (JSONKeyConstants .QUESTIONS );
6868 ALLOWABLE_KEYS .add (JSONKeyConstants .UPDATERS );
69+ ALLOWABLE_KEYS .add (JSONKeyConstants .UPSERTERS );
6970 ALLOWABLE_KEYS .add (JSONKeyConstants .COUNTERS );
7071 ALLOWABLE_KEYS .add (JSONKeyConstants .DELETERS );
7172 ALLOWABLE_KEYS .add (JSONKeyConstants .INSERTERS );
@@ -101,6 +102,7 @@ public class Table extends BaseSchemaObject {
101102
102103 private List <Updater > updaters = new ArrayList <>(); // a list of all of the updaters
103104 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
104106 private List <Deleter > deleters = new ArrayList <>(); // a list of all of the deleters
105107 private List <Constant > constants = new ArrayList <>(); // a list of all of the constants
106108
@@ -184,6 +186,7 @@ public void populateActions() throws H2ZeroParseException {
184186 populateUpdaters (jsonObject );
185187 populateDeleters (jsonObject );
186188 populateInserters (jsonObject );
189+ populateUpserters (jsonObject );
187190 populateConstants (jsonObject );
188191 populateCounters (jsonObject );
189192 populateQuestions (jsonObject );
@@ -481,6 +484,26 @@ private void populateInserters(JSONObject jsonObject) throws H2ZeroParseExceptio
481484 jsonObject .remove (JSONKeyConstants .INSERTERS );
482485 }
483486
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+
484507 private void populateConstants (JSONObject jsonObject ) throws H2ZeroParseException {
485508 JSONArray constantJson = new JSONArray ();
486509 try {
@@ -501,9 +524,8 @@ private void populateConstants(JSONObject jsonObject) throws H2ZeroParseExceptio
501524 jsonObject .remove (JSONKeyConstants .CONSTANTS );
502525 }
503526
504-
505-
506-
527+
528+
507529 // boring old getters and setters
508530 public String getEngine () { return (this .engine ); }
509531 public String getCharset () { return (this .charset ); }
@@ -513,6 +535,7 @@ private void populateConstants(JSONObject jsonObject) throws H2ZeroParseExceptio
513535
514536 public List <Updater > getUpdaters () { return (updaters ); }
515537 public List <Inserter > getInserters () { return (inserters ); }
538+ public List <Upserter > getUpserters () { return (upserters ); }
516539 public List <Deleter > getDeleters () { return (deleters ); }
517540 public List <Constant > getConstants () { return (constants ); }
518541
0 commit comments