01: /*
02: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
03: * Copyright (C) 2007-2008 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.hibernate.misc.dailyremainingtime;
18:
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
23:
24: import wilos.model.misc.dailyremainingtime.DailyRemainingTime;
25:
26: /**
27: *
28: * DailyRemainingTimeDao manage requests from the system to store
29: * DailyRemainingTimes to the database
30: *
31: */
32: public class DailyRemainingTimeDao extends HibernateDaoSupport {
33:
34: /**
35: * Saves or updates a DailyRemainingTime
36: *
37: * @param _dailyRemainingTime The DailyRemainingTime to be saved or updated
38: * @return The DailyRemainingTime's ID, if the save has been done successfully
39: */
40: public String saveOrUpdateDailyRemainingTime(
41: DailyRemainingTime _dailyRemainingTime) {
42: if (_dailyRemainingTime != null) {
43: this .getHibernateTemplate().saveOrUpdate(
44: _dailyRemainingTime);
45: return _dailyRemainingTime.getId();
46: }
47: return null;
48: }
49:
50: /**
51: * Returns the DailyRemainingTime which has the specified ID
52: *
53: * @param _id The wanted DailyRemainingTime ID
54: * @return The wanted DailyRemainingTime
55: */
56: public Integer getDailyRemainingTime(Integer _id) {
57: if (_id != null)
58: return (Integer) this .getHibernateTemplate().get(
59: DailyRemainingTime.class, _id);
60: return null;
61: }
62:
63: /**
64: * Deletes the DailyRemainingTime
65: *
66: * @param _dailyRemainingTime The DailyRemainingTime to be deleted
67: */
68: public void deleteDailyRemainingTime(
69: DailyRemainingTime _dailyRemainingTime) {
70: this .getHibernateTemplate().delete(_dailyRemainingTime);
71: }
72:
73: /**
74: * Returns a list of all the DailyRemainingTime
75: *
76: * @return A list of all the DailyRemainingTime
77: */
78: public List<DailyRemainingTime> getDailyRemainingTime() {
79: List<DailyRemainingTime> DailyRemainingTimes = new ArrayList<DailyRemainingTime>();
80: for (Object obj : this .getHibernateTemplate().loadAll(
81: DailyRemainingTime.class)) {
82: DailyRemainingTime drt = (DailyRemainingTime) obj;
83: DailyRemainingTimes.add(drt);
84: }
85: return DailyRemainingTimes;
86: }
87: }
|