public ODLTableReadOnly getTableById(int datastoreIndx, int tableId) {
   if (datastoreIndx < datastores.size() && datastoreIndx >= 0) {
     ODLDatastore<?> ds = (ODLDatastore<?>) datastores.get(datastoreIndx);
     return (ODLTableReadOnly) ds.getTableByImmutableId(tableId);
   }
   return null;
 }
 @SuppressWarnings("unchecked")
 public boolean addTables(ODLDatastore<? extends ODLTableDefinition> database) {
   for (int i = 0; i < database.getTableCount(); i++) {
     if (addTable((T) database.getTableAt(i)) == -1) {
       return false;
     }
   }
   return true;
 }
 @SuppressWarnings("unchecked")
 @Override
 public T getTableAt(int tableIndex) {
   T ret = null;
   if (tableIndex < getTableCount()) {
     int id = decorated.getTableAt(tableIndex).getImmutableId();
     ret = (T) new FlatDs2TableObject(this, id);
   }
   return ret;
 }
  public static void grantDefaultTablePermissions(
      ODLDatastore<? extends ODLTableDefinition> ds, ODLTableDefinition table) {
    if (ODLTableDefinitionAlterable.class.isInstance(table)) {
      ODLTableDefinitionAlterable dfn = (ODLTableDefinitionAlterable) table;

      // remove default permission flags
      long flags = dfn.getFlags() & (~TableFlags.UI_EDIT_PERMISSION_FLAGS);

      // re-add the datastore ones
      flags |= (TableFlags.UI_EDIT_PERMISSION_FLAGS & ds.getFlags());
      dfn.setFlags(flags);
    }
  }
 protected ODLTableDefinition definition(int tableId) {
   return (ODLTableDefinition) decorated.getTableByImmutableId(tableId);
 }
 protected ODLTableReadOnly readOnlyTable(int tableId) {
   return (ODLTableReadOnly) decorated.getTableByImmutableId(tableId);
 }
 @Override
 public int getTableCount() {
   return decorated.getTableCount();
 }
 @Override
 public String toString() {
   return decorated.toString();
 }
 @Override
 public boolean getTableExists(int tableId) {
   return decorated.getTableByImmutableId(tableId) != null;
 }
 @Override
 public void enableListeners() {
   decorated.enableListeners();
 }
 @Override
 public ODLDatastoreAlterable<T> deepCopyWithShallowValueCopy(boolean lazyCopy) {
   return (ODLDatastoreAlterable<T>) decorated.deepCopyWithShallowValueCopy(lazyCopy);
 }
 @Override
 public long getFlags() {
   return decorated.getFlags();
 }
 @Override
 public void setFlags(long flags) {
   if (isWriteAllowed()) {
     decorated.setFlags(flags);
   }
 }
 @Override
 public boolean isInTransaction() {
   return decorated.isInTransaction();
 }
 @Override
 public void endTransaction() {
   decorated.endTransaction();
 }
 @Override
 public void startTransaction() {
   decorated.startTransaction();
 }
 protected ODLTableAlterable alterable(int tableId) {
   if (isWriteAllowed()) {
     return (ODLTableAlterable) decorated.getTableByImmutableId(tableId);
   }
   return null;
 }
 @Override
 public void removeListener(ODLListener tml) {
   decorated.removeListener(tml);
 }
 @Override
 public void rollbackTransaction() {
   decorated.rollbackTransaction();
 }
 @Override
 public void disableListeners() {
   decorated.disableListeners();
 }
 @Override
 public boolean isRollbackSupported() {
   return decorated.isRollbackSupported();
 }
 @Override
 public void addListener(ODLListener tml, int... tableIds) {
   decorated.addListener(tml, tableIds);
 }