KickJava   Java API By Example, From Geeks To Geeks.

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


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  *
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 Dec 29, 2004 2:00:00 PM
40  * The JForum Project
41  * http://www.jforum.net
42  */

43 package net.jforum.dao;
44
45 import net.jforum.entities.Poll;
46
47 public interface PollDAO {
48
49     /**
50      * Gets a specific <code>Poll</code>.
51      *
52      * @param pollId The Poll ID to search
53      * @return <code>Poll</code>object containing all the information
54      * @throws Exception
55      */

56     public Poll selectById(int pollId) throws Exception JavaDoc;
57         
58     /**
59      * Delete a Poll.
60      *
61      * @param pollId The Poll to delete
62      * @throws Exception
63      * @see #canDelete(int)
64      */

65     public void delete(int pollId) throws Exception JavaDoc;
66         
67     /**
68      * Delete a Poll.
69      *
70      * @param topicId The topic id for the poll to delete
71      * @throws Exception
72      * @see #canDelete(int)
73      */

74     public void deleteByTopicId(int topicId) throws Exception JavaDoc;
75     
76     /**
77      * Updates a Poll.
78      *
79      * @param poll Reference to a <code>Poll</code> object to update
80      * @throws Exception
81      * @see #update(int)
82      */

83     public void update(Poll poll) throws Exception JavaDoc;
84     
85     /**
86      * Adds a new Poll.
87      *
88      * @param Poll Reference to a valid and configured <code>Poll</code> object
89      * @return The new ID
90      * @throws Exception
91      */

92     public int addNew(Poll poll) throws Exception JavaDoc;
93
94     /**
95      * Increments the vote count on the poll for the given poll id and option id
96      * @param pollId the poll id that the vote is for
97      * @param optionId the option that was selected for the poll
98      * @param userId TODO
99      * @param ipAddress TODO
100      * @throws Exception
101      */

102     public void voteOnPoll(int pollId, int optionId, int userId, String JavaDoc ipAddress)
103     throws Exception JavaDoc;
104     
105     /**
106      * Tells if the user has already voted on the given poll
107      * @param pollId the poll id that is being checked
108      * @param userId the user id to check the vote for
109      * @return true if the user has already voted on the given poll
110      * @throws Exception
111      */

112     public boolean hasUserVotedOnPoll(int pollId, int userId) throws Exception JavaDoc;
113     
114     /**
115      * Tells if any user has already voted on the given poll from the given IP
116      * @param pollId the poll id that is being checked
117      * @param ipAddress the IP address of the user to check the vote for
118      * @return true if the user has already voted on the given poll
119      * @throws Exception
120      */

121     public boolean hasUserVotedOnPoll(int pollId, String JavaDoc ipAddress) throws Exception JavaDoc;
122 }
123
Popular Tags