001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * Created on Jan 17, 2005 4:31:45 PM
040: * The JForum Project
041: * http://www.jforum.net
042: */
043: package net.jforum.dao;
044:
045: import java.util.List;
046: import java.util.Map;
047:
048: import net.jforum.entities.Attachment;
049: import net.jforum.entities.AttachmentExtension;
050: import net.jforum.entities.AttachmentExtensionGroup;
051: import net.jforum.entities.QuotaLimit;
052:
053: /**
054: * @author Rafael Steil
055: * @version $Id: AttachmentDAO.java,v 1.7 2006/08/23 02:13:34 rafaelsteil Exp $
056: */
057: public interface AttachmentDAO {
058: /**
059: * Adds a new attachment.
060: *
061: * @param a The attacment to add
062: */
063: public void addAttachment(Attachment a);
064:
065: /**
066: * Updates an attachment.
067: * Only the file comment is updated.
068: *
069: * @param a The attachment to update
070: */
071: public void updateAttachment(Attachment a);
072:
073: /**
074: * Rovemos an attachment.
075: *
076: * @param id The attachment's id to remove
077: * @param postId the post id
078: */
079: public void removeAttachment(int id, int postId);
080:
081: /**
082: * Gets the attachments of some message.
083: *
084: * @param postId The post id associated with the attachments.
085: * @return A list where each entry is a net.jforum.entities.Attachment
086: * instance.
087: */
088: public List selectAttachments(int postId);
089:
090: /**
091: * Gets an attachment by its id
092: *
093: * @param attachId The attachment id
094: * @return The attachment, or <code>null</code> if no record was found
095: */
096: public Attachment selectAttachmentById(int attachId);
097:
098: /**
099: * Inserts a new quota limit.
100: *
101: * @param limit The data to insert
102: */
103: public void addQuotaLimit(QuotaLimit limit);
104:
105: /**
106: * Updates a quota limit.
107: *
108: * @param limit The data to update
109: */
110: public void updateQuotaLimit(QuotaLimit limit);
111:
112: /**
113: * Deletes a quota limit
114: *
115: * @param id The id of the quota to remove
116: */
117: public void removeQuotaLimit(int id);
118:
119: /**
120: * Removes a set of quota limit.
121: *
122: * @param ids The ids to remove.
123: */
124: public void removeQuotaLimit(String[] ids);
125:
126: /**
127: * Associates a quota limmit to some group.
128: *
129: * @param groupId The group id
130: * @param quotaId The quota id
131: */
132: public void setGroupQuota(int groupId, int quotaId);
133:
134: /**
135: * Removes all quotas limits from all groups.
136: *
137: */
138: public void cleanGroupQuota();
139:
140: /**
141: * Gets all registered quota limits
142: *
143: * @return A list instance where each entry is a
144: * {@link net.jforum.entities.QuotaLimit} instance.
145: */
146: public List selectQuotaLimit();
147:
148: /**
149: * Gets the quota associated to some group.
150: *
151: * @param groupId The group id
152: * @return A <code>QuotaLimit</code> instance, or <code>null</code> if
153: * no records were found.
154: */
155: public QuotaLimit selectQuotaLimitByGroup(int groupId);
156:
157: /**
158: * Gets the quota limits of registered groups.
159: *
160: * @return A map instance where each key is the group id
161: * and the value is the quota limit id.
162: */
163: public Map selectGroupsQuotaLimits();
164:
165: /**
166: * Adds a new extension group.
167: *
168: * @param g The data to insert
169: */
170: public void addExtensionGroup(AttachmentExtensionGroup g);
171:
172: /**
173: * Updates some extensin group.
174: *
175: * @param g The data to update
176: */
177: public void updateExtensionGroup(AttachmentExtensionGroup g);
178:
179: /**
180: * Removes a set of extension groups.
181: *
182: * @param ids The ids to remove.
183: */
184: public void removeExtensionGroups(String[] ids);
185:
186: /**
187: * Gets all extension groups.
188: *
189: * @return A list instance where each entry is an
190: * {@link net.jforum.entities.AttachmentExtensionGroup} instance.
191: */
192: public List selectExtensionGroups();
193:
194: /**
195: * Gets all extensions and its security options,
196: * as well from the groups.
197: *
198: * @return A map instance where the key is the extension name
199: * and the value is a Boolean, indicating if the extension can
200: * be used in the uploaded files. If there is no entry for
201: * a given extension, then it means that it is allowed.
202: */
203: public Map extensionsForSecurity();
204:
205: /**
206: * Adds a new extension
207: *
208: * @param e The extension to add
209: */
210: public void addExtension(AttachmentExtension e);
211:
212: /**
213: * Updates an extension
214: *
215: * @param e The extension to update
216: */
217: public void updateExtension(AttachmentExtension e);
218:
219: /**
220: * Removes a set of extensions
221: *
222: * @param ids The ids to remove
223: */
224: public void removeExtensions(String[] ids);
225:
226: /**
227: * Gets all registered extensions
228: *
229: * @return A list instance, where each entry is an
230: * {@link net.jforum.entities.AttachmentExtension} instance
231: */
232: public List selectExtensions();
233:
234: /**
235: * Gets an extension information by the extension's name
236: * @param extension
237: * @return AttachmentExtension
238: */
239: public AttachmentExtension selectExtension(String extension);
240:
241: /**
242: * Gets the download mode by the extension group id
243: * @param extensionGroupId extension group id
244: * @return true = physical download mode; false = inline download mode
245: */
246: public boolean isPhysicalDownloadMode(int extensionGroupId);
247: }
|