SettingBase.java

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

  2. package org.melati.poem.generated;


  3. import org.melati.poem.AccessPoemException;
  4. import org.melati.poem.Column;
  5. import org.melati.poem.Field;
  6. import org.melati.poem.PoemDatabaseTables;
  7. import org.melati.poem.Setting;
  8. import org.melati.poem.SettingTable;
  9. import org.melati.poem.ValidationPoemException;
  10. import org.melati.poem.ValueInfo;


  11. /**
  12.  * Melati POEM generated abstract base class for a <code>Persistent</code>
  13.  * <code>setting</code> Object.
  14.  *
  15.  * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  16.  */
  17. public abstract class SettingBase extends ValueInfo {


  18.  /**
  19.   * Retrieves the Database object.
  20.   *
  21.   * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  22.   * @return the database
  23.   */
  24.   public PoemDatabaseTables getPoemDatabaseTables() {
  25.     return (PoemDatabaseTables)getDatabase();
  26.   }


  27.  /**
  28.   * Retrieves the  <code>SettingTable</code> table
  29.   * which this <code>Persistent</code> is from.
  30.   *
  31.   * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  32.   * @return the SettingTable
  33.   */
  34.   @SuppressWarnings("unchecked")
  35.   public SettingTable<Setting> getSettingTable() {
  36.     return (SettingTable<Setting>)getTable();
  37.   }

  38.   @SuppressWarnings("unchecked")
  39.   private SettingTable<Setting> _getSettingTable() {
  40.     return (SettingTable<Setting>)getTable();
  41.   }

  42.   // Fields in this table
  43.  /**
  44.   * id - The Table Row Object ID
  45.   */
  46.   protected Integer id;
  47.  /**
  48.   * name - A code name for this setting
  49.   */
  50.   protected String name;
  51.  /**
  52.   * value - The value of this setting
  53.   */
  54.   protected String value;


  55.  /**
  56.   * Retrieves the <code>Id</code> value, without locking,
  57.   * for this <code>setting</code> <code>Persistent</code>.
  58.   *
  59.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  60.   * @return the Integer id
  61.   */
  62.   public Integer getId_unsafe() {
  63.     return id;
  64.   }


  65.  /**
  66.   * Sets the <code>Id</code> value directly, without checking,
  67.   * for this setting <code>Persistent</code>.
  68.   *
  69.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  70.   * @param cooked  the pre-validated value to set
  71.   */
  72.   public void setId_unsafe(Integer cooked) {
  73.     id = cooked;
  74.   }

  75.  /**
  76.   * Retrieves the Id value, with locking, for this
  77.   * <code>setting</code> <code>Persistent</code>.
  78.   * Field description:
  79.   *   The Table Row Object ID
  80.   *
  81.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  82.   * @throws AccessPoemException
  83.   *         if the current <code>AccessToken</code>
  84.   *         does not confer write access rights
  85.   * @return the value of the field <code>Id</code> for this
  86.   *         <code>setting</code> <code>Persistent</code>  
  87.   */

  88.   public Integer getId()
  89.       throws AccessPoemException {
  90.     readLock();
  91.     return getId_unsafe();
  92.   }


  93.  /**
  94.   * Sets the <code>Id</code> value, with checking, for this
  95.   * <code>setting</code> <code>Persistent</code>.
  96.   * Field description:
  97.   *   The Table Row Object ID
  98.   *
  99.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
  100.   * @param cooked  a validated <code>int</code>
  101.   * @throws AccessPoemException
  102.   *         if the current <code>AccessToken</code>
  103.   *         does not confer write access rights
  104.   * @throws ValidationPoemException
  105.   *         if the value is not valid
  106.   */
  107.   public void setId(Integer cooked)
  108.       throws AccessPoemException, ValidationPoemException {
  109.     _getSettingTable().getIdColumn().
  110.       getType().assertValidCooked(cooked);
  111.     writeLock();
  112.     setId_unsafe(cooked);
  113.   }

  114.  /**
  115.   * Sets the <code>Id</code> value, with checking, for this
  116.   * <code>setting</code> <code>Persistent</code>.
  117.   * Field description:
  118.   *   The Table Row Object ID
  119.   *
  120.   *
  121.   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
  122.   * @param cooked  a validated <code>int</code>
  123.   * @throws AccessPoemException
  124.   *         if the current <code>AccessToken</code>
  125.   *         does not confer write access rights
  126.   * @throws ValidationPoemException
  127.   *         if the value is not valid
  128.   */

  129.   public final void setId(int cooked)
  130.       throws AccessPoemException, ValidationPoemException {
  131.     setId(new Integer(cooked));
  132.   }


  133.  /**
  134.   * Retrieves the <code>Id</code> value as a <code>Field</code>
  135.   * from this <code>setting</code> <code>Persistent</code>.
  136.   *
  137.   * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  138.   * @throws AccessPoemException
  139.   *         if the current <code>AccessToken</code>
  140.   *         does not confer write access rights
  141.   * @return the Integer id
  142.   */
  143.   public Field<Integer> getIdField() throws AccessPoemException {
  144.     Column<Integer> c = _getSettingTable().getIdColumn();
  145.     return new Field<Integer>((Integer)c.getRaw(this), c);
  146.   }


  147.  /**
  148.   * Retrieves the <code>Name</code> value, without locking,
  149.   * for this <code>setting</code> <code>Persistent</code>.
  150.   *
  151.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  152.   * @return the String name
  153.   */
  154.   public String getName_unsafe() {
  155.     return name;
  156.   }


  157.  /**
  158.   * Sets the <code>Name</code> value directly, without checking,
  159.   * for this setting <code>Persistent</code>.
  160.   *
  161.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  162.   * @param cooked  the pre-validated value to set
  163.   */
  164.   public void setName_unsafe(String cooked) {
  165.     name = cooked;
  166.   }

  167.  /**
  168.   * Retrieves the Name value, with locking, for this
  169.   * <code>setting</code> <code>Persistent</code>.
  170.   * Field description:
  171.   *   A code name for this setting
  172.   *
  173.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  174.   * @throws AccessPoemException
  175.   *         if the current <code>AccessToken</code>
  176.   *         does not confer write access rights
  177.   * @return the value of the field <code>Name</code> for this
  178.   *         <code>setting</code> <code>Persistent</code>  
  179.   */

  180.   public String getName()
  181.       throws AccessPoemException {
  182.     readLock();
  183.     return getName_unsafe();
  184.   }


  185.  /**
  186.   * Sets the <code>Name</code> value, with checking, for this
  187.   * <code>setting</code> <code>Persistent</code>.
  188.   * Field description:
  189.   *   A code name for this setting
  190.   *
  191.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
  192.   * @param cooked  a validated <code>int</code>
  193.   * @throws AccessPoemException
  194.   *         if the current <code>AccessToken</code>
  195.   *         does not confer write access rights
  196.   * @throws ValidationPoemException
  197.   *         if the value is not valid
  198.   */
  199.   public void setName(String cooked)
  200.       throws AccessPoemException, ValidationPoemException {
  201.     _getSettingTable().getNameColumn().
  202.       getType().assertValidCooked(cooked);
  203.     writeLock();
  204.     setName_unsafe(cooked);
  205.   }


  206.  /**
  207.   * Retrieves the <code>Name</code> value as a <code>Field</code>
  208.   * from this <code>setting</code> <code>Persistent</code>.
  209.   *
  210.   * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  211.   * @throws AccessPoemException
  212.   *         if the current <code>AccessToken</code>
  213.   *         does not confer write access rights
  214.   * @return the String name
  215.   */
  216.   public Field<String> getNameField() throws AccessPoemException {
  217.     Column<String> c = _getSettingTable().getNameColumn();
  218.     return new Field<String>((String)c.getRaw(this), c);
  219.   }


  220.  /**
  221.   * Retrieves the <code>Value</code> value, without locking,
  222.   * for this <code>setting</code> <code>Persistent</code>.
  223.   *
  224.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  225.   * @return the String value
  226.   */
  227.   public String getValue_unsafe() {
  228.     return value;
  229.   }


  230.  /**
  231.   * Sets the <code>Value</code> value directly, without checking,
  232.   * for this setting <code>Persistent</code>.
  233.   *
  234.   * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  235.   * @param cooked  the pre-validated value to set
  236.   */
  237.   public void setValue_unsafe(String cooked) {
  238.     value = cooked;
  239.   }

  240.  /**
  241.   * Retrieves the Value value, with locking, for this
  242.   * <code>setting</code> <code>Persistent</code>.
  243.   * Field description:
  244.   *   The value of this setting
  245.   *
  246.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  247.   * @throws AccessPoemException
  248.   *         if the current <code>AccessToken</code>
  249.   *         does not confer write access rights
  250.   * @return the value of the field <code>Value</code> for this
  251.   *         <code>setting</code> <code>Persistent</code>  
  252.   */

  253.   public String getValue()
  254.       throws AccessPoemException {
  255.     readLock();
  256.     return getValue_unsafe();
  257.   }


  258.  /**
  259.   * Sets the <code>Value</code> value, with checking, for this
  260.   * <code>setting</code> <code>Persistent</code>.
  261.   * Field description:
  262.   *   The value of this setting
  263.   *
  264.   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
  265.   * @param cooked  a validated <code>int</code>
  266.   * @throws AccessPoemException
  267.   *         if the current <code>AccessToken</code>
  268.   *         does not confer write access rights
  269.   * @throws ValidationPoemException
  270.   *         if the value is not valid
  271.   */
  272.   public void setValue(String cooked)
  273.       throws AccessPoemException, ValidationPoemException {
  274.     _getSettingTable().getValueColumn().
  275.       getType().assertValidCooked(cooked);
  276.     writeLock();
  277.     setValue_unsafe(cooked);
  278.   }


  279.  /**
  280.   * Retrieves the <code>Value</code> value as a <code>Field</code>
  281.   * from this <code>setting</code> <code>Persistent</code>.
  282.   *
  283.   * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  284.   * @throws AccessPoemException
  285.   *         if the current <code>AccessToken</code>
  286.   *         does not confer write access rights
  287.   * @return the String value
  288.   */
  289.   public Field<String> getValueField() throws AccessPoemException {
  290.     Column<String> c = _getSettingTable().getValueColumn();
  291.     return new Field<String>((String)c.getRaw(this), c);
  292.   }

  293. }