01: /**
02: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17: * USA
18: *
19: * Component of: Red Hat Application Server
20: *
21: * Initial Developers: Greg Lapouchnian
22: * Patrick Smith
23: *
24: */package olstore.domain.manager;
25:
26: import java.util.Collection;
27:
28: import olstore.dto.TypeValue;
29: import olstore.entity.TypeLocalHome;
30: import olstore.session.helper.TypeHelper;
31:
32: /**
33: * A wrapper class for type actions so that there is no need to reference the
34: * beans directly, allowing us to swap out the backend beans for a different
35: * implementation.
36: */
37: public class TypeManager {
38:
39: /** A reference to the LocalHome interface for the Type EJB */
40: private TypeLocalHome home;
41: /** A reference to the TypeHelper */
42: private TypeHelper helper;
43:
44: /**
45: * Constructor for the manager which is populated by Spring.
46: * @param home a reference to the LocalHome interface
47: * @param helper a helper object
48: */
49: public TypeManager(TypeLocalHome home, TypeHelper helper) {
50: this .home = home;
51: this .helper = helper;
52: }
53:
54: /**
55: * Returns all types in the store.
56: * @return a collection of TypeValue objects that exist in the store
57: * @throws Exception if an error occurs during lookup
58: */
59: public Collection findAll() throws Exception {
60: return home.findAll();
61: }
62:
63: /**
64: * Saves a new type.
65: * @param type the TypeValue object that contains the name of the new type.
66: * @throws Exception if an error occurs during the creation of the new type
67: */
68: public void saveType(TypeValue type) throws Exception {
69: helper.saveType(type);
70: }
71:
72: }
|