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  package org.bejug.javacareers.jobs.service;
18  
19  import java.util.List;
20  
21  import org.bejug.javacareers.common.search.SearchCriteria;
22  import org.bejug.javacareers.common.search.SearchCriteriaService;
23  import org.bejug.javacareers.jobs.dao.JobOfferDao;
24  import org.bejug.javacareers.jobs.model.JobOffer;
25  import org.bejug.javacareers.jobs.model.User;
26  
27  /***
28   * The Job offer service implementation which will be called by the view. This
29   * can be any view including RUI and/or HTML web clients.
30   *
31   * @author Stephan Janssen (last modified by $Author: schauwvliege $)
32   * @version $Revision: 1.2 $ - $Date: 2005/09/13 08:11:17 $
33   */
34  public class JobServiceImpl implements JobService {
35  
36      /***
37       * The Joboffer dao.
38       */
39      private JobOfferDao jobOfferDao;
40  
41      /***
42       * The SearchcriteriaService.
43       */
44      private SearchCriteriaService searchCriteriaService;
45  
46      /***
47       * Constructor.
48       * @param jobOfferDao the needed jobOfferDao.
49       * @param searchCriteriaService the needed searchCriteriaService.
50       */
51      public JobServiceImpl(JobOfferDao jobOfferDao,
52      		SearchCriteriaService searchCriteriaService) {
53      	this.jobOfferDao = jobOfferDao;
54      	this.searchCriteriaService = searchCriteriaService;
55      }
56  
57      /***
58       * Sets the offer dao through Springs Ioc.
59       * @param offerDao the offer dao.
60       */
61      public void setJobOfferDao(JobOfferDao offerDao) {
62          this.jobOfferDao = offerDao;
63      }
64  
65      /***
66       * {@inheritDoc}
67       */
68      public void storeJobOffer(JobOffer offer) {
69          jobOfferDao.store(offer);
70      }
71  
72      /***
73       * {@inheritDoc}
74       */
75      public void deleteJobOffer(JobOffer offer) {
76      	jobOfferDao.deleteOffer(offer);
77      }
78  
79      /***
80       * {@inheritDoc}
81       */
82      public int deleteJobOffersByUrl(String url) {
83          return jobOfferDao.deleteOffersByUrl(url);
84      }
85  
86      /***
87       * {@inheritDoc}
88       */
89      public List getJobOffers() {
90          return jobOfferDao.getOffers();
91      }
92  
93      /***
94       * {@inheritDoc}
95       */
96      public JobOffer getJobOffer(Integer id) {
97          return (JobOffer) jobOfferDao.getOffer(id);
98      }
99  
100     /***
101      * {@inheritDoc}
102      */
103     public List getJobOffers(SearchCriteria searchCriteria) {
104         if (searchCriteria.getClazz().equals(JobOffer.class)) {
105             return searchCriteriaService.executeQuery(searchCriteria);
106         }
107         throw new IllegalArgumentException("invalid class type");
108     }
109 
110     /***
111      * @param searchCriteriaService The searchCriteriaServiceHibernate to set.
112      */
113     public void setSearchCriteriaService(
114             SearchCriteriaService searchCriteriaService) {
115         this.searchCriteriaService = searchCriteriaService;
116     }
117 
118     /***
119      * {@inheritDoc}
120      */
121     public int getJobOfferCount() {
122         return jobOfferDao.getOfferCount();
123     }
124 
125     /***
126      * {@inheritDoc}
127      */
128     public int getCurrentUserJobOfferCount(User currentUser) {
129         return jobOfferDao.getUserJobOfferCount(currentUser);
130     }
131 }
132 /***
133  * $Log: JobServiceImpl.java,v $
134  * Revision 1.2  2005/09/13 08:11:17  schauwvliege
135  * organize imports
136  *
137  * Revision 1.1  2005/08/26 07:58:31  ge0ffrey
138  * split up the sources in service, serviceimpl and webclient
139  *
140  * Revision 1.13  2005/08/14 22:27:20  stephan_janssen
141  * Removed getJobOfferDao and getSearchCriteriaService methods.
142  *
143  * Revision 1.12  2005/08/12 08:33:09  bme_jcs
144  * moved profile-methods from jobservice to adminservice
145  *
146  * Revision 1.11  2005/08/10 09:04:49  bavo_jcs
147  * Optimized imports according to checkstyle
148  *
149  * Revision 1.10  2005/08/09 12:59:56  bavo_jcs
150  * Optimized imports
151  *
152  * Revision 1.9  2005/08/08 09:38:21  bme_jcs
153  * resolved checkstyle errors
154  *
155  * Revision 1.8  2005/08/05 07:50:32  psong09
156  * added named query to Offer
157  *
158  * Revision 1.7  2005/08/03 13:16:03  bme_jcs
159  * getDao's removed and storeObject renamed to store
160  *
161  * Revision 1.6  2005/07/13 14:19:27  bme_jcs
162  * introduction of constructor-injection
163  *
164  * Revision 1.5  2005/06/14 13:40:04  schauwvliege
165  * Renamed add to store
166  *
167  * Revision 1.4  2005/06/14 12:05:52  schauwvliege
168  * CheckStyle and fixing tests
169  *
170  * Revision 1.3  2005/06/10 15:37:34  bavo_jcs
171  * int returned on delete
172  *
173  * Revision 1.2  2005/06/09 08:18:52  bejug_cc
174  * Fix initial import
175  *
176  * Revision 1.15  2005/05/31 07:10:32  bme
177  * added count-methods
178  *
179  * Revision 1.14  2005/05/26 14:14:02  PSONG09
180  * removed trows exception getJobOffers method
181  *
182  * Revision 1.13  2005/05/25 15:38:45  ssc
183  * Optimized tests for search criteria
184  *
185  * Revision 1.12  2005/05/13 14:54:09  ssc
186  * added delete profile
187  *
188  * Revision 1.11  2005/05/12 08:23:55  ssc
189  * Checkstyle errors
190  *
191  * Revision 1.10  2005/05/11 10:14:52  ssc
192  * Checstyle errors
193  *
194  * Revision 1.9  2005/05/10 13:31:52  bbr
195  * Added deleteOffersByUrl()
196  *
197  * Revision 1.8  2005/05/09 13:28:35  bme
198  * updated for the introduction of the 'generalised' parameterhandling
199  *
200  * Revision 1.7  2005/05/01 17:35:20  sja
201  * Replaced javadoc with @inheritDoc
202  *
203  * Revision 1.6  2005/05/01 12:09:32  sja
204  * Added ProfileDao to service.
205  *
206  * Revision 1.5  2005/04/29 18:17:34  sja
207  * General cleanup (naming conv., javadoc and CVS tags)
208  *
209  * Revision 1.3  2005/04/29 12:16:32  bme
210  * first release
211  *
212  * Revision 1.1  2005/04/19 11:51:22  PSONG09
213  * First release
214  *
215  * Revision 1.2  2005/04/18 18:38:24  sja
216  * Added extra CVS tags and getJobDao method.
217  *
218  * Revision 1.1  2005/04/15 19:51:05  sja
219  * First Release
220  *
221  *
222  */