01: /*
02: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
03: * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
04: *
05: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
06: * General Public License as published by the Free Software Foundation; either version 2 of the License,
07: * or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public License along with this program; if not,
14: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15: */
16:
17: package wilos.business.services.spem2.role;
18:
19: import java.util.HashSet;
20: import java.util.Set;
21:
22: import org.springframework.transaction.annotation.Propagation;
23: import org.springframework.transaction.annotation.Transactional;
24:
25: import wilos.hibernate.spem2.role.RoleDefinitionDao;
26: import wilos.model.spem2.guide.Guidance;
27: import wilos.model.spem2.role.RoleDefinition;
28: import wilos.model.spem2.role.RoleDescriptor;
29:
30: /**
31: * @author Sebastien
32: *
33: */
34: @Transactional(readOnly=false,propagation=Propagation.REQUIRED)
35: public class RoleDefinitionService {
36:
37: private RoleDefinitionDao roleDefinitionDao;
38:
39: public Set<Guidance> getGuidances(RoleDefinition _rdef) {
40: this .roleDefinitionDao.getSessionFactory().getCurrentSession()
41: .saveOrUpdate(_rdef);
42: Set<Guidance> tmp = new HashSet<Guidance>();
43: for (Guidance g : _rdef.getGuidances()) {
44: tmp.add(g);
45: }
46: return tmp;
47: }
48:
49: public Set<RoleDescriptor> getRoleDescriptors(RoleDefinition _rdef) {
50: this .roleDefinitionDao.getSessionFactory().getCurrentSession()
51: .saveOrUpdate(_rdef);
52: Set<RoleDescriptor> tmp = new HashSet<RoleDescriptor>();
53: for (RoleDescriptor rd : _rdef.getRoleDescriptors()) {
54: tmp.add(rd);
55: }
56: return tmp;
57: }
58:
59: /**
60: * @return the roleDefinitionDao
61: */
62: public RoleDefinitionDao getRoleDefinitionDao() {
63: return this .roleDefinitionDao;
64: }
65:
66: /**
67: * @param _roleDefinitionDao
68: * the roleDefinitionDao to set
69: */
70: public void setRoleDefinitionDao(
71: RoleDefinitionDao _roleDefinitionDao) {
72: this.roleDefinitionDao = _roleDefinitionDao;
73: }
74: }
|