1 2 3 package org.apache.jetspeed.om.apps.coffees; 4 5 import java.math.BigDecimal ; 6 import java.util.Date ; 7 import java.util.List ; 8 9 import org.apache.torque.Torque; 10 import org.apache.torque.TorqueException; 11 import org.apache.torque.manager.AbstractBaseManager; 12 import org.apache.torque.manager.CacheListener; 13 import org.apache.torque.manager.MethodResultCache; 14 import org.apache.torque.om.ObjectKey; 15 import org.apache.torque.om.SimpleKey; 16 import org.apache.torque.om.Persistent; 17 import org.apache.torque.util.Criteria; 18 19 29 public abstract class BaseCoffeesManager 30 extends AbstractBaseManager 31 { 32 33 protected static String MANAGED_CLASS = "org.apache.jetspeed.om.apps.coffees.Coffees"; 34 35 36 protected static String DEFAULT_MANAGER_CLASS 37 = "org.apache.jetspeed.om.apps.coffees.CoffeesManager"; 38 39 45 public static CoffeesManager getManager() 46 { 47 return (CoffeesManager) 48 Torque.getManager(CoffeesManager.MANAGED_CLASS, 49 CoffeesManager.DEFAULT_MANAGER_CLASS); 50 } 51 52 58 public static Coffees getInstance() 59 throws TorqueException 60 { 61 return getManager().getInstanceImpl(); 62 } 63 64 71 public static Coffees getInstance(ObjectKey id) 72 throws TorqueException 73 { 74 return getManager().getInstanceImpl(id); 75 } 76 77 84 public static Coffees getInstance(ObjectKey id, boolean fromCache) 85 throws TorqueException 86 { 87 return getManager().getInstanceImpl(id, fromCache); 88 } 89 90 97 public static Coffees getInstance(int id) 98 throws TorqueException 99 { 100 return getManager().getInstanceImpl(SimpleKey.keyFor(id)); 101 } 102 103 110 public static Coffees getInstance(int id, boolean fromCache) 111 throws TorqueException 112 { 113 return getManager().getInstanceImpl(SimpleKey.keyFor(id), fromCache); 114 } 115 116 123 public static List getInstances(List ids) 124 throws TorqueException 125 { 126 return getManager().getInstancesImpl(ids); 127 } 128 129 136 public static List getInstances(List ids, boolean fromCache) 137 throws TorqueException 138 { 139 return getManager().getInstancesImpl(ids, fromCache); 140 } 141 142 public static void putInstance(Persistent om) 143 throws TorqueException 144 { 145 getManager().putInstanceImpl(om); 146 } 147 148 public static void clear() 149 throws TorqueException 150 { 151 getManager().clearImpl(); 152 } 153 154 public static boolean exists(Coffees obj) 155 throws TorqueException 156 { 157 return getManager().existsImpl(obj); 158 } 159 160 public static MethodResultCache getMethodResult() 161 { 162 return getManager().getMethodResultCache(); 163 } 164 165 public static void addCacheListener(CacheListener listener) 166 { 167 getManager().addCacheListenerImpl(listener); 168 } 169 170 175 public BaseCoffeesManager() 176 throws TorqueException 177 { 178 setClassName("org.apache.jetspeed.om.apps.coffees.Coffees"); 179 } 180 181 184 protected Coffees getInstanceImpl() 185 throws TorqueException 186 { 187 Coffees obj = null; 188 try 189 { 190 obj = (Coffees) getOMInstance(); 191 } 192 catch (Exception e) 193 { 194 throw new TorqueException(e); 195 } 196 return obj; 197 } 198 199 200 205 protected Coffees getInstanceImpl(ObjectKey id) 206 throws TorqueException 207 { 208 return (Coffees) getOMInstance(id); 209 } 210 211 218 protected Coffees getInstanceImpl(ObjectKey id, boolean fromCache) 219 throws TorqueException 220 { 221 return (Coffees) getOMInstance(id, fromCache); 222 } 223 224 231 protected List getInstancesImpl(List ids) 232 throws TorqueException 233 { 234 return getOMs(ids); 235 } 236 237 246 protected List getInstancesImpl(List ids, boolean fromCache) 247 throws TorqueException 248 { 249 return getOMs(ids, fromCache); 250 } 251 252 255 protected boolean existsImpl(Coffees om) 256 throws TorqueException 257 { 258 Criteria crit = CoffeesPeer 259 .buildCriteria((Coffees)om); 260 return CoffeesPeer.doSelect(crit).size() > 0; 261 } 262 263 264 protected Persistent retrieveStoredOM(ObjectKey id) 265 throws TorqueException 266 { 267 return CoffeesPeer.retrieveByPK(id); 268 } 269 270 277 protected List retrieveStoredOMs(List ids) 278 throws TorqueException 279 { 280 return CoffeesPeer.retrieveByPKs(ids); 281 } 282 } 283 | Popular Tags |