AttachmentDAO.java
Upload User: gdxydsw
Upload Date: 2019-01-29
Package Size: 16721k
Code Size: 6k
Category:

Java Develop

Development Platform:

Java

  1. /*
  2.  * Copyright (c) JForum Team
  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. import java.util.List;
  45. import java.util.Map;
  46. import net.jforum.entities.Attachment;
  47. import net.jforum.entities.AttachmentExtension;
  48. import net.jforum.entities.AttachmentExtensionGroup;
  49. import net.jforum.entities.QuotaLimit;
  50. /**
  51.  * @author Rafael Steil
  52.  * @version $Id: AttachmentDAO.java,v 1.7 2006/08/23 02:13:34 rafaelsteil Exp $
  53.  */
  54. public interface AttachmentDAO
  55. {
  56. /**
  57.  * Adds a new attachment.
  58.  * 
  59.  * @param a The attacment to add
  60.  */
  61. public void addAttachment(Attachment a);
  62. /**
  63.  * Updates an attachment.
  64.  * Only the file comment is updated.
  65.  * 
  66.  * @param a The attachment to update
  67.  */
  68. public void updateAttachment(Attachment a);
  69. /**
  70.  * Rovemos an attachment.
  71.  * 
  72.  * @param id The attachment's id to remove
  73.  * @param postId the post id
  74.  */
  75. public void removeAttachment(int id, int postId);
  76. /**
  77.  * Gets the attachments of some message.
  78.  * 
  79.  * @param postId The post id associated with the attachments.
  80.  * @return A list where each entry is a net.jforum.entities.Attachment 
  81.  * instance.
  82.  */
  83. public List selectAttachments(int postId);
  84. /**
  85.  * Gets an attachment by its id
  86.  * 
  87.  * @param attachId The attachment id
  88.  * @return The attachment, or <code>null</code> if no record was found
  89.  */
  90. public Attachment selectAttachmentById(int attachId);
  91. /**
  92.  * Inserts a new quota limit.
  93.  * 
  94.  * @param limit The data to insert
  95.  */
  96. public void addQuotaLimit(QuotaLimit limit);
  97. /**
  98.  * Updates a quota limit.
  99.  * 
  100.  * @param limit The data to update
  101.  */
  102. public void updateQuotaLimit(QuotaLimit limit);
  103. /**
  104.  * Deletes a quota limit
  105.  * 
  106.  * @param id The id of the quota to remove
  107.  */
  108. public void removeQuotaLimit(int id);
  109. /**
  110.  * Removes a set of quota limit.
  111.  * 
  112.  * @param ids The ids to remove.
  113.  */
  114. public void removeQuotaLimit(String[] ids);
  115. /**
  116.  * Associates a quota limmit to some group.
  117.  * 
  118.  * @param groupId The group id
  119.  * @param quotaId The quota id
  120.  */
  121. public void setGroupQuota(int groupId, int quotaId);
  122. /**
  123.  * Removes all quotas limits from all groups.
  124.  *  
  125.  */
  126. public void cleanGroupQuota();
  127. /**
  128.  * Gets all registered quota limits
  129.  * 
  130.  * @return A list instance where each entry is a
  131.  * {@link net.jforum.entities.QuotaLimit} instance.
  132.  */
  133. public List selectQuotaLimit();
  134. /**
  135.  * Gets the quota associated to some group.
  136.  * 
  137.  * @param groupId The group id
  138.  * @return A <code>QuotaLimit</code> instance, or <code>null</code> if
  139.  * no records were found. 
  140.  */
  141. public QuotaLimit selectQuotaLimitByGroup(int groupId) ;
  142. /**
  143.  * Gets the quota limits of registered groups.
  144.  * 
  145.  * @return A map instance where each key is the group id
  146.  * and the value is the quota limit id.
  147.  */
  148. public Map selectGroupsQuotaLimits();
  149. /**
  150.  * Adds a new extension group.
  151.  * 
  152.  * @param g The data to insert
  153.  */
  154. public void addExtensionGroup(AttachmentExtensionGroup g);
  155. /**
  156.  * Updates some extensin group.
  157.  * 
  158.  * @param g The data to update
  159.  */
  160. public void updateExtensionGroup(AttachmentExtensionGroup g);
  161. /**
  162.  * Removes a set of extension groups.
  163.  * 
  164.  * @param ids The ids to remove.
  165.  */
  166. public void removeExtensionGroups(String[] ids);
  167. /**
  168.  * Gets all extension groups.
  169.  * 
  170.  * @return A list instance where each entry is an 
  171.  * {@link net.jforum.entities.AttachmentExtensionGroup} instance.
  172.  */
  173. public List selectExtensionGroups();
  174. /**
  175.  * Gets all extensions and its security options, 
  176.  * as well from the groups. 
  177.  * 
  178.  * @return A map instance where the key is the extension name
  179.  * and the value is a Boolean, indicating if the extension can
  180.  * be used in the uploaded files. If there is no entry for
  181.  * a given extension, then it means that it is allowed. 
  182.  */
  183. public Map extensionsForSecurity();
  184. /**
  185.  * Adds a new extension
  186.  * 
  187.  * @param e The extension to add
  188.  */
  189. public void addExtension(AttachmentExtension e);
  190. /**
  191.  * Updates an extension
  192.  * 
  193.  * @param e The extension to update
  194.  */
  195. public void updateExtension(AttachmentExtension e);
  196. /**
  197.  * Removes a set of extensions
  198.  * 
  199.  * @param ids The ids to remove
  200.  */
  201. public void removeExtensions(String[] ids);
  202. /**
  203.  * Gets all registered extensions
  204.  * 
  205.  * @return A list instance, where each entry is an
  206.  * {@link net.jforum.entities.AttachmentExtension} instance
  207.  */
  208. public List selectExtensions();
  209. /**
  210.  * Gets an extension information by the extension's name
  211.  * @param extension
  212.  * @return AttachmentExtension
  213.  */
  214. public AttachmentExtension selectExtension(String extension);
  215. /**
  216.  * Gets the download mode by the extension group id
  217.  * @param extensionGroupId extension group id
  218.  * @return true = physical download mode; false = inline download mode
  219.  */
  220. public boolean isPhysicalDownloadMode(int extensionGroupId);
  221. }