View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
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   * Melati POEM generated base class for 
23  <code>Table</code> <code>Parent</code>.
24   *
25   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
26   */
27  
28  public class ParentTableBase extends OdmgTable {
29  
30    private Column col_id = null;
31    private Column col_name = 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 ParentTableBase(
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 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   * Retrieves the <code>Id</code> <code>Column</code> for this 
160   * <code>Parent</code> <code>Table</code>.
161   * 
162   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
163   * @return the id <code>Column</code>
164   */
165   public final Column getIdColumn() {
166     return col_id;
167   }
168 
169 
170  /**
171   * Retrieves the <code>Name</code> <code>Column</code> for this 
172   * <code>Parent</code> <code>Table</code>.
173   * 
174   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
175   * @return the name <code>Column</code>
176   */
177   public final Column getNameColumn() {
178     return col_name;
179   }
180 
181 
182  /**
183   * Retrieve the <code>Parent</code> as a <code>Parent</code>.
184   *
185   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
186   * @param troid a Table Row Oject ID
187   * @return the <code>Persistent</code> identified by the <code>troid</code>
188   */
189   public Parent getParentObject(Integer troid) {
190     return (Parent)getObject(troid);
191   }
192 
193 
194  /**
195   * Retrieve the <code>Parent</code> 
196   * as a <code>Parent</code>.
197   *
198   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
199   * @param troid a Table Row Object ID
200   * @return the <code>Persistent</code> identified   */
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