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