| 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 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
public class BoardTypeTable<T extends BoardType> extends BoardTypeTableBase<BoardType> { |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
public BoardTypeTable( |
| 37 | |
Database database, String name, |
| 38 | |
DefinitionSource definitionSource) throws PoemException { |
| 39 | 2 | super(database, name, definitionSource); |
| 40 | 2 | } |
| 41 | |
|
| 42 | |
|
| 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 | 0 | super.unifyWithDB(colDescs,"id"); |
| 57 | 0 | general = ensure("General","Top level boards"); |
| 58 | 0 | sectionGroup = ensure("SectionGroup","SectionGroup messageboard"); |
| 59 | 0 | section = ensure("Section","Section messageboard"); |
| 60 | 0 | author = ensure("Author","Author messageboard"); |
| 61 | 0 | book = ensure("Book","Book messageboard"); |
| 62 | 0 | chapter = ensure("Chapter","Chapter messageboard"); |
| 63 | 0 | } |
| 64 | |
|
| 65 | |
|
| 66 | |
public BoardType ensure(String type, String description) { |
| 67 | 0 | BoardType t = (BoardType)newPersistent(); |
| 68 | 0 | t.setType(type); |
| 69 | 0 | t.setDescription(description); |
| 70 | |
|
| 71 | 0 | return (BoardType)getTypeColumn().ensure(t); |
| 72 | |
} |
| 73 | |
|
| 74 | |
|
| 75 | |
public BoardType general() { |
| 76 | 0 | return general; |
| 77 | |
} |
| 78 | |
|
| 79 | |
public BoardType sectionGroup() { |
| 80 | 0 | return sectionGroup; |
| 81 | |
} |
| 82 | |
|
| 83 | |
public BoardType section() { |
| 84 | 0 | return section; |
| 85 | |
} |
| 86 | |
|
| 87 | |
public BoardType author() { |
| 88 | 0 | return author; |
| 89 | |
} |
| 90 | |
|
| 91 | |
public BoardType book() { |
| 92 | 0 | return book; |
| 93 | |
} |
| 94 | |
|
| 95 | |
public BoardType chapter() { |
| 96 | 0 | return chapter; |
| 97 | |
} |
| 98 | |
|
| 99 | |
|
| 100 | |
} |
| 101 | |
|