Coverage Report - org.paneris.bibliomania.generated.CountryTableBase
 
Classes in this File Line Coverage Branch Coverage Complexity
CountryTableBase
52%
11/21
N/A
1
CountryTableBase$1
6%
1/15
N/A
1
CountryTableBase$2
6%
1/16
N/A
1
CountryTableBase$3
6%
1/15
N/A
1
 
 1  
 // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
 2  
 
 3  
 package org.paneris.bibliomania.generated;
 4  
 
 5  
 
 6  
 import org.melati.poem.AccessPoemException;
 7  
 import org.melati.poem.Column;
 8  
 import org.melati.poem.Database;
 9  
 import org.melati.poem.DefinitionSource;
 10  
 import org.melati.poem.DisplayLevel;
 11  
 import org.melati.poem.Field;
 12  
 import org.melati.poem.JdbcPersistent;
 13  
 import org.melati.poem.Persistent;
 14  
 import org.melati.poem.PoemException;
 15  
 import org.melati.poem.ReferencePoemType;
 16  
 import org.melati.poem.Searchability;
 17  
 import org.melati.poem.StringPoemType;
 18  
 import org.melati.poem.TroidPoemType;
 19  
 import org.melati.poem.ValidationPoemException;
 20  
 import org.paneris.bibliomania.BibliomaniaDatabaseTables;
 21  
 import org.paneris.bibliomania.BibliomaniaTable;
 22  
 import org.paneris.bibliomania.Country;
 23  
 import org.paneris.bibliomania.DeliveryChargeBand;
 24  
 
 25  
 
 26  
 /**
 27  
  * Melati POEM generated base class for <code>Table</code> <code>Country</code>.
 28  
  *
 29  
  * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 30  
  */
 31  
 
 32  
 public class CountryTableBase<T extends Country> extends BibliomaniaTable<T> {
 33  
 
 34  2
   private Column<Integer> col_id = null;
 35  2
   private Column<String> col_displayname = null;
 36  2
   private Column<Integer> col_deliverycharge = null;
 37  
 
 38  
  /**
 39  
   * Constructor. 
 40  
   * 
 41  
   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 42  
   * @param database          the POEM database we are using
 43  
   * @param name              the name of this <code>Table</code>
 44  
   * @param definitionSource  which definition is being used
 45  
   * @throws PoemException    if anything goes wrong
 46  
   */
 47  
 
 48  
   public CountryTableBase(
 49  
       Database database, String name,
 50  
       DefinitionSource definitionSource) throws PoemException {
 51  2
     super(database, name, definitionSource);
 52  2
   }
 53  
 
 54  
 
 55  
  /**
 56  
   * Get the database tables.
 57  
   *
 58  
   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 59  
   * @return the database tables
 60  
   */
 61  
   public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
 62  2
     return (BibliomaniaDatabaseTables)getDatabase();
 63  
   }
 64  
 
 65  
 
 66  
  /**
 67  
   * Initialise this table by defining its columns.
 68  
   *
 69  
   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 70  
   */
 71  
   public void init() throws PoemException {
 72  2
     super.init();
 73  2
     defineColumn(col_id =
 74  
         new Column<Integer>(this, "id",
 75  
                    new TroidPoemType(),
 76  2
                    DefinitionSource.dsd) { 
 77  
           public Object getCooked(Persistent g)
 78  
               throws AccessPoemException, PoemException {
 79  0
             return ((Country)g).getId();
 80  
           }
 81  
 
 82  
           public void setCooked(Persistent g, Object cooked)
 83  
               throws AccessPoemException, ValidationPoemException {
 84  0
             ((Country)g).setId((Integer)cooked);
 85  0
           }
 86  
 
 87  
           public Field<Integer> asField(Persistent g) {
 88  0
             return ((Country)g).getIdField();
 89  
           }
 90  
 
 91  
           public boolean defaultUserEditable() {
 92  0
             return false;
 93  
           }
 94  
 
 95  
           public boolean defaultUserCreateable() {
 96  0
             return false;
 97  
           }
 98  
 
 99  
           public DisplayLevel defaultDisplayLevel() {
 100  0
             return DisplayLevel.record;
 101  
           }
 102  
 
 103  
           public int defaultDisplayOrder() {
 104  0
             return 0;
 105  
           }
 106  
 
 107  
           public Object getRaw_unsafe(Persistent g)
 108  
               throws AccessPoemException {
 109  0
             return ((Country)g).getId_unsafe();
 110  
           }
 111  
 
 112  
           public void setRaw_unsafe(Persistent g, Object raw)
 113  
               throws AccessPoemException {
 114  0
             ((Country)g).setId_unsafe((Integer)raw);
 115  0
           }
 116  
 
 117  
           public Object getRaw(Persistent g)
 118  
               throws AccessPoemException {
 119  0
             return ((Country)g).getId();
 120  
           }
 121  
 
 122  
           public void setRaw(Persistent g, Object raw)
 123  
               throws AccessPoemException {
 124  0
             ((Country)g).setId((Integer)raw);
 125  0
           }
 126  
         });
 127  
 
 128  2
     defineColumn(col_displayname =
 129  
         new Column<String>(this, "displayname",
 130  
                    new StringPoemType(false, -1),
 131  2
                    DefinitionSource.dsd) { 
 132  
           public Object getCooked(Persistent g)
 133  
               throws AccessPoemException, PoemException {
 134  0
             return ((Country)g).getDisplayname();
 135  
           }
 136  
 
 137  
           public void setCooked(Persistent g, Object cooked)
 138  
               throws AccessPoemException, ValidationPoemException {
 139  0
             ((Country)g).setDisplayname((String)cooked);
 140  0
           }
 141  
 
 142  
           public Field<String> asField(Persistent g) {
 143  0
             return ((Country)g).getDisplaynameField();
 144  
           }
 145  
 
 146  
           public DisplayLevel defaultDisplayLevel() {
 147  0
             return DisplayLevel.primary;
 148  
           }
 149  
 
 150  
           public Searchability defaultSearchability() {
 151  0
             return Searchability.primary;
 152  
           }
 153  
 
 154  
           public String defaultDisplayName() {
 155  0
             return "Display name";
 156  
           }
 157  
 
 158  
           public int defaultDisplayOrder() {
 159  0
             return 1;
 160  
           }
 161  
 
 162  
           public String defaultDescription() {
 163  0
             return "The country's name";
 164  
           }
 165  
 
 166  
           public Object getRaw_unsafe(Persistent g)
 167  
               throws AccessPoemException {
 168  0
             return ((Country)g).getDisplayname_unsafe();
 169  
           }
 170  
 
 171  
           public void setRaw_unsafe(Persistent g, Object raw)
 172  
               throws AccessPoemException {
 173  0
             ((Country)g).setDisplayname_unsafe((String)raw);
 174  0
           }
 175  
 
 176  
           public Object getRaw(Persistent g)
 177  
               throws AccessPoemException {
 178  0
             return ((Country)g).getDisplayname();
 179  
           }
 180  
 
 181  
           public void setRaw(Persistent g, Object raw)
 182  
               throws AccessPoemException {
 183  0
             ((Country)g).setDisplayname((String)raw);
 184  0
           }
 185  
         });
 186  
 
 187  2
     defineColumn(col_deliverycharge =
 188  
         new Column<Integer>(this, "deliverycharge",
 189  
                    new ReferencePoemType(getBibliomaniaDatabaseTables().
 190  
                                              getDeliveryChargeBandTable(), false),
 191  2
                    DefinitionSource.dsd) { 
 192  
           public Object getCooked(Persistent g)
 193  
               throws AccessPoemException, PoemException {
 194  0
             return ((Country)g).getDeliverycharge();
 195  
           }
 196  
 
 197  
           public void setCooked(Persistent g, Object cooked)
 198  
               throws AccessPoemException, ValidationPoemException {
 199  0
             ((Country)g).setDeliverycharge((DeliveryChargeBand)cooked);
 200  0
           }
 201  
 
 202  
           public Field<Integer> asField(Persistent g) {
 203  0
             return ((Country)g).getDeliverychargeField();
 204  
           }
 205  
 
 206  
           public DisplayLevel defaultDisplayLevel() {
 207  0
             return DisplayLevel.summary;
 208  
           }
 209  
 
 210  
           public Searchability defaultSearchability() {
 211  0
             return Searchability.yes;
 212  
           }
 213  
 
 214  
           public String defaultDisplayName() {
 215  0
             return "Delivery Charge Band";
 216  
           }
 217  
 
 218  
           public int defaultDisplayOrder() {
 219  0
             return 2;
 220  
           }
 221  
 
 222  
           public Object getRaw_unsafe(Persistent g)
 223  
               throws AccessPoemException {
 224  0
             return ((Country)g).getDeliverycharge_unsafe();
 225  
           }
 226  
 
 227  
           public void setRaw_unsafe(Persistent g, Object raw)
 228  
               throws AccessPoemException {
 229  0
             ((Country)g).setDeliverycharge_unsafe((Integer)raw);
 230  0
           }
 231  
 
 232  
           public Object getRaw(Persistent g)
 233  
               throws AccessPoemException {
 234  0
             return ((Country)g).getDeliverychargeTroid();
 235  
           }
 236  
 
 237  
           public void setRaw(Persistent g, Object raw)
 238  
               throws AccessPoemException {
 239  0
             ((Country)g).setDeliverychargeTroid((Integer)raw);
 240  0
           }
 241  
         });
 242  2
   }
 243  
 
 244  
 
 245  
  /**
 246  
   * Retrieves the <code>Id</code> <code>Column</code> for this 
 247  
   * <code>Country</code> <code>Table</code>.
 248  
   * 
 249  
   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
 250  
   * @return the id <code>Column</code>
 251  
   */
 252  
   public final Column<Integer> getIdColumn() {
 253  0
     return col_id;
 254  
   }
 255  
 
 256  
 
 257  
  /**
 258  
   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
 259  
   * <code>Country</code> <code>Table</code>.
 260  
   * 
 261  
   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
 262  
   * @return the displayname <code>Column</code>
 263  
   */
 264  
   public final Column<String> getDisplaynameColumn() {
 265  0
     return col_displayname;
 266  
   }
 267  
 
 268  
 
 269  
  /**
 270  
   * Retrieves the <code>Deliverycharge</code> <code>Column</code> for this 
 271  
   * <code>Country</code> <code>Table</code>.
 272  
   * 
 273  
   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
 274  
   * @return the deliverycharge <code>Column</code>
 275  
   */
 276  
   public final Column<Integer> getDeliverychargeColumn() {
 277  0
     return col_deliverycharge;
 278  
   }
 279  
 
 280  
 
 281  
  /**
 282  
   * Retrieve the <code>Country</code> as a <code>Country</code>.
 283  
   *
 284  
   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 285  
   * @param troid a Table Row Oject ID
 286  
   * @return the <code>Persistent</code> identified by the <code>troid</code>
 287  
   */
 288  
   public Country getCountryObject(Integer troid) {
 289  0
     return (Country)getObject(troid);
 290  
   }
 291  
 
 292  
 
 293  
  /**
 294  
   * Retrieve the <code>Country</code> 
 295  
   * as a <code>Country</code>.
 296  
   *
 297  
   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
 298  
   * @param troid a Table Row Object ID
 299  
   * @return the <code>Persistent</code> identified   */
 300  
   public Country getCountryObject(int troid) {
 301  0
     return (Country)getObject(troid);
 302  
   }
 303  
 
 304  
   protected JdbcPersistent _newPersistent() {
 305  0
     return new Country();
 306  
   }
 307  
   public String defaultDescription() {
 308  0
     return "A country where a user can live";
 309  
   }
 310  
 
 311  
   public boolean defaultRememberAllTroids() {
 312  0
     return true;
 313  
   }
 314  
 
 315  
   public String defaultCategory() {
 316  0
     return "User";
 317  
   }
 318  
 
 319  
   public int defaultDisplayOrder() {
 320  0
     return 2080;
 321  
   }
 322  
 }
 323