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 org.bejug.javacareers.common.search.SearchCriteria;
21 import org.bejug.javacareers.common.search.SearchCriteriaService;
22 import org.bejug.javacareers.jobs.dao.OfferDao;
23 import org.bejug.javacareers.jobs.model.ConsultingServiceOffer;
24 import org.bejug.javacareers.jobs.model.EducationServiceOffer;
25 import org.bejug.javacareers.jobs.model.ServiceOffer;
26
27 import java.util.List;
28
29 /***
30 * The concrete implementation of the ServiceOfferService.
31 *
32 * @author Bart Meyers (Last modified by $Author: stephan_janssen $)
33 * @version $Revision: 1.2 $ $Date: 2005/10/11 09:11:48 $
34 */
35 public class ServiceOfferServiceImpl implements ServiceOfferService {
36
37 /***
38 * The SearchcriteriaService.
39 */
40 private SearchCriteriaService searchCriteriaService;
41
42 /***
43 * The educationserviceofferdao.
44 */
45 private OfferDao educationServiceOfferDao = null;
46
47 /***
48 * The consultingserviceofferdao.
49 */
50 private OfferDao consultingServiceOfferDao = null;
51
52 /***
53 * Constructor.
54 * @param educationServiceOfferDao the needed educationServiceOfferDao.
55 * @param consultingServiceOfferDao the needed consultingServiceOfferDao.
56 * @param searchCriteriaService the neede searchCriteriaService.
57 */
58 public ServiceOfferServiceImpl(OfferDao educationServiceOfferDao,
59 OfferDao consultingServiceOfferDao,
60 SearchCriteriaService searchCriteriaService) {
61 this.searchCriteriaService = searchCriteriaService;
62 this.educationServiceOfferDao = educationServiceOfferDao;
63 this.consultingServiceOfferDao = consultingServiceOfferDao;
64 }
65
66 /***
67 * sets the consultingserviceofferdao.
68 * @param consultingServiceOfferDao the ConsultingService to set
69 */
70 public void setConsultingServiceOfferDao(
71 OfferDao consultingServiceOfferDao) {
72 this.consultingServiceOfferDao = consultingServiceOfferDao;
73 }
74
75 /***
76 * sets the educationserviceofferdao.
77 * @param educationServiceOfferDao the EducationService to set
78 */
79 public void setEducationServiceOfferDao(
80 OfferDao educationServiceOfferDao) {
81 this.educationServiceOfferDao = educationServiceOfferDao;
82 }
83
84 /***
85 * {@inheritDoc}
86 */
87 public void storeServiceOffer(ServiceOffer offer) {
88
89
90 educationServiceOfferDao.store(offer);
91 }
92
93 /***
94 * {@inheritDoc}
95 */
96 public void deleteServiceOffer(ServiceOffer offer) {
97
98 educationServiceOfferDao.deleteOffer(offer);
99 }
100
101 /***
102 * {@inheritDoc}
103 */
104 public List getEducationServiceOffers() {
105 return educationServiceOfferDao.getOffers();
106 }
107
108 /***
109 * {@inheritDoc}
110 */
111 public List getConsultingServiceOffers() {
112 return consultingServiceOfferDao.getOffers();
113 }
114
115 /***
116 * {@inheritDoc}
117 */
118 public EducationServiceOffer getEducationServiceOffer(Integer id) {
119 return (EducationServiceOffer) educationServiceOfferDao.getOffer(id);
120 }
121
122 /***
123 * {@inheritDoc}
124 */
125 public ConsultingServiceOffer getConsultingServiceOffer(Integer id) {
126 return (ConsultingServiceOffer) consultingServiceOfferDao.getOffer(id);
127 }
128
129 /***
130 * {@inheritDoc}
131 */
132 public int getConsultingServiceOffersCount() {
133 return consultingServiceOfferDao.getOfferCount();
134 }
135
136 /***
137 * {@inheritDoc}
138 */
139 public int getEducationServiceOffersCount() {
140 return educationServiceOfferDao.getOfferCount();
141 }
142
143 /***
144 * {@inheritDoc}
145 */
146 public void setSearchCriteriaService(
147 SearchCriteriaService searchCriteriaService) {
148 this.searchCriteriaService = searchCriteriaService;
149 }
150
151 /***
152 * {@inheritDoc}
153 */
154 public List getConsultingServiceOffers(SearchCriteria searchCriteria)
155 throws IllegalArgumentException {
156 if (searchCriteria.getClazz().equals(ConsultingServiceOffer.class)) {
157 return searchCriteriaService.executeQuery(searchCriteria);
158 }
159 throw new IllegalArgumentException("invalid class type");
160 }
161
162 /***
163 * {@inheritDoc}
164 */
165 public List getEducationServiceOffers(SearchCriteria searchCriteria)
166 throws IllegalArgumentException {
167 if (searchCriteria.getClazz().equals(EducationServiceOffer.class)) {
168 return searchCriteriaService.executeQuery(searchCriteria);
169 }
170 throw new IllegalArgumentException("invalid class type");
171 }
172 }
173 /***
174 * $Log: ServiceOfferServiceImpl.java,v $
175 * Revision 1.2 2005/10/11 09:11:48 stephan_janssen
176 * Code cleanup.
177 *
178 * Revision 1.1 2005/08/26 07:58:31 ge0ffrey
179 * split up the sources in service, serviceimpl and webclient
180 *
181 * Revision 1.9 2005/08/19 13:29:53 bme_jcs
182 * checkstyle errors resolved
183 *
184 * Revision 1.8 2005/08/17 09:07:59 schauwvliege
185 * added education en service offer services
186 *
187 * Revision 1.7 2005/08/10 09:04:49 bavo_jcs
188 * Optimized imports according to checkstyle
189 *
190 * Revision 1.6 2005/08/09 12:59:56 bavo_jcs
191 * Optimized imports
192 *
193 * Revision 1.5 2005/08/03 13:16:03 bme_jcs
194 * getDao's removed and storeObject renamed to store
195 *
196 * Revision 1.4 2005/07/13 14:19:27 bme_jcs
197 * introduction of constructor-injection
198 *
199 * Revision 1.3 2005/06/14 13:40:04 schauwvliege
200 * Renamed add to store
201 *
202 * Revision 1.2 2005/06/09 08:18:52 bejug_cc
203 * Fix initial import
204 *
205 * Revision 1.3 2005/05/11 16:31:04 sja
206 * Added CVS last modified tag.
207 *
208 * Revision 1.2 2005/05/11 10:14:52 ssc
209 * Checstyle errors
210 *
211 * Revision 1.1 2005/05/02 15:48:27 bme
212 * first release
213 *
214 */