KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright (c) 2003, 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  * 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
44 import java.util.List JavaDoc;
45
46 import net.jforum.entities.Bookmark;
47
48 /**
49  * @author Rafael Steil
50  * @version $Id: BookmarkDAO.java,v 1.4 2005/07/26 03:04:30 rafaelsteil Exp $
51  */

52 public interface BookmarkDAO
53 {
54     /**
55      * Adds a new bookmark.
56      *
57      * @param b The bookmark to add
58      * @throws Exception
59      */

60     public void add(Bookmark b) throws Exception JavaDoc;
61     
62     /**
63      * Updates a bookmark.
64      * Only the fields <i>publicVisible</i>, <i>title</i>
65      * and <i>description</i> are changed.
66      * All other fields remain with the same value.
67      *
68      * @param b The bookmark to update
69      * @throws Exception
70      */

71     public void update(Bookmark b) throws Exception JavaDoc;
72     
73     /**
74      * Removes a bookmark.
75      *
76      * @param bookmarkId The bookmark's id to remove
77      * @throws Exception
78      */

79     public void remove(int bookmarkId) throws Exception JavaDoc;
80     
81     /**
82      * Gets all bookmarks of a given type.
83      *
84      * @param userId The bookmark's owner
85      * @param relationType Any valid type declared in
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      * @throws Exception
90      */

91     public List JavaDoc selectByUser(int userId, int relationType) throws Exception JavaDoc;
92     
93     /**
94      * Gets all bookmarks from some user.
95      *
96      * @param userId The bookmark's owner
97      * <code>net.jforum.entities.BookmarkType</code>
98      * @return A list with all results found. Each entry is
99      * a {@link net.jforum.entities.Bookmark} instance.
100      * @throws Exception
101      */

102     public List JavaDoc selectByUser(int userId) throws Exception JavaDoc;
103     
104     /**
105      * Gets a bookmark.
106      *
107      * @param bookmarkId The bookmark id
108      * @return A Bookmark instance or null if no entry found
109      * @throws Exception
110      */

111     public Bookmark selectById(int bookmarkId) throws Exception JavaDoc;
112     
113     /**
114      * Gets a bookmark for edition.
115      *
116      * @param relationId The relation's id
117      * @param relationType The relation type.
118      * @param userId The bookmark's owner
119      * @return A bookmark instance of <code>null</code> if
120      * the record cannot be found
121      * @throws Exception
122      */

123     public Bookmark selectForUpdate(int relationId, int relationType, int userId) throws Exception JavaDoc;
124 }
125
Popular Tags