1
2
3 package org.melati.example.odmg.generated;
4
5
6 import org.melati.example.odmg.OdmgDatabaseTables;
7 import org.melati.example.odmg.OdmgTable;
8 import org.melati.example.odmg.Parent;
9 import org.melati.poem.AccessPoemException;
10 import org.melati.poem.Column;
11 import org.melati.poem.Database;
12 import org.melati.poem.DefinitionSource;
13 import org.melati.poem.Field;
14 import org.melati.poem.JdbcPersistent;
15 import org.melati.poem.Persistent;
16 import org.melati.poem.PoemException;
17 import org.melati.poem.StringPoemType;
18 import org.melati.poem.TroidPoemType;
19 import org.melati.poem.ValidationPoemException;
20
21
22
23
24
25
26
27
28 public class ParentTableBase<T extends Parent> extends OdmgTable<T> {
29
30 private Column<Integer> col_id = null;
31 private Column<String> col_name = null;
32
33
34
35
36
37
38
39
40
41
42
43 public ParentTableBase(
44 Database database, String name,
45 DefinitionSource definitionSource) throws PoemException {
46 super(database, name, definitionSource);
47 }
48
49
50
51
52
53
54
55
56 public OdmgDatabaseTables getOdmgDatabaseTables() {
57 return (OdmgDatabaseTables)getDatabase();
58 }
59
60
61
62
63
64
65
66 public void init() throws PoemException {
67 super.init();
68 defineColumn(col_id =
69 new Column<Integer>(this, "id",
70 new TroidPoemType(),
71 DefinitionSource.dsd) {
72 public Object getCooked(Persistent g)
73 throws AccessPoemException, PoemException {
74 return ((Parent)g).getId();
75 }
76
77 public void setCooked(Persistent g, Object cooked)
78 throws AccessPoemException, ValidationPoemException {
79 ((Parent)g).setId((Integer)cooked);
80 }
81
82 public Field<Integer> asField(Persistent g) {
83 return ((Parent)g).getIdField();
84 }
85
86 public boolean defaultUserEditable() {
87 return false;
88 }
89
90 public boolean defaultUserCreateable() {
91 return false;
92 }
93
94 public int defaultDisplayOrder() {
95 return 0;
96 }
97
98 public Object getRaw_unsafe(Persistent g)
99 throws AccessPoemException {
100 return ((Parent)g).getId_unsafe();
101 }
102
103 public void setRaw_unsafe(Persistent g, Object raw)
104 throws AccessPoemException {
105 ((Parent)g).setId_unsafe((Integer)raw);
106 }
107
108 public Object getRaw(Persistent g)
109 throws AccessPoemException {
110 return ((Parent)g).getId();
111 }
112
113 public void setRaw(Persistent g, Object raw)
114 throws AccessPoemException {
115 ((Parent)g).setId((Integer)raw);
116 }
117 });
118
119 defineColumn(col_name =
120 new Column<String>(this, "name",
121 new StringPoemType(false, 60),
122 DefinitionSource.dsd) {
123 public Object getCooked(Persistent g)
124 throws AccessPoemException, PoemException {
125 return ((Parent)g).getName();
126 }
127
128 public void setCooked(Persistent g, Object cooked)
129 throws AccessPoemException, ValidationPoemException {
130 ((Parent)g).setName((String)cooked);
131 }
132
133 public Field<String> asField(Persistent g) {
134 return ((Parent)g).getNameField();
135 }
136
137 public int defaultDisplayOrder() {
138 return 1;
139 }
140
141 public Object getRaw_unsafe(Persistent g)
142 throws AccessPoemException {
143 return ((Parent)g).getName_unsafe();
144 }
145
146 public void setRaw_unsafe(Persistent g, Object raw)
147 throws AccessPoemException {
148 ((Parent)g).setName_unsafe((String)raw);
149 }
150
151 public Object getRaw(Persistent g)
152 throws AccessPoemException {
153 return ((Parent)g).getName();
154 }
155
156 public void setRaw(Persistent g, Object raw)
157 throws AccessPoemException {
158 ((Parent)g).setName((String)raw);
159 }
160 });
161 }
162
163
164
165
166
167
168
169
170
171 public final Column<Integer> getIdColumn() {
172 return col_id;
173 }
174
175
176
177
178
179
180
181
182
183 public final Column<String> getNameColumn() {
184 return col_name;
185 }
186
187
188
189
190
191
192
193
194
195 public Parent getParentObject(Integer troid) {
196 return (Parent)getObject(troid);
197 }
198
199
200
201
202
203
204
205
206
207 public Parent getParentObject(int troid) {
208 return (Parent)getObject(troid);
209 }
210
211 protected JdbcPersistent _newPersistent() {
212 return new Parent();
213 }
214 public int defaultDisplayOrder() {
215 return 0;
216 }
217 }
218