001: /*
002: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003: * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004: *
005: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
006: * General Public License as published by the Free Software Foundation; either version 2 of the License,
007: * or (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
010: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU General Public License for more details.
012: *
013: * You should have received a copy of the GNU General Public License along with this program; if not,
014: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
015: */
016:
017: package wilos.business.services.spem2.breakdownelement;
018:
019: import java.util.ArrayList;
020: import java.util.HashSet;
021: import java.util.List;
022: import java.util.Set;
023:
024: import org.springframework.transaction.annotation.Propagation;
025: import org.springframework.transaction.annotation.Transactional;
026:
027: import wilos.hibernate.misc.concretebreakdownelement.ConcreteBreakdownElementDao;
028: import wilos.hibernate.spem2.breakdownelement.BreakdownElementDao;
029: import wilos.model.spem2.activity.Activity;
030: import wilos.model.spem2.breakdownelement.BreakdownElement;
031:
032: /**
033: * BreakdownElement is a transactional class that manages operations about
034: * breakdownelement,
035: */
036: @Transactional(readOnly=false,propagation=Propagation.REQUIRED)
037: @SuppressWarnings("unused")
038: public class BreakdownElementService {
039:
040: private ConcreteBreakdownElementDao concreteBreakdownElementDao;
041:
042: private BreakdownElementDao breakdownElementDao;
043:
044: /**
045: *
046: * @param _act
047: * @return
048: */
049: public List<Activity> getSuperActivitiesUnderList(
050: BreakdownElement _bde) {
051: this .breakdownElementDao.getSessionFactory()
052: .getCurrentSession().saveOrUpdate(_bde);
053: List<Activity> tmp = new ArrayList<Activity>();
054: for (Activity act : _bde.getSuperActivities()) {
055: tmp.add(act);
056: }
057: return tmp;
058: }
059:
060: /**
061: *
062: * @param _act
063: * @return
064: */
065: public Set<Activity> getSuperActivities(BreakdownElement _bde) {
066: this .breakdownElementDao.getSessionFactory()
067: .getCurrentSession().saveOrUpdate(_bde);
068: Set<Activity> tmp = new HashSet<Activity>();
069: for (Activity act : _bde.getSuperActivities()) {
070: tmp.add(act);
071: }
072: return tmp;
073: }
074:
075: /**
076: * Getter of concreteBreakdownElementDao
077: *
078: * @return the concreteBreakdownElementDao
079: */
080: public ConcreteBreakdownElementDao getConcreteBreakdownElementDao() {
081: return concreteBreakdownElementDao;
082: }
083:
084: /**
085: * Setter of concreteBreakdownElementDao
086: *
087: * @param concreteBreakdownElementDao
088: * the concreteBreakdownElementDao to set
089: */
090: public void setConcreteBreakdownElementDao(
091: ConcreteBreakdownElementDao concreteBreakdownElementDao) {
092: this .concreteBreakdownElementDao = concreteBreakdownElementDao;
093: }
094:
095: public BreakdownElementDao getBreakdownElementDao() {
096: return breakdownElementDao;
097: }
098:
099: public void setBreakdownElementDao(
100: BreakdownElementDao breakdownElementDao) {
101: this.breakdownElementDao = breakdownElementDao;
102: }
103:
104: }
|