BookmarkDAO.java
Upload User: gdxydsw
Upload Date: 2019-01-29
Package Size: 16721k
Code Size: 4k
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.  * 1) Redistributions of source code must retain the above 
  9.  * copyright notice, this list of conditions and the 
  10.  * following  disclaimer.
  11.  * 2)  Redistributions in binary form must reproduce the 
  12.  * above copyright notice, this list of conditions and 
  13.  * the following disclaimer in the documentation and/or 
  14.  * other materials provided with the distribution.
  15.  * 3) Neither the name of "Rafael Steil" nor 
  16.  * the names of its contributors may be used to endorse 
  17.  * or promote products derived from this software without 
  18.  * specific prior written permission.
  19.  * 
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 
  21.  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
  22.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
  23.  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  24.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  25.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
  26.  * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
  27.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
  28.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
  29.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
  30.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
  31.  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  32.  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
  33.  * IN CONTRACT, STRICT LIABILITY, OR TORT 
  34.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
  35.  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  36.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  37.  *
  38.  * Created on Jan 16, 2005 12:30:52 PM
  39.  * The JForum Project
  40.  * http://www.jforum.net
  41.  */
  42. package net.jforum.dao;
  43. import java.util.List;
  44. import net.jforum.entities.Bookmark;
  45. /**
  46.  * @author Rafael Steil
  47.  * @version $Id: BookmarkDAO.java,v 1.6 2006/08/23 02:13:35 rafaelsteil Exp $
  48.  */
  49. public interface BookmarkDAO
  50. {
  51. /**
  52.  * Adds a new bookmark.
  53.  * 
  54.  * @param b The bookmark to add
  55.  */
  56. public void add(Bookmark b);
  57. /**
  58.  * Updates a bookmark.
  59.  * Only the fields <i>publicVisible</i>, <i>title</i>
  60.  * and <i>description</i> are changed.
  61.  * All other fields remain with the same value.
  62.  * 
  63.  * @param b The bookmark to update
  64.  */
  65. public void update(Bookmark b);
  66. /**
  67.  * Removes a bookmark.
  68.  * 
  69.  * @param bookmarkId The bookmark's id to remove
  70.  */
  71. public void remove(int bookmarkId);
  72. /**
  73.  * Gets all bookmarks of a given type.
  74.  * 
  75.  * @param userId The bookmark's owner
  76.  * @param relationType Any valid type declared in
  77.  * <code>net.jforum.entities.BookmarkType</code>
  78.  * @return A list with all results found. Each entry is
  79.  * a {@link net.jforum.entities.Bookmark} instance.
  80.  */
  81. public List selectByUser(int userId, int relationType);
  82. /**
  83.  * Gets all bookmarks from some user.
  84.  * 
  85.  * @param userId The bookmark's owner
  86.  * <code>net.jforum.entities.BookmarkType</code>
  87.  * @return A list with all results found. Each entry is
  88.  * a {@link net.jforum.entities.Bookmark} instance.
  89.  */
  90. public List selectByUser(int userId);
  91. /**
  92.  * Gets a bookmark.
  93.  * 
  94.  * @param bookmarkId The bookmark id
  95.  * @return A Bookmark instance or null if no entry found
  96.  */
  97. public Bookmark selectById(int bookmarkId);
  98. /**
  99.  * Gets a bookmark for edition.
  100.  * 
  101.  * @param relationId The relation's id
  102.  * @param relationType The relation type.
  103.  * @param userId The bookmark's owner
  104.  * @return A bookmark instance of <code>null</code> if 
  105.  * the record cannot be found
  106.  */
  107. public Bookmark selectForUpdate(int relationId, int relationType, int userId);
  108. }