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.hibernate.misc.concreteworkbreakdownelement;
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.concreteworkbreakdownelement.ConcreteWorkBreakdownElement;
25:
26: /**
27: * @author Sylvain
28: *
29: * ConcreteWorkBreakdownElementDao manage requests from the system to store
30: * WorkBreakdownElements to the database
31: *
32: */
33:
34: public class ConcreteWorkBreakdownElementDao extends
35: HibernateDaoSupport {
36: /**
37: * Saves or updates a ConcreteWorkBreakdownElement
38: *
39: * @param _concreteWorkBreakdownElement The ConcreteWorkBreakdownElement to be saved or updated
40: */
41: public String saveOrUpdateConcreteWorkBreakdownElement(
42: ConcreteWorkBreakdownElement _concreteworkBreakdownElement) {
43: if (_concreteworkBreakdownElement != null) {
44: this .getHibernateTemplate().saveOrUpdate(
45: _concreteworkBreakdownElement);
46: return _concreteworkBreakdownElement.getId();
47: }
48: return "";
49: }
50:
51: /**
52: * Returns a list of all the ConcreteWorkBreakdownElements
53: *
54: * @return A list of all the ConcreteWorkBreakdownElements
55: */
56: public List<ConcreteWorkBreakdownElement> getAllConcreteWorkBreakdownElements() {
57: List<ConcreteWorkBreakdownElement> concreteWorkBreakdownElement = new ArrayList<ConcreteWorkBreakdownElement>();
58: for (Object obj : this .getHibernateTemplate().loadAll(
59: ConcreteWorkBreakdownElement.class)) {
60: ConcreteWorkBreakdownElement wbde = (ConcreteWorkBreakdownElement) obj;
61: concreteWorkBreakdownElement.add(wbde);
62: }
63: return concreteWorkBreakdownElement;
64: }
65:
66: /**
67: * Returns the ConcreteWorkBreakdownElement which has the specified ID
68: *
69: * @param _id The wanted ConcreteWorkBreakdownElement ID
70: * @return The wanted ConcreteWorkBreakdownElement
71: */
72: public ConcreteWorkBreakdownElement getConcreteWorkBreakdownElement(
73: String _id) {
74: if (!_id.equals(""))
75: return (ConcreteWorkBreakdownElement) this
76: .getHibernateTemplate().get(
77: ConcreteWorkBreakdownElement.class, _id);
78: return null;
79: }
80:
81: /**
82: * Deletes the ConcreteWorkBreakdownElement
83: *
84: * @param _concreteWorkBreakdownElement The ConcreteWorkBreakdownElement to be deleted
85: */
86: public void deleteConcreteWorkBreakdownElement(
87: ConcreteWorkBreakdownElement _concreteworkBreakdownElement) {
88: this.getHibernateTemplate().delete(
89: _concreteworkBreakdownElement);
90: }
91: }
|