01: /******************************************************************************
02: * JBoss, a division of Red Hat *
03: * Copyright 2006, Red Hat Middleware, LLC, and individual *
04: * contributors as indicated by the @authors tag. See the *
05: * copyright.txt in the distribution for a full listing of *
06: * individual contributors. *
07: * *
08: * This is free software; you can redistribute it and/or modify it *
09: * under the terms of the GNU Lesser General Public License as *
10: * published by the Free Software Foundation; either version 2.1 of *
11: * the License, or (at your option) any later version. *
12: * *
13: * This software is distributed in the hope that it will be useful, *
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16: * Lesser General Public License for more details. *
17: * *
18: * You should have received a copy of the GNU Lesser General Public *
19: * License along with this software; if not, write to the Free *
20: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
21: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
22: ******************************************************************************/package org.jboss.portal.migration.model22.impl.user;
23:
24: import org.jboss.portal.migration.model22.model.PreferencesGroup22;
25: import org.jboss.portal.migration.model22.other.ValueMap;
26:
27: import java.util.HashMap;
28: import java.util.Map;
29:
30: /**
31: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
32: * @version $Revision: 8784 $
33: */
34: public class UserPreferencesGroup22Impl implements PreferencesGroup22 {
35:
36: /** The key. */
37: protected Long key;
38:
39: /** The id. */
40: public String groupId;
41:
42: /** The preferences map. */
43: public Map prefMap;
44:
45: /**
46: *
47: */
48: public UserPreferencesGroup22Impl(String id) {
49: this .groupId = id;
50: this .prefMap = new HashMap();
51: this .key = null;
52: }
53:
54: /** Used by hibernate only. */
55: protected UserPreferencesGroup22Impl() {
56: }
57:
58: /** Called by Hibernate. */
59: protected Long getKey() {
60: return key;
61: }
62:
63: /** Called by Hibernate. */
64: protected void setKey(Long key) {
65: this .key = key;
66: }
67:
68: /** Called by Hibernate. */
69: protected String getGroupId() {
70: return groupId;
71: }
72:
73: /** Called by Hibernate. */
74: protected void setGroupId(String groupId) {
75: this .groupId = groupId;
76: }
77:
78: /** Called by Hibernate. */
79: protected Map getPrefMap() {
80: return prefMap;
81: }
82:
83: /** Called by Hibernate. */
84: protected void setPrefMap(Map prefMap) {
85: this .prefMap = prefMap;
86: }
87:
88: public ValueMap getPreferences(String id, boolean create)
89: throws IllegalArgumentException {
90: ValueMap set = (ValueMap) prefMap.get(id);
91: if (create && set == null) {
92: set = new UserPreferences22Impl(id);
93: prefMap.put(id, set);
94: }
95: return set;
96: }
97: }
|