KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > jforum > dao > AttachmentDAO


1 /*
2  * Copyright (c) 2003, 2004 Rafael Steil
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided
7  * that the following conditions are met:
8  *
9  * 1) Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  * 2) Redistributions in binary form must reproduce the
13  * above copyright notice, this list of conditions and
14  * the following disclaimer in the documentation and/or
15  * other materials provided with the distribution.
16  * 3) Neither the name of "Rafael Steil" nor
17  * the names of its contributors may be used to endorse
18  * or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
22  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27  * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
32  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
34  * IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
38  *
39  * Created on Jan 17, 2005 4:31:45 PM
40  * The JForum Project
41  * http://www.jforum.net
42  */

43 package net.jforum.dao;
44
45 import java.util.List JavaDoc;
46 import java.util.Map JavaDoc;
47
48 import net.jforum.entities.Attachment;
49 import net.jforum.entities.AttachmentExtension;
50 import net.jforum.entities.AttachmentExtensionGroup;
51 import net.jforum.entities.QuotaLimit;
52
53 /**
54  * @author Rafael Steil
55  * @version $Id: AttachmentDAO.java,v 1.5 2005/07/26 03:04:30 rafaelsteil Exp $
56  */

57 public interface AttachmentDAO
58 {
59     /**
60      * Adds a new attachment.
61      *
62      * @param a The attacment to add
63      * @throws Exception
64      */

65     public void addAttachment(Attachment a) throws Exception JavaDoc;
66     
67     /**
68      * Updates an attachment.
69      * Only the file comment is updated.
70      *
71      * @param a The attachment to update
72      * @throws Exception
73      */

74     public void updateAttachment(Attachment a) throws Exception JavaDoc;
75     
76     /**
77      * Rovemos an attachment.
78      *
79      * @param id The attachment's id to remove
80      * @param postId the post id
81      * @throws Exception
82      */

83     public void removeAttachment(int id, int postId) throws Exception JavaDoc;
84     
85     /**
86      * Gets the attachments of some message.
87      *
88      * @param postId The post id associated with the attachments.
89      * @return A list where each entry is a net.jforum.entities.Attachment
90      * instance.
91      * @throws Exception
92      */

93     public List JavaDoc selectAttachments(int postId) throws Exception JavaDoc;
94     
95     /**
96      * Gets an attachment by its id
97      *
98      * @param attachId The attachment id
99      * @return The attachment, or <code>null</code> if no record was found
100      * @throws Exception
101      */

102     public Attachment selectAttachmentById(int attachId) throws Exception JavaDoc;
103     
104     /**
105      * Inserts a new quota limit.
106      *
107      * @param limit The data to insert
108      * @throws Exception
109      */

110     public void addQuotaLimit(QuotaLimit limit) throws Exception JavaDoc;
111     
112     /**
113      * Updates a quota limit.
114      *
115      * @param limit The data to update
116      * @throws Exception
117      */

118     public void updateQuotaLimit(QuotaLimit limit) throws Exception JavaDoc;
119     
120     /**
121      * Deletes a quota limit
122      *
123      * @param id The id of the quota to remove
124      * @throws Exception
125      */

126     public void removeQuotaLimit(int id) throws Exception JavaDoc;
127     
128     /**
129      * Removes a set of quota limit.
130      *
131      * @param ids The ids to remove.
132      * @throws Exception
133      */

134     public void removeQuotaLimit(String JavaDoc[] ids) throws Exception JavaDoc;
135     
136     /**
137      * Associates a quota limmit to some group.
138      *
139      * @param groupId The group id
140      * @param quotaId The quota id
141      * @throws Exception
142      */

143     public void setGroupQuota(int groupId, int quotaId) throws Exception JavaDoc;
144     
145     /**
146      * Removes all quotas limits from all groups.
147      *
148      * @throws Exception
149      */

150     public void cleanGroupQuota() throws Exception JavaDoc;
151     
152     /**
153      * Gets all registered quota limits
154      *
155      * @return A list instance where each entry is a
156      * {@link net.jforum.entities.QuotaLimit} instance.
157      * @throws Exception
158      */

159     public List JavaDoc selectQuotaLimit() throws Exception JavaDoc;
160     
161     /**
162      * Gets the quota associated to some group.
163      *
164      * @param groupId The group id
165      * @return A <code>QuotaLimit</code> instance, or <code>null</code> if
166      * no records were found.
167      * @throws Exception
168      */

169     public QuotaLimit selectQuotaLimitByGroup(int groupId) throws Exception JavaDoc;
170     
171     /**
172      * Gets the quota limits of registered groups.
173      *
174      * @return A map instance where each key is the group id
175      * and the value is the quota limit id.
176      */

177     public Map JavaDoc selectGroupsQuotaLimits() throws Exception JavaDoc;
178     
179     /**
180      * Adds a new extension group.
181      *
182      * @param g The data to insert
183      * @throws Exception
184      */

185     public void addExtensionGroup(AttachmentExtensionGroup g) throws Exception JavaDoc;
186     
187     /**
188      * Updates some extensin group.
189      *
190      * @param g The data to update
191      * @throws Exception
192      */

193     public void updateExtensionGroup(AttachmentExtensionGroup g) throws Exception JavaDoc;
194     
195     /**
196      * Removes a set of extension groups.
197      *
198      * @param ids The ids to remove.
199      * @throws Exception
200      */

201     public void removeExtensionGroups(String JavaDoc[] ids) throws Exception JavaDoc;
202     
203     /**
204      * Gets all extension groups.
205      *
206      * @return A list instance where each entry is an
207      * {@link net.jforum.entities.AttachmentExtensionGroup} instance.
208      * @throws Exception
209      */

210     public List JavaDoc selectExtensionGroups() throws Exception JavaDoc;
211     
212     /**
213      * Gets all extensions and its security options,
214      * as well from the groups.
215      *
216      * @return A map instance where the key is the extension name
217      * and the value is a Boolean, indicating if the extension can
218      * be used in the uploaded files. If there is no entry for
219      * a given extension, then it means that it is allowed.
220      * @throws Exception
221      */

222     public Map JavaDoc extensionsForSecurity() throws Exception JavaDoc;
223     
224     /**
225      * Adds a new extension
226      *
227      * @param e The extension to add
228      * @throws Exception
229      */

230     public void addExtension(AttachmentExtension e) throws Exception JavaDoc;
231     
232     /**
233      * Updates an extension
234      *
235      * @param e The extension to update
236      * @throws Exception
237      */

238     public void updateExtension(AttachmentExtension e) throws Exception JavaDoc;
239     
240     /**
241      * Removes a set of extensions
242      *
243      * @param ids The ids to remove
244      * @throws Exception
245      */

246     public void removeExtensions(String JavaDoc[] ids) throws Exception JavaDoc;
247     
248     /**
249      * Gets all registered extensions
250      *
251      * @return A list instance, where each entry is an
252      * {@link net.jforum.entities.AttachmentExtension} instance
253      * @throws Exception
254      */

255     public List JavaDoc selectExtensions() throws Exception JavaDoc;
256     
257     /**
258      * Gets an extension information by the extension's name
259      * @param extension
260      * @return
261      * @throws Exception
262      */

263     public AttachmentExtension selectExtension(String JavaDoc extension) throws Exception JavaDoc;
264
265     /**
266      * Gets the download mode by the extension group id
267      * @param extensionGroupId extension group id
268      * @return true = physical download mode; false = inline download mode
269      * @throws Exception
270      */

271     public boolean isPhysicalDownloadMode(int extensionGroupId) throws Exception JavaDoc;
272 }
273
Popular Tags