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