1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16
17 */
18 package org.bejug.javacareers.jobs.dao;
19
20
21 import java.util.List;
22
23 import org.bejug.javacareers.jobs.model.Comment;
24 import org.bejug.javacareers.jobs.model.Item;
25 import org.bejug.javacareers.jobs.model.User;
26 import org.springframework.dao.DataAccessException;
27
28 /***
29 * @author Stephan Janssen (Last modified by $Author: shally $)
30 * @version $Revision: 1.5 $ - $Date: 2005/12/20 15:36:46 $
31 */
32 public interface CommentDao {
33
34 /***
35 * Add a new comment.
36 *
37 * @param comment the new commment.
38 * @throws DataAccessException thrown when something goes wrong when getting
39 */
40 void store(Comment comment) throws DataAccessException;
41
42 /***
43 * Get all comments related to the offer.
44 *
45 * @param rootOnly if true, return only the root comment.
46 * @param offerId the id of the offer to get the comment from.
47 * @return a list of comments related to the offer.
48 * @throws DataAccessException thrown when something goes wrong when getting
49 * Todo: add offer to parameter list.
50 */
51 List getComments(Integer offerId, boolean rootOnly)
52 throws DataAccessException;
53
54 /***
55 * @param commentId the id of the comment to get the childcomments from.
56 * @return a list of the childcomments
57 * @throws DataAccessException e
58 */
59 List getChildComments(Integer commentId)
60 throws DataAccessException;
61
62
63 /***
64 * Delete the given comment.
65 *
66 * @param comment The comment to be removed.
67 * @throws DataAccessException thrown zhen something goes wrong when getting
68 */
69 void deleteComment(Comment comment) throws DataAccessException;
70
71 /***
72 * Delete the given comment by id.
73 *
74 * @param id The comment id.
75 * @throws DataAccessException thrown zhen something goes wrong when getting
76 */
77 void deleteComment(Integer id) throws DataAccessException;
78
79 /***
80 * find the given comment by id.
81 *
82 * @param id The commentid.
83 * @return the found comment.
84 * @throws DataAccessException thrown zhen something goes wrong when getting
85 */
86 Comment getComment(Integer id) throws DataAccessException;
87
88 /***
89 * get a comment.
90 *
91 * @param offerId The offer the comment is linked to
92 * @param subject The subject of the comment
93 * @return a comment
94 */
95 Comment getCommentBySubject(Integer offerId, String subject);
96
97
98 /***
99 *
100 * @param user User
101 * @return all comments posted by this user
102 */
103 List getUserComments(User user);
104
105 /***
106 *
107 * @param comment Comment
108 * @return the nr of child comments from this parent comment
109 */
110 int getChildCommentCount(Comment comment);
111
112 /***
113 * @param offer Offer
114 * @return commentCount Returns the nr of comments for this Offer.
115 */
116 int getCommentCount(Item offer);
117 }
118
119 /***
120 * $Log: CommentDao.java,v $
121 * Revision 1.5 2005/12/20 15:36:46 shally
122 * CheckStyle and PMD changes.
123 *
124 * Revision 1.4 2005/12/09 10:46:55 shally
125 * Opkuis voor checkstyle en PMD
126 *
127 * Revision 1.3 2005/09/19 14:16:51 bavo_jcs
128 * Refactored comments to use Items
129 *
130 * Revision 1.2 2005/09/13 08:11:17 schauwvliege
131 * organize imports
132 *
133 * Revision 1.1 2005/08/26 07:58:30 ge0ffrey
134 * split up the sources in service, serviceimpl and webclient
135 *
136 * Revision 1.14 2005/08/10 09:04:49 bavo_jcs
137 * Optimized imports according to checkstyle
138 *
139 * Revision 1.13 2005/08/09 12:59:55 bavo_jcs
140 * Optimized imports
141 *
142 * Revision 1.12 2005/08/04 11:52:34 bme_jcs
143 * resolved checkstyle errors
144 *
145 * Revision 1.11 2005/08/03 13:14:18 bme_jcs
146 * getDao's removed and storeObject renamed to store
147 *
148 * Revision 1.10 2005/07/08 15:47:26 psong09
149 * modified comment component, removed subject field
150 *
151 * Revision 1.9 2005/07/04 07:54:00 psong09
152 * update comment component: added count(*) query, user login check, javascript
153 *
154 * Revision 1.8 2005/06/30 12:23:44 psong09
155 * update comment component
156 *
157 * Revision 1.7 2005/06/29 09:00:25 psong09
158 * comment component updated
159 *
160 * Revision 1.6 2005/06/28 07:38:29 psong09
161 * comment component updated
162 *
163 * Revision 1.5 2005/06/17 11:42:47 schauwvliege
164 * CheckStyle/ PMD
165 *
166 * Revision 1.4 2005/06/16 14:52:54 psong09
167 * added subject to comments
168 *
169 * Revision 1.3 2005/06/14 13:40:04 schauwvliege
170 * Renamed add to store
171 *
172 * Revision 1.2 2005/06/09 08:18:44 bejug_cc
173 * Fix initial import
174 *
175 * Revision 1.7 2005/05/26 14:59:31 ssc
176 * added Searchcriteria tests
177 *
178 * Revision 1.6 2005/05/25 13:06:55 sja
179 * Added DataAccessException.
180 *
181 * Revision 1.5 2005/05/25 11:06:53 ssc
182 * added DBUnit tests and fixed some errors
183 *
184 * Revision 1.4 2005/05/09 13:42:10 ssc
185 * checkstyle
186 *
187 * Revision 1.3 2005/05/07 15:44:39 ssc
188 * added child commend and tests
189 *
190 * Revision 1.2 2005/05/02 13:20:08 ssc
191 * Organize imports
192 *
193 * Revision 1.1 2005/05/01 21:31:38 sja
194 * First import.
195 *
196 *
197 */