1 package org.paneris.melati.site.model; 2 3 import org.paneris.melati.site.model.generated.UploadedFileTypeTableBase; 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>UploadedFileTypeTable</code> object. 11 * <p> 12 * Description: 13 * A type of uploaded file. 14 * </p> 15 * 16 * 17 * <table> 18 * <tr><th colspan='3'> 19 * Field summary for SQL table <code>UploadedFileType</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> type </td><td> String </td><td> Type of uploaded file </td></tr> 24 * </table> 25 * 26 * @generator org.melati.poem.prepro.TableDef#generateTableMainJava 27 */ 28 public class UploadedFileTypeTable extends UploadedFileTypeTableBase { 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 UploadedFileTypeTable( 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 * @return existing or newly minted Persistent 49 */ 50 public UploadedFileType ensure(String type) { 51 UploadedFileType p = (UploadedFileType)getTypeColumn().firstWhereEq(type); 52 if (p == null) { 53 p = (UploadedFileType)newPersistent(); 54 p.setType(type); 55 p.makePersistent(); 56 } 57 return p; 58 } 59 60 }