1 package org.paneris.jammyjoes.model; 2 3 import java.sql.ResultSet; 4 5 import org.melati.poem.Database; 6 import org.melati.poem.DefinitionSource; 7 import org.melati.poem.PoemException; 8 import org.paneris.jammyjoes.model.generated.ProductStatusTableBase; 9 10 public class ProductStatusTable extends ProductStatusTableBase { 11 12 private ProductStatus discontinued, normallystocked, notstocked, newItem; 13 14 public ProductStatusTable( 15 Database database, String name, 16 DefinitionSource definitionSource) throws PoemException { 17 super(database, name, definitionSource); 18 } 19 20 public synchronized void unifyWithDB(ResultSet colDescs) 21 throws PoemException { 22 super.unifyWithDB(colDescs); 23 normallystocked = ensure("Normally Stocked"); 24 notstocked = ensure("Do Not Reorder"); 25 discontinued = ensure("Discontinued"); 26 newItem = ensure("New"); 27 } 28 29 public ProductStatus ensure(String status) { 30 ProductStatus p = (ProductStatus)newPersistent(); 31 p.setStatus(status); 32 return (ProductStatus)getStatusColumn().ensure(p); 33 } 34 35 public ProductStatus getNormallyStocked() { 36 return normallystocked; 37 } 38 39 public ProductStatus getNotStocked() { 40 return notstocked; 41 } 42 43 public ProductStatus getDiscontinued() { 44 return discontinued; 45 } 46 47 public ProductStatus getNew() { 48 return newItem; 49 } 50 }