Example #1
0
  @Override
  public RecT storeRec(final RecT rec) throws SQLException {
    if (!rec.isStoring()) {
      rec.setStoring(true);
      try {
        if (createEvents(rec.cx())) {
          rec.cx()
              .execEvent(
                  new Event.Procedure<Object>(rec.cx()) {
                    @Override
                    protected Object onExec() throws SQLException {
                      description = genStoreEventDescription(rec);
                      doStoreRec(rec);
                      return null;
                    }

                    @Override
                    protected String getDescription() throws SQLException {
                      return description;
                    }

                    @Override
                    protected boolean storeEvent() {
                      return description != null;
                    }

                    private String description;
                  });
        } else {
          doStoreRec(rec);
        }
      } finally {
        rec.setStoring(false);
      }
    }
    return rec;
  }