View Javadoc

1   package org.paneris.bibliomania;
2   
3   
4   import java.sql.ResultSet;
5   
6   import org.paneris.bibliomania.generated.BoardTypeTableBase;
7   import org.melati.poem.DefinitionSource;
8   import org.melati.poem.Database;
9   import org.melati.poem.PoemException;
10  
11  /**
12   * Melati POEM generated, programmer modifiable stub 
13   * for a <code>BoardTypeTable</code> object.
14   *
15   * 
16   * <table> 
17   * <tr><th colspan='3'>
18   * Field summary for SQL table <code>BoardType</code>
19   * </th></tr>
20   * <tr><th>Name</th><th>Type</th><th>Description</th></tr>
21   * </table> 
22   * 
23   * see  org.melati.poem.prepro.TableDef#generateTableJava 
24   */
25  public class BoardTypeTable<T extends BoardType> extends BoardTypeTableBase<BoardType> {
26  
27   /**
28    * Constructor.
29    * 
30    * see org.melati.poem.prepro.TableDef#generateTableJava 
31    * @param database          the POEM database we are using
32    * @param name              the name of this <code>Table</code>
33    * @param definitionSource  which definition is being used
34    * @throws PoemException    if anything goes wrong
35    */
36    public BoardTypeTable(
37        Database database, String name,
38        DefinitionSource definitionSource) throws PoemException {
39      super(database, name, definitionSource);
40    }
41  
42    // programmer's domain-specific code here
43    
44    protected BoardType general;
45    protected BoardType sectionGroup;
46    protected BoardType section;
47    protected BoardType author;
48    protected BoardType book;
49    protected BoardType chapter;
50  
51  
52  
53  
54    public synchronized void unifyWithDB(ResultSet colDescs)
55        throws PoemException {
56      super.unifyWithDB(colDescs,"id");
57       general =  ensure("General","Top level boards");
58       sectionGroup = ensure("SectionGroup","SectionGroup messageboard");
59       section = ensure("Section","Section messageboard");
60       author = ensure("Author","Author messageboard");
61       book = ensure("Book","Book messageboard");
62       chapter = ensure("Chapter","Chapter messageboard");
63    }
64  
65  
66    public BoardType ensure(String type, String description) {
67      BoardType t = (BoardType)newPersistent();
68      t.setType(type);
69      t.setDescription(description);
70      
71      return (BoardType)getTypeColumn().ensure(t);
72    }
73  
74  
75    public BoardType general() {
76      return general;
77    }
78  
79    public BoardType sectionGroup() {
80      return sectionGroup;
81    }
82  
83    public BoardType section() {
84      return section;
85    }
86  
87    public BoardType author() {
88      return author;
89    }
90  
91    public BoardType book() {
92      return book;
93    }
94  
95    public BoardType chapter() {
96      return chapter;
97    }
98  
99    
100 }
101