KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > om > BaseAttachmentManager


1
2
3 package org.tigris.scarab.om;
4
5 import java.math.BigDecimal JavaDoc;
6 import java.util.Date JavaDoc;
7 import java.util.List JavaDoc;
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 /**
20  * This class manages Attachment objects.
21  * This class was autogenerated by Torque *
22  * You should not use this class directly. It should not even be
23  * extended all references should be to AttachmentManager
24  */

25 public abstract class BaseAttachmentManager
26     extends AbstractBaseManager
27 {
28     /** The name of the manager */
29     protected static String JavaDoc MANAGED_CLASS = "org.tigris.scarab.om.Attachment";
30
31     /** The name of our class to pass to Torque as the default manager. */
32     protected static String JavaDoc DEFAULT_MANAGER_CLASS
33         = "org.tigris.scarab.om.AttachmentManager";
34
35     /**
36      * Retrieves an implementation of the manager, based on the settings in
37      * the configuration.
38      *
39      * @return an implementation of AttachmentManager.
40      */

41     public static AttachmentManager getManager()
42     {
43         return (AttachmentManager)
44             Torque.getManager(AttachmentManager.MANAGED_CLASS,
45                 AttachmentManager.DEFAULT_MANAGER_CLASS);
46     }
47
48     /**
49      * Static accessor for the @see #getInstanceImpl().
50      *
51      * @return a <code>Attachment</code> value
52      * @exception TorqueException if an error occurs
53      */

54     public static Attachment getInstance()
55         throws TorqueException
56     {
57         return getManager().getInstanceImpl();
58     }
59
60     /**
61      * Static accessor for the @see #getInstanceImpl(ObjectKey).
62      *
63      * @param id an <code>ObjectKey</code> value
64      * @return a <code>Attachment</code> value
65      * @exception TorqueException if an error occurs
66      */

67     public static Attachment getInstance(ObjectKey id)
68         throws TorqueException
69     {
70         return getManager().getInstanceImpl(id);
71     }
72
73     /**
74      * Static accessor for the @see #getInstanceImpl(ObjectKey, boolean).
75      *
76      * @param id an <code>ObjectKey</code> value
77      * @param fromCache if true, look for cached Attachments before loading
78      * from storage.
79      * @return a <code>Attachment</code> value
80      * @exception TorqueException if an error occurs
81      */

82     public static Attachment getInstance(ObjectKey id, boolean fromCache)
83         throws TorqueException
84     {
85         return getManager().getInstanceImpl(id, fromCache);
86     }
87
88     /**
89      * Static accessor for the @see #getInstanceImpl(ObjectKey).
90      *
91      * @param id an <code>ObjectKey</code> value
92      * @return a <code>Attachment</code> value
93      * @exception TorqueException if an error occurs
94      */

95     public static Attachment getInstance(Long JavaDoc id)
96         throws TorqueException
97     {
98         return getManager().getInstanceImpl(SimpleKey.keyFor(id));
99     }
100
101     /**
102      * Static accessor for the @see #getInstanceImpl(ObjectKey).
103      *
104      * @param id an <code>ObjectKey</code> value
105      * @param fromCache if true, look for cached Attachments before loading
106      * from storage.
107      * @return a <code>Attachment</code> value
108      * @exception TorqueException if an error occurs
109      */

110     public static Attachment getInstance(Long JavaDoc id, boolean fromCache)
111         throws TorqueException
112     {
113         return getManager().getInstanceImpl(SimpleKey.keyFor(id), fromCache);
114     }
115
116     /**
117      * Static accessor for the @see #getInstancesImpl(List).
118      *
119      * @param ids a <code>List</code> value
120      * @return a <code>List</code> value
121      * @exception TorqueException if an error occurs
122      */

123     public static List JavaDoc getInstances(List JavaDoc ids)
124         throws TorqueException
125     {
126         return getManager().getInstancesImpl(ids);
127     }
128
129     /**
130      * Static accessor for the @see #getInstancesImpl(List, boolean).
131      *
132      * @param ids a <code>List</code> value
133      * @param fromCache if true, look for cached Attachments before loading
134      * from storage.
135      * @return a <code>List</code> value
136      * @exception TorqueException if an error occurs
137      */

138     public static List JavaDoc getInstances(List JavaDoc ids, boolean fromCache)
139         throws TorqueException
140     {
141         return getManager().getInstancesImpl(ids, fromCache);
142     }
143
144     public static void putInstance(Persistent om)
145         throws TorqueException
146     {
147         getManager().putInstanceImpl(om);
148     }
149
150     public static void clear()
151         throws TorqueException
152     {
153         getManager().clearImpl();
154     }
155
156     public static boolean exists(Attachment obj)
157         throws TorqueException
158     {
159         return getManager().existsImpl(obj);
160     }
161
162     public static MethodResultCache getMethodResult()
163     {
164         return getManager().getMethodResultCache();
165     }
166
167     public static void addCacheListener(CacheListener listener)
168     {
169         getManager().addCacheListenerImpl(listener);
170     }
171
172     /**
173      * Creates a new <code>BaseAttachmentManager</code> instance.
174      *
175      * @exception TorqueException if an error occurs
176      */

177     public BaseAttachmentManager()
178         throws TorqueException
179     {
180         setClassName("org.tigris.scarab.om.Attachment");
181     }
182
183     /**
184      * Get a fresh instance of a AttachmentManager
185      */

186     protected Attachment getInstanceImpl()
187         throws TorqueException
188     {
189         Attachment obj = null;
190         try
191         {
192             obj = (Attachment) getOMInstance();
193         }
194         catch (Exception JavaDoc e)
195         {
196             throw new TorqueException(e);
197         }
198         return obj;
199     }
200
201
202     /**
203      * Get a Attachment with the given id.
204      *
205      * @param id <code>ObjectKey</code> value
206      */

207     protected Attachment getInstanceImpl(ObjectKey id)
208         throws TorqueException
209     {
210         return (Attachment) getOMInstance(id);
211     }
212
213     /**
214      * Get a Attachment with the given id.
215      *
216      * @param id <code>ObjectKey</code> value
217      * @param fromCache if true, look for cached Attachments before loading
218      * from storage.
219      */

220     protected Attachment getInstanceImpl(ObjectKey id, boolean fromCache)
221         throws TorqueException
222     {
223         return (Attachment) getOMInstance(id, fromCache);
224     }
225
226     /**
227      * Gets a list of Attachments based on id's.
228      *
229      * @param ids a List of <code>ObjectKeys</code> value
230      * @return a <code>List</code> of Attachments
231      * @exception TorqueException if an error occurs
232      */

233     protected List JavaDoc getInstancesImpl(List JavaDoc ids)
234         throws TorqueException
235     {
236         return getOMs(ids);
237     }
238
239     /**
240      * Gets a list of Attachments based on id's.
241      *
242      * @param ids a List of <code>ObjectKeys</code> value
243      * @param fromCache if true, look for cached Attachments before loading
244      * from storage.
245      * @return a <code>List</code> of Attachments
246      * @exception TorqueException if an error occurs
247      */

248     protected List JavaDoc getInstancesImpl(List JavaDoc ids, boolean fromCache)
249         throws TorqueException
250     {
251         return getOMs(ids, fromCache);
252     }
253
254     /**
255      * check for a duplicate project name
256      */

257     protected boolean existsImpl(Attachment om)
258         throws TorqueException
259     {
260         Criteria crit = AttachmentPeer
261             .buildCriteria((Attachment)om);
262         return AttachmentPeer.doSelect(crit).size() > 0;
263     }
264
265
266     protected Persistent retrieveStoredOM(ObjectKey id)
267         throws TorqueException
268     {
269         return AttachmentPeer.retrieveByPK(id);
270     }
271
272     /**
273      * Gets a list of ModuleEntities based on id's.
274      *
275      * @param ids a <code>NumberKey[]</code> value
276      * @return a <code>List</code> value
277      * @exception TorqueException if an error occurs
278      */

279     protected List JavaDoc retrieveStoredOMs(List JavaDoc ids)
280         throws TorqueException
281     {
282         return AttachmentPeer.retrieveByPKs(ids);
283     }
284 }
285
Popular Tags