View Javadoc
1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.melati.poem.test.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  // Extended table 
18  import org.melati.poem.UserTable;
19  import org.melati.poem.ValidationPoemException;
20  import org.melati.poem.test.EverythingDatabaseTables;
21  // Extended table 
22  import org.melati.poem.test.User;
23  
24  
25  /**
26   * Melati POEM generated base class for <code>Table</code> <code>User</code>.
27   *
28   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
29   */
30  
31  public class UserTableBase<T extends User> extends UserTable<T> {
32  
33    private Column<String> col_email = null;
34  
35   /**
36    * Constructor. 
37    * 
38    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
39    * @param database          the POEM database we are using
40    * @param name              the name of this <code>Table</code>
41    * @param definitionSource  which definition is being used
42    * @throws PoemException    if anything goes wrong
43    */
44  
45    public UserTableBase(
46        Database database, String name,
47        DefinitionSource definitionSource) throws PoemException {
48      super(database, name, definitionSource);
49    }
50  
51  
52   /**
53    * Get the database tables.
54    *
55    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
56    * @return the database tables
57    */
58    public EverythingDatabaseTables getEverythingDatabaseTables() {
59      return (EverythingDatabaseTables)getDatabase();
60    }
61  
62  
63   /**
64    * Initialise this table by defining its columns.
65    *
66    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
67    */
68    public void init() throws PoemException {
69      super.init();
70      defineColumn(col_email =
71          new Column<String>(this, "email",
72                     new StringPoemType(true, -1),
73                     DefinitionSource.dsd) { 
74            public Object getCooked(Persistent g)
75                throws AccessPoemException, PoemException {
76              return ((org.melati.poem.test.User)g).getEmail();
77            }
78  
79            public void setCooked(Persistent g, Object cooked)
80                throws AccessPoemException, ValidationPoemException {
81              ((org.melati.poem.test.User)g).setEmail((String)cooked);
82            }
83  
84            public Field<String> asField(Persistent g) {
85              return ((org.melati.poem.test.User)g).getEmailField();
86            }
87  
88            public DisplayLevel defaultDisplayLevel() {
89              return DisplayLevel.summary;
90            }
91  
92            public Searchability defaultSearchability() {
93              return Searchability.yes;
94            }
95  
96            public int defaultDisplayOrder() {
97              return 50;
98            }
99  
100           public String defaultDescription() {
101             return "The user's email address";
102           }
103 
104           public int defaultWidth() {
105             return 40;
106           }
107 
108           public Object getRaw_unsafe(Persistent g)
109               throws AccessPoemException {
110             return ((org.melati.poem.test.User)g).getEmail_unsafe();
111           }
112 
113           public void setRaw_unsafe(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((org.melati.poem.test.User)g).setEmail_unsafe((String)raw);
116           }
117 
118           public Object getRaw(Persistent g)
119               throws AccessPoemException {
120             return ((org.melati.poem.test.User)g).getEmail();
121           }
122 
123           public void setRaw(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((org.melati.poem.test.User)g).setEmail((String)raw);
126           }
127         });
128   }
129 
130 
131  /**
132   * Retrieves the <code>Email</code> <code>Column</code> for this 
133   * <code>User</code> <code>Table</code>.
134   * 
135   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
136   * @return the email <code>Column</code>
137   */
138   public final Column<String> getEmailColumn() {
139     return col_email;
140   }
141 
142 
143  /**
144   * Retrieve the <code>User</code> as a <code>org.melati.poem.User</code>.
145   *
146   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
147   * @param troid a Table Row Object ID
148   * @return the <code>Persistent</code> identified by the <code>troid</code>
149   */
150   public org.melati.poem.User getUserObject(Integer troid) {
151     return (org.melati.poem.User)getObject(troid);
152   }
153 
154 
155  /**
156   * Retrieve the <code>User</code> 
157   * as a <code>org.melati.poem.User</code>.
158   *
159   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
160   * @param troid a Table Row Object ID
161   * @return the <code>Persistent</code> identified   */
162   public org.melati.poem.User getUserObject(int troid) {
163     return (org.melati.poem.User)getObject(troid);
164   }
165 
166   protected JdbcPersistent _newPersistent() {
167     return new org.melati.poem.test.User();
168   }
169   public String defaultDescription() {
170     return "An emailed user";
171   }
172 
173   public String defaultCategory() {
174     return "User";
175   }
176 
177   public int defaultDisplayOrder() {
178     return 2010;
179   }
180 }
181