/melati-example-odmg/src/main/java/org/melati/example/odmg/generated/ChildBase.java

https://github.com/timp21337/melati-old · Java · 358 lines · 111 code · 49 blank · 198 comment · 5 complexity · 0daa63bfe38e23a9ed5fe81b00744f8c MD5 · raw file

  1. // Do not edit this file! It was generated by Melati POEM's DSD preprocessor.
  2. package org.melati.example.odmg.generated;
  3. import org.melati.example.odmg.ChildTable;
  4. import org.melati.example.odmg.OdmgDatabaseTables;
  5. import org.melati.example.odmg.Parent;
  6. import org.melati.poem.AccessPoemException;
  7. import org.melati.poem.Column;
  8. import org.melati.poem.Field;
  9. import org.melati.poem.JdbcPersistent;
  10. import org.melati.poem.NoSuchRowPoemException;
  11. import org.melati.poem.ValidationPoemException;
  12. /**
  13. * Melati POEM generated abstract base class for a <code>Persistent</code>
  14. * <code>Child</code> Object.
  15. *
  16. * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  17. */
  18. public abstract class ChildBase extends JdbcPersistent {
  19. /**
  20. * Retrieves the Database object.
  21. *
  22. * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  23. * @return the database
  24. */
  25. public OdmgDatabaseTables getOdmgDatabaseTables() {
  26. return (OdmgDatabaseTables)getDatabase();
  27. }
  28. /**
  29. * Retrieves the <code>ChildTable</code> table
  30. * which this <code>Persistent</code> is from.
  31. *
  32. * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
  33. * @return the ChildTable
  34. */
  35. public ChildTable getChildTable() {
  36. return (ChildTable)getTable();
  37. }
  38. private ChildTable _getChildTable() {
  39. return (ChildTable)getTable();
  40. }
  41. // Fields in this table
  42. /**
  43. * id
  44. */
  45. protected Integer id;
  46. /**
  47. * name
  48. */
  49. protected String name;
  50. /**
  51. * parent
  52. */
  53. protected Integer parent;
  54. /**
  55. * Retrieves the <code>Id</code> value, without locking,
  56. * for this <code>Child</code> <code>Persistent</code>.
  57. *
  58. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  59. * @return the Integer id
  60. */
  61. public Integer getId_unsafe() {
  62. return id;
  63. }
  64. /**
  65. * Sets the <code>Id</code> value directly, without checking,
  66. * for this Child <code>Persistent</code>.
  67. *
  68. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  69. * @param cooked the pre-validated value to set
  70. */
  71. public void setId_unsafe(Integer cooked) {
  72. id = cooked;
  73. }
  74. /**
  75. * Retrieves the Id value, with locking, for this
  76. * <code>Child</code> <code>Persistent</code>.
  77. *
  78. * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  79. * @throws AccessPoemException
  80. * if the current <code>AccessToken</code>
  81. * does not confer write access rights
  82. * @return the value of the field <code>Id</code> for this
  83. * <code>Child</code> <code>Persistent</code>
  84. */
  85. public Integer getId()
  86. throws AccessPoemException {
  87. readLock();
  88. return getId_unsafe();
  89. }
  90. /**
  91. * Sets the <code>Id</code> value, with checking, for this
  92. * <code>Child</code> <code>Persistent</code>.
  93. *
  94. * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  95. * @param cooked a validated <code>int</code>
  96. * @throws AccessPoemException
  97. * if the current <code>AccessToken</code>
  98. * does not confer write access rights
  99. * @throws ValidationPoemException
  100. * if the value is not valid
  101. */
  102. public void setId(Integer cooked)
  103. throws AccessPoemException, ValidationPoemException {
  104. _getChildTable().getIdColumn().
  105. getType().assertValidCooked(cooked);
  106. writeLock();
  107. setId_unsafe(cooked);
  108. }
  109. /**
  110. * Sets the <code>Id</code> value, with checking, for this
  111. * <code>Child</code> <code>Persistent</code>.
  112. *
  113. * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
  114. * @param cooked a validated <code>int</code>
  115. * @throws AccessPoemException
  116. * if the current <code>AccessToken</code>
  117. * does not confer write access rights
  118. * @throws ValidationPoemException
  119. * if the value is not valid
  120. */
  121. public final void setId(int cooked)
  122. throws AccessPoemException, ValidationPoemException {
  123. setId(new Integer(cooked));
  124. }
  125. /**
  126. * Retrieves the <code>Id</code> value as a <code>Field</code>
  127. * from this <code>Child</code> <code>Persistent</code>.
  128. *
  129. * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  130. * @throws AccessPoemException
  131. * if the current <code>AccessToken</code>
  132. * does not confer write access rights
  133. * @return the Integer id
  134. */
  135. public Field<Integer> getIdField() throws AccessPoemException {
  136. Column<Integer> c = _getChildTable().getIdColumn();
  137. return new Field<Integer>((Integer)c.getRaw(this), c);
  138. }
  139. /**
  140. * Retrieves the <code>Name</code> value, without locking,
  141. * for this <code>Child</code> <code>Persistent</code>.
  142. *
  143. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  144. * @return the String name
  145. */
  146. public String getName_unsafe() {
  147. return name;
  148. }
  149. /**
  150. * Sets the <code>Name</code> value directly, without checking,
  151. * for this Child <code>Persistent</code>.
  152. *
  153. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  154. * @param cooked the pre-validated value to set
  155. */
  156. public void setName_unsafe(String cooked) {
  157. name = cooked;
  158. }
  159. /**
  160. * Retrieves the Name value, with locking, for this
  161. * <code>Child</code> <code>Persistent</code>.
  162. *
  163. * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  164. * @throws AccessPoemException
  165. * if the current <code>AccessToken</code>
  166. * does not confer write access rights
  167. * @return the value of the field <code>Name</code> for this
  168. * <code>Child</code> <code>Persistent</code>
  169. */
  170. public String getName()
  171. throws AccessPoemException {
  172. readLock();
  173. return getName_unsafe();
  174. }
  175. /**
  176. * Sets the <code>Name</code> value, with checking, for this
  177. * <code>Child</code> <code>Persistent</code>.
  178. *
  179. * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
  180. * @param cooked a validated <code>int</code>
  181. * @throws AccessPoemException
  182. * if the current <code>AccessToken</code>
  183. * does not confer write access rights
  184. * @throws ValidationPoemException
  185. * if the value is not valid
  186. */
  187. public void setName(String cooked)
  188. throws AccessPoemException, ValidationPoemException {
  189. _getChildTable().getNameColumn().
  190. getType().assertValidCooked(cooked);
  191. writeLock();
  192. setName_unsafe(cooked);
  193. }
  194. /**
  195. * Retrieves the <code>Name</code> value as a <code>Field</code>
  196. * from this <code>Child</code> <code>Persistent</code>.
  197. *
  198. * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  199. * @throws AccessPoemException
  200. * if the current <code>AccessToken</code>
  201. * does not confer write access rights
  202. * @return the String name
  203. */
  204. public Field<String> getNameField() throws AccessPoemException {
  205. Column<String> c = _getChildTable().getNameColumn();
  206. return new Field<String>((String)c.getRaw(this), c);
  207. }
  208. /**
  209. * Retrieves the <code>Parent</code> value, without locking,
  210. * for this <code>Child</code> <code>Persistent</code>.
  211. *
  212. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  213. * @return the Integer parent
  214. */
  215. public Integer getParent_unsafe() {
  216. return parent;
  217. }
  218. /**
  219. * Sets the <code>Parent</code> value directly, without checking,
  220. * for this Child <code>Persistent</code>.
  221. *
  222. * see org.melati.poem.prepro.FieldDef#generateBaseMethods
  223. * @param cooked the pre-validated value to set
  224. */
  225. public void setParent_unsafe(Integer cooked) {
  226. parent = cooked;
  227. }
  228. /**
  229. * Retrieves the Table Row Object ID.
  230. *
  231. * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
  232. * @throws AccessPoemException
  233. * if the current <code>AccessToken</code>
  234. * does not confer read access rights
  235. * @return the TROID as an <code>Integer</code>
  236. */
  237. public Integer getParentTroid()
  238. throws AccessPoemException {
  239. readLock();
  240. return getParent_unsafe();
  241. }
  242. /**
  243. * Sets the Table Row Object ID.
  244. *
  245. * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
  246. * @param raw a Table Row Object Id
  247. * @throws AccessPoemException
  248. * if the current <code>AccessToken</code>
  249. * does not confer write access rights
  250. */
  251. public void setParentTroid(Integer raw)
  252. throws AccessPoemException {
  253. setParent(raw == null ? null :
  254. getOdmgDatabaseTables().getParentTable().getParentObject(raw));
  255. }
  256. /**
  257. * Retrieves the <code>Parent</code> object referred to.
  258. *
  259. * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
  260. * @throws AccessPoemException
  261. * if the current <code>AccessToken</code>
  262. * does not confer read access rights
  263. * @throws NoSuchRowPoemException
  264. * if the <code>Persistent</code> has yet to be allocated a TROID
  265. * @return the <code>Parent</code> as a <code>Parent</code>
  266. */
  267. public Parent getParent()
  268. throws AccessPoemException, NoSuchRowPoemException {
  269. Integer troid = getParentTroid();
  270. return troid == null ? null :
  271. getOdmgDatabaseTables().getParentTable().getParentObject(troid);
  272. }
  273. /**
  274. * Set the Parent.
  275. *
  276. * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
  277. * @param cooked a validated <code>Parent</code>
  278. * @throws AccessPoemException
  279. * if the current <code>AccessToken</code>
  280. * does not confer write access rights
  281. */
  282. public void setParent(Parent cooked)
  283. throws AccessPoemException {
  284. _getChildTable().
  285. getParentColumn().
  286. getType().assertValidCooked(cooked);
  287. writeLock();
  288. if (cooked == null)
  289. setParent_unsafe(null);
  290. else {
  291. cooked.existenceLock();
  292. setParent_unsafe(cooked.troid());
  293. }
  294. }
  295. /**
  296. * Retrieves the <code>Parent</code> value as a <code>Field</code>
  297. * from this <code>Child</code> <code>Persistent</code>.
  298. *
  299. * see org.melati.poem.prepro.FieldDef#generateFieldCreator
  300. * @throws AccessPoemException
  301. * if the current <code>AccessToken</code>
  302. * does not confer write access rights
  303. * @return the Integer parent
  304. */
  305. public Field<Integer> getParentField() throws AccessPoemException {
  306. Column<Integer> c = _getChildTable().getParentColumn();
  307. return new Field<Integer>((Integer)c.getRaw(this), c);
  308. }
  309. }