View Javadoc

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.service;
19  
20  import java.util.List;
21  
22  import org.bejug.javacareers.jobs.dao.CommentDao;
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  
27  
28  /***
29   * Concrete implementation of the comment service.
30   *
31   * @author : Peter Symoens (Last modified by $Author: shally $)
32   * @version $Revision: 1.5 $ - $Date: 2005/12/09 10:46:56 $:
33   */
34  public class CommentServiceImpl implements CommentService {
35  
36  
37      /***
38       * the commentdao.
39       */
40      private CommentDao commentDao = null;
41      
42      
43      /***
44       * Constructor. 
45       * @param commentDao the needed CommentDao.
46       */
47      public CommentServiceImpl(CommentDao commentDao) {
48      	this.commentDao = commentDao;
49      }
50      
51  
52      /***
53       * @param commentDao The commentdao, injected by Springs container.
54       */
55      public void setCommentDao(CommentDao commentDao) {
56          this.commentDao = commentDao;
57      }
58  
59      /***
60       * {@inheritDoc}
61       */
62      public void storeComment(Comment comment) {
63          commentDao.store(comment);
64      }
65  
66      /***
67       * {@inheritDoc}
68       */
69      public void deleteComment(Integer commentId) {
70          commentDao.deleteComment(commentId);
71      }
72  
73      /***
74       * {@inheritDoc}
75       */
76      public Comment getCommentBySubject(Integer offerId, String subject) {
77          return commentDao.getCommentBySubject(offerId, subject);
78      }
79  
80      /***
81       * {@inheritDoc}
82       */
83      public List getComments(Integer offerId, boolean rootOnly) {
84          return commentDao.getComments(offerId, rootOnly);
85      }
86  
87      /***
88       * {@inheritDoc}
89       */
90      public Comment getComment(Integer id) {
91          return commentDao.getComment(id);
92      }
93  
94      /***
95       * {@inheritDoc}
96       */
97      public List getChildComments(Comment comment) {
98          return commentDao.getChildComments(comment.getId());
99      }
100 
101     /***
102      * {@inheritDoc}
103      */
104     public List getUserComments(User user) {
105          return commentDao.getUserComments(user);
106     }
107 
108     /***
109      * {@inheritDoc}
110      */
111     public int getCommentCount(Item offer) {
112         return commentDao.getCommentCount(offer);
113     }
114 
115     /***
116      * {@inheritDoc}
117      *
118      * @param comment
119      */
120     public int getChildCommentCount(Comment comment) {
121         return commentDao.getChildCommentCount(comment);
122     }
123 }
124 
125 /***
126  * $Log: CommentServiceImpl.java,v $
127  * Revision 1.5  2005/12/09 10:46:56  shally
128  * Opkuis voor checkstyle en PMD
129  *
130  * Revision 1.4  2005/09/19 14:16:51  bavo_jcs
131  * Refactored comments to use Items
132  *
133  * Revision 1.3  2005/09/13 08:11:17  schauwvliege
134  * organize imports
135  *
136  * Revision 1.2  2005/08/30 13:07:48  psong09
137  * renamed author: psong09
138  *
139  * Revision 1.1  2005/08/26 07:58:31  ge0ffrey
140  * split up the sources in service, serviceimpl and webclient
141  *
142  * Revision 1.11  2005/08/10 09:04:49  bavo_jcs
143  * Optimized imports according to checkstyle
144  *
145  * Revision 1.10  2005/08/09 12:59:56  bavo_jcs
146  * Optimized imports
147  *
148  * Revision 1.9  2005/08/03 13:16:03  bme_jcs
149  * getDao's removed and storeObject renamed to store
150  *
151  * Revision 1.8  2005/07/13 14:19:27  bme_jcs
152  * introduction of constructor-injection
153  *
154  * Revision 1.7  2005/07/08 15:47:26  psong09
155  * modified comment component, removed subject field
156  *
157  * Revision 1.6  2005/07/07 12:42:38  psong09
158  * completed test coverage, implemented methods
159  *
160  */