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