// Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.

package org.melati.poem.test.generated;


import org.melati.poem.AccessPoemException;
import org.melati.poem.BinaryPoemType;
import org.melati.poem.Column;
import org.melati.poem.Database;
import org.melati.poem.DefinitionSource;
import org.melati.poem.DisplayLevel;
import org.melati.poem.Field;
import org.melati.poem.JdbcPersistent;
import org.melati.poem.Persistent;
import org.melati.poem.PoemException;
import org.melati.poem.Searchability;
import org.melati.poem.TroidPoemType;
import org.melati.poem.ValidationPoemException;
import org.melati.poem.test.BinaryField;
import org.melati.poem.test.EverythingDatabaseTables;
import org.melati.poem.test.EverythingTable;


/**
 * Melati POEM generated base class for 
<code>Table</code> <code>BinaryField</code>.
 *
 * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 */

public class BinaryFieldTableBase extends EverythingTable {

  private Column<Integer> col_id = null;
  private Column<byte[]> col_binaryfield = null;
  private Column<byte[]> col_unlimited = null;

 /**
  * Constructor. 
  * 
  * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
  * @param database          the POEM database we are using
  * @param name              the name of this <code>Table</code>
  * @param definitionSource  which definition is being used
  * @throws PoemException    if anything goes wrong
  */

  public BinaryFieldTableBase(
      Database database, String name,
      DefinitionSource definitionSource) throws PoemException {
    super(database, name, definitionSource);
  }


 /**
  * Get the database tables.
  *
  * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
  * @return the database tables
  */
  public EverythingDatabaseTables getEverythingDatabaseTables() {
    return (EverythingDatabaseTables)getDatabase();
  }

  public void init() throws PoemException {
    super.init();
    defineColumn(col_id =
        new Column<Integer>(this, "id",
                   new TroidPoemType(),
                   DefinitionSource.dsd) { 
          public Object getCooked(Persistent g)
              throws AccessPoemException, PoemException {
            return ((BinaryField)g).getId();
          }

          public void setCooked(Persistent g, Object cooked)
              throws AccessPoemException, ValidationPoemException {
            ((BinaryField)g).setId((Integer)cooked);
          }

          public Field<Integer> asField(Persistent g) {
            return ((BinaryField)g).getIdField();
          }

          protected boolean defaultUserEditable() {
            return false;
          }

          protected boolean defaultUserCreateable() {
            return false;
          }

          protected DisplayLevel defaultDisplayLevel() {
            return DisplayLevel.summary;
          }

          protected Searchability defaultSearchability() {
            return Searchability.yes;
          }

          protected String defaultDisplayName() {
            return "Id";
          }

          protected int defaultDisplayOrder() {
            return 0;
          }

          protected boolean defaultIndexed() {
            return true;
          }

          protected boolean defaultUnique() {
            return true;
          }

          protected int defaultWidth() {
            return 20;
          }

          protected int defaultHeight() {
            return 1;
          }

          public Object getRaw_unsafe(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getId_unsafe();
          }

          public void setRaw_unsafe(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setId_unsafe((Integer)raw);
          }

          public Object getRaw(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getId();
          }

          public void setRaw(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setId((Integer)raw);
          }
        });

    defineColumn(col_binaryfield =
        new Column<byte[]>(this, "binaryfield",
                   new BinaryPoemType(true, 13),
                   DefinitionSource.dsd) { 
          public Object getCooked(Persistent g)
              throws AccessPoemException, PoemException {
            return ((BinaryField)g).getBinaryfield();
          }

          public void setCooked(Persistent g, Object cooked)
              throws AccessPoemException, ValidationPoemException {
            ((BinaryField)g).setBinaryfield((byte[])cooked);
          }

          public Field<byte[]> asField(Persistent g) {
            return ((BinaryField)g).getBinaryfieldField();
          }

          protected boolean defaultUserEditable() {
            return false;
          }

          protected boolean defaultUserCreateable() {
            return false;
          }

          protected DisplayLevel defaultDisplayLevel() {
            return DisplayLevel.summary;
          }

          protected Searchability defaultSearchability() {
            return Searchability.no;
          }

          protected String defaultDisplayName() {
            return "Binaryfield";
          }

          protected int defaultDisplayOrder() {
            return 1;
          }

          protected int defaultWidth() {
            return 20;
          }

          protected int defaultHeight() {
            return 1;
          }

          public Object getRaw_unsafe(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getBinaryfield_unsafe();
          }

          public void setRaw_unsafe(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setBinaryfield_unsafe((byte[])raw);
          }

          public Object getRaw(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getBinaryfield();
          }

          public void setRaw(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setBinaryfield((byte[])raw);
          }
        });

    defineColumn(col_unlimited =
        new Column<byte[]>(this, "unlimited",
                   new BinaryPoemType(true, -1),
                   DefinitionSource.dsd) { 
          public Object getCooked(Persistent g)
              throws AccessPoemException, PoemException {
            return ((BinaryField)g).getUnlimited();
          }

          public void setCooked(Persistent g, Object cooked)
              throws AccessPoemException, ValidationPoemException {
            ((BinaryField)g).setUnlimited((byte[])cooked);
          }

          public Field<byte[]> asField(Persistent g) {
            return ((BinaryField)g).getUnlimitedField();
          }

          protected boolean defaultUserEditable() {
            return false;
          }

          protected boolean defaultUserCreateable() {
            return false;
          }

          protected DisplayLevel defaultDisplayLevel() {
            return DisplayLevel.summary;
          }

          protected Searchability defaultSearchability() {
            return Searchability.no;
          }

          protected String defaultDisplayName() {
            return "Binaryfield";
          }

          protected int defaultDisplayOrder() {
            return 1;
          }

          protected int defaultWidth() {
            return 20;
          }

          protected int defaultHeight() {
            return 1;
          }

          public Object getRaw_unsafe(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getUnlimited_unsafe();
          }

          public void setRaw_unsafe(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setUnlimited_unsafe((byte[])raw);
          }

          public Object getRaw(Persistent g)
              throws AccessPoemException {
            return ((BinaryField)g).getUnlimited();
          }

          public void setRaw(Persistent g, Object raw)
              throws AccessPoemException {
            ((BinaryField)g).setUnlimited((byte[])raw);
          }
        });
  }


 /**
  * Retrieves the <code>Id</code> <code>Column</code> for this 
  * <code>BinaryField</code> <code>Table</code>.
  * 
  * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
  * @return the id <code>Column</code>
  */
  public final Column<Integer> getIdColumn() {
    return col_id;
  }


 /**
  * Retrieves the <code>Binaryfield</code> <code>Column</code> for this 
  * <code>BinaryField</code> <code>Table</code>.
  * 
  * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
  * @return the binaryfield <code>Column</code>
  */
  public final Column<byte[]> getBinaryfieldColumn() {
    return col_binaryfield;
  }


 /**
  * Retrieves the <code>Unlimited</code> <code>Column</code> for this 
  * <code>BinaryField</code> <code>Table</code>.
  * 
  * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
  * @return the unlimited <code>Column</code>
  */
  public final Column<byte[]> getUnlimitedColumn() {
    return col_unlimited;
  }


 /**
  * Retrieve the <code>BinaryField</code> as a <code>BinaryField</code>.
  *
  * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
  * @param troid a Table Row Oject ID
  * @return the <code>Persistent</code> identified by the <code>troid</code>
  */
  public BinaryField getBinaryFieldObject(Integer troid) {
    return (BinaryField)getObject(troid);
  }


 /**
  * Retrieve the <code>BinaryField</code> 
  * as a <code>BinaryField</code>.
  *
  * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
  * @param troid a Table Row Object ID
  * @return the <code>Persistent</code> identified   */
  public BinaryField getBinaryFieldObject(int troid) {
    return (BinaryField)getObject(troid);
  }

  protected JdbcPersistent _newPersistent() {
    return new BinaryField();
  }
  protected String defaultDisplayName() {
    return "Binary Field";
  }

  protected String defaultDescription() {
    return "A table with only a binary field in it";
  }

  protected Integer defaultCacheLimit() {
    return new Integer(100);
  }

  protected String defaultCategory() {
    return "Normal";
  }

  protected int defaultDisplayOrder() {
    return 10;
  }
}

