001: package org.tigris.scarab.om;
002:
003: import java.math.BigDecimal;
004: import java.util.Date;
005: import java.util.List;
006:
007: import org.apache.torque.Torque;
008: import org.apache.torque.TorqueException;
009: import org.apache.torque.manager.AbstractBaseManager;
010: import org.apache.torque.manager.CacheListener;
011: import org.apache.torque.manager.MethodResultCache;
012: import org.apache.torque.om.ObjectKey;
013: import org.apache.torque.om.SimpleKey;
014: import org.apache.torque.om.Persistent;
015: import org.apache.torque.util.Criteria;
016:
017: /**
018: * This class manages Attribute objects.
019: * This class was autogenerated by Torque *
020: * You should not use this class directly. It should not even be
021: * extended all references should be to AttributeManager
022: */
023: public abstract class BaseAttributeManager extends AbstractBaseManager {
024: /** The name of the manager */
025: protected static final String MANAGED_CLASS = "org.tigris.scarab.om.Attribute";
026:
027: /** The name of our class to pass to Torque as the default manager. */
028: protected static final String DEFAULT_MANAGER_CLASS = "org.tigris.scarab.om.AttributeManager";
029:
030: /**
031: * Retrieves an implementation of the manager, based on the settings in
032: * the configuration.
033: *
034: * @return an implementation of AttributeManager.
035: */
036: public static AttributeManager getManager() {
037: return (AttributeManager) Torque.getManager(
038: AttributeManager.MANAGED_CLASS,
039: AttributeManager.DEFAULT_MANAGER_CLASS);
040: }
041:
042: /**
043: * Static accessor for the @see #getInstanceImpl().
044: *
045: * @return a <code>Attribute</code> value
046: * @exception TorqueException if an error occurs
047: */
048: public static Attribute getInstance() throws TorqueException {
049: return getManager().getInstanceImpl();
050: }
051:
052: /**
053: * Static accessor for the @see #getInstanceImpl(ObjectKey).
054: *
055: * @param id an <code>ObjectKey</code> value
056: * @return a <code>Attribute</code> value
057: * @exception TorqueException if an error occurs
058: */
059: public static Attribute getInstance(ObjectKey id)
060: throws TorqueException {
061: return getManager().getInstanceImpl(id);
062: }
063:
064: /**
065: * Static accessor for the @see #getCachedInstanceImpl(ObjectKey).
066: * Loads <code>Attribute</code> from cache, returns
067: * <code>null</code>, if instance is not in cache
068: *
069: * @param id an <code>ObjectKey</code> value
070: * @return a <code>Attribute</code> value
071: * @exception TorqueException if an error occurs
072: */
073: public static Attribute getCachedInstance(ObjectKey id)
074: throws TorqueException {
075: return getManager().getCachedInstanceImpl(id);
076: }
077:
078: /**
079: * Static accessor for the @see #getInstanceImpl(ObjectKey, boolean).
080: *
081: * @param id an <code>ObjectKey</code> value
082: * @param fromCache if true, look for cached Attributes before loading
083: * from storage.
084: * @return a <code>Attribute</code> value
085: * @exception TorqueException if an error occurs
086: */
087: public static Attribute getInstance(ObjectKey id, boolean fromCache)
088: throws TorqueException {
089: return getManager().getInstanceImpl(id, fromCache);
090: }
091:
092: /**
093: * Static accessor for the @see #getInstanceImpl(ObjectKey).
094: *
095: * @param id an <code>ObjectKey</code> value
096: * @return a <code>Attribute</code> value
097: * @exception TorqueException if an error occurs
098: */
099: public static Attribute getInstance(Integer id)
100: throws TorqueException {
101: return getManager().getInstanceImpl(SimpleKey.keyFor(id));
102: }
103:
104: /**
105: * Static accessor for the @see #getInstanceImpl(ObjectKey).
106: *
107: * @param id an <code>ObjectKey</code> value
108: * @param fromCache if true, look for cached Attributes before loading
109: * from storage.
110: * @return a <code>Attribute</code> value
111: * @exception TorqueException if an error occurs
112: */
113: public static Attribute getInstance(Integer id, boolean fromCache)
114: throws TorqueException {
115: return getManager().getInstanceImpl(SimpleKey.keyFor(id),
116: fromCache);
117: }
118:
119: /**
120: * Static accessor for the @see #getInstancesImpl(List).
121: *
122: * @param ids a <code>List</code> value
123: * @return a <code>List</code> value
124: * @exception TorqueException if an error occurs
125: */
126: public static List getInstances(List ids) throws TorqueException {
127: return getManager().getInstancesImpl(ids);
128: }
129:
130: /**
131: * Static accessor for the @see #getInstancesImpl(List, boolean).
132: *
133: * @param ids a <code>List</code> value
134: * @param fromCache if true, look for cached Attributes before loading
135: * from storage.
136: * @return a <code>List</code> value
137: * @exception TorqueException if an error occurs
138: */
139: public static List getInstances(List ids, boolean fromCache)
140: throws TorqueException {
141: return getManager().getInstancesImpl(ids, fromCache);
142: }
143:
144: public static void putInstance(Persistent om)
145: throws TorqueException {
146: getManager().putInstanceImpl(om);
147: }
148:
149: public static void clear() throws TorqueException {
150: getManager().clearImpl();
151: }
152:
153: public static boolean exists(Attribute obj) throws TorqueException {
154: return getManager().existsImpl(obj);
155: }
156:
157: public static MethodResultCache getMethodResult() {
158: return getManager().getMethodResultCache();
159: }
160:
161: public static void addCacheListener(CacheListener listener) {
162: getManager().addCacheListenerImpl(listener);
163: }
164:
165: /**
166: * Creates a new <code>BaseAttributeManager</code> instance.
167: *
168: * @exception TorqueException if an error occurs
169: */
170: public BaseAttributeManager() throws TorqueException {
171: setClassName("org.tigris.scarab.om.Attribute");
172: }
173:
174: /**
175: * Get a fresh instance of a AttributeManager
176: */
177: protected Attribute getInstanceImpl() throws TorqueException {
178: Attribute obj = null;
179: try {
180: obj = (Attribute) getOMInstance();
181: } catch (Exception e) {
182: throw new TorqueException(e);
183: }
184: return obj;
185: }
186:
187: /**
188: * Get a Attribute with the given id.
189: *
190: * @param id <code>ObjectKey</code> value
191: */
192: protected Attribute getInstanceImpl(ObjectKey id)
193: throws TorqueException {
194: return (Attribute) getOMInstance(id);
195: }
196:
197: /**
198: * Get a Attribute with the given id from the cache. Returns
199: * <code>null</code> if instance is not in cache
200: *
201: * @param id <code>ObjectKey</code> value
202: */
203: protected Attribute getCachedInstanceImpl(ObjectKey id)
204: throws TorqueException {
205: return (Attribute) cacheGet(id);
206: }
207:
208: /**
209: * Get a Attribute with the given id.
210: *
211: * @param id <code>ObjectKey</code> value
212: * @param fromCache if true, look for cached Attributes before loading
213: * from storage.
214: */
215: protected Attribute getInstanceImpl(ObjectKey id, boolean fromCache)
216: throws TorqueException {
217: return (Attribute) getOMInstance(id, fromCache);
218: }
219:
220: /**
221: * Gets a list of Attributes based on id's.
222: *
223: * @param ids a List of <code>ObjectKeys</code> value
224: * @return a <code>List</code> of Attributes
225: * @exception TorqueException if an error occurs
226: */
227: protected List getInstancesImpl(List ids) throws TorqueException {
228: return getOMs(ids);
229: }
230:
231: /**
232: * Gets a list of Attributes based on id's.
233: *
234: * @param ids a List of <code>ObjectKeys</code> value
235: * @param fromCache if true, look for cached Attributes before loading
236: * from storage.
237: * @return a <code>List</code> of Attributes
238: * @exception TorqueException if an error occurs
239: */
240: protected List getInstancesImpl(List ids, boolean fromCache)
241: throws TorqueException {
242: return getOMs(ids, fromCache);
243: }
244:
245: /**
246: * check for a duplicate project name
247: */
248: protected boolean existsImpl(Attribute om) throws TorqueException {
249: Criteria crit = AttributePeer.buildCriteria((Attribute) om);
250: return AttributePeer.doSelect(crit).size() > 0;
251: }
252:
253: protected Persistent retrieveStoredOM(ObjectKey id)
254: throws TorqueException {
255: return AttributePeer.retrieveByPK(id);
256: }
257:
258: /**
259: * Gets a list of ModuleEntities based on id's.
260: *
261: * @param ids a <code>NumberKey[]</code> value
262: * @return a <code>List</code> value
263: * @exception TorqueException if an error occurs
264: */
265: protected List retrieveStoredOMs(List ids) throws TorqueException {
266: return AttributePeer.retrieveByPKs(ids);
267: }
268: }
|