1 package org.campware.cream.modules.actions; 2 3 42 43 import org.apache.velocity.context.Context; 44 45 import org.apache.turbine.util.RunData; 46 import org.apache.torque.util.Criteria; 47 48 import org.campware.cream.om.ProductCategory; 49 import org.campware.cream.om.ProductCategoryPeer; 50 51 55 public class ProductCategorySQL extends CreamAction 56 { 57 protected void initScreen() 58 { 59 setModuleType(LOOKUP); 60 setModuleName("PRODUCT_CATEGORY"); 61 } 62 72 public void doInsert(RunData data, Context context) 73 throws Exception 74 { 75 ProductCategory entry = new ProductCategory(); 76 data.getParameters().setProperties(entry); 77 entry.save(); 78 } 79 80 88 public void doUpdate(RunData data, Context context) 89 throws Exception 90 { 91 ProductCategory entry = new ProductCategory(); 92 data.getParameters().setProperties(entry); 93 entry.setModified(true); 94 entry.setNew(false); 95 entry.save(); 96 } 97 98 102 public void doDelete(RunData data, Context context) 103 throws Exception 104 { 105 Criteria criteria = new Criteria(); 106 criteria.add(ProductCategoryPeer.PRODUCT_CAT_ID, data.getParameters().getInt("productcatid")); 107 ProductCategoryPeer.doDelete(criteria); 108 } 109 110 114 public void doDeleteselected(RunData data, Context context) 115 throws Exception 116 { 117 int[] delIds= data.getParameters().getInts("rowid"); 118 Criteria criteria = new Criteria(); 119 criteria.addIn(ProductCategoryPeer.PRODUCT_CAT_ID, delIds); 120 ProductCategoryPeer.doDelete(criteria); 121 } 122 123 124 } 125 | Popular Tags |