Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LayoutTable |
|
| 1.5;1.5 |
1 | package org.paneris.bibliomania; | |
2 | ||
3 | ||
4 | import org.paneris.bibliomania.generated.LayoutTableBase; | |
5 | import org.melati.poem.DefinitionSource; | |
6 | import org.melati.poem.Database; | |
7 | import org.melati.poem.PoemException; | |
8 | ||
9 | /** | |
10 | * Melati POEM generated, programmer modifiable stub | |
11 | * for a <code>LayoutTable</code> object. | |
12 | * <p> | |
13 | * Description: | |
14 | * A page format code, used to control HTML fragment layout. | |
15 | * </p> | |
16 | * | |
17 | * | |
18 | * <table> | |
19 | * <tr><th colspan='3'> | |
20 | * Field summary for SQL table <code>Layout</code> | |
21 | * </th></tr> | |
22 | * <tr><th>Name</th><th>Type</th><th>Description</th></tr> | |
23 | * <tr><td> id </td><td> Integer </td><td> </td></tr> | |
24 | * <tr><td> displayname </td><td> String </td><td> The layout's name | |
25 | * </td></tr> | |
26 | * </table> | |
27 | * | |
28 | * see org.melati.poem.prepro.TableDef#generateTableJava | |
29 | */ | |
30 | public class LayoutTable<T extends Layout> extends LayoutTableBase<Layout> { | |
31 | ||
32 | /** | |
33 | * Constructor. | |
34 | * | |
35 | * see org.melati.poem.prepro.TableDef#generateTableJava | |
36 | * @param database the POEM database we are using | |
37 | * @param name the name of this <code>Table</code> | |
38 | * @param definitionSource which definition is being used | |
39 | * @throws PoemException if anything goes wrong | |
40 | */ | |
41 | public LayoutTable( | |
42 | Database database, String name, | |
43 | DefinitionSource definitionSource) throws PoemException { | |
44 | 2 | super(database, name, definitionSource); |
45 | 2 | } |
46 | ||
47 | // programmer's domain-specific code here | |
48 | ||
49 | @SuppressWarnings("unchecked") | |
50 | public T ensure(String displayname) { | |
51 | 0 | T p = (T)getDisplaynameColumn().firstWhereEq(displayname); |
52 | 0 | if (p == null) { |
53 | 0 | p = (T)newPersistent(); |
54 | 0 | p.setDisplayname(displayname); |
55 | } | |
56 | 0 | return (T)getDisplaynameColumn().ensure(p); |
57 | ||
58 | } | |
59 | ||
60 | } | |
61 |