1 package org.paneris.melati.site.model; 2 3 import org.paneris.melati.site.model.generated.StyleTableBase; 4 import org.melati.poem.DefinitionSource; 5 import org.melati.poem.Database; 6 import org.melati.poem.PoemException; 7 8 /** 9 * Melati POEM generated, programmer modifiable stub 10 * for a <code>StyleTable</code> object. 11 * <p> 12 * Description: 13 * A CSS Class Id. 14 * </p> 15 * 16 * 17 * <table> 18 * <tr><th colspan='3'> 19 * Field summary for SQL table <code>Style</code> 20 * </th></tr> 21 * <tr><th>Name</th><th>Type</th><th>Description</th></tr> 22 * <tr><td> id </td><td> Integer </td><td> </td></tr> 23 * <tr><td> name </td><td> String </td><td> The Class id </td></tr> 24 * </table> 25 * 26 * @generator org.melati.poem.prepro.TableDef#generateTableMainJava 27 */ 28 public class StyleTable extends StyleTableBase { 29 30 /** 31 * Constructor. 32 * 33 * @generator org.melati.poem.prepro.TableDef#generateTableMainJava 34 * @param database the POEM database we are using 35 * @param name the name of this <code>Table</code> 36 * @param definitionSource which definition is being used 37 * @throws PoemException if anything goes wrong 38 */ 39 public StyleTable( 40 Database database, String name, 41 DefinitionSource definitionSource) throws PoemException { 42 super(database, name, definitionSource); 43 } 44 45 // programmer's domain-specific code here 46 47 /** 48 * Create or retrieve existing organisation by name. 49 * 50 * @return the existing or newly created object 51 */ 52 53 public Style ensure(String name) { 54 Style p = (Style)getNameColumn().firstWhereEq(name); 55 if (p == null) { 56 p = (Style)newPersistent(); 57 p.setName(name); 58 p.makePersistent(); 59 } 60 return p; 61 } 62 63 }