01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.tools.userManagement;
18:
19: import java.util.Collection;
20: import java.util.HashMap;
21:
22: /**
23: * Object storing information of an user context.
24: *
25: * @version CVS $Id: UserBean.java 433543 2006-08-22 06:22:54Z crossley $
26: */
27: public class UserBean {
28:
29: private HashMap context = new HashMap();
30: private String picture = "";
31:
32: public UserBean() {
33: }
34:
35: /**
36: * Add a single context information
37: *
38: * @param key name of the context
39: * @param value value of the context
40: */
41: public void addContext(String key, String value) {
42: this .context.put(key, new ContextItem(key, value));
43: }
44:
45: /**
46: * Get the whole context of the current user
47: *
48: * @return Collection of the whole context
49: */
50: public Collection getContext() {
51: return this .context.values();
52: }
53:
54: /**
55: * return specified context value
56: *
57: * @param key
58: */
59: public String getContextItem(String key) {
60: if (this .context.get(key) != null) {
61: return ((ContextItem) this .context.get(key)).getValue();
62: } else {
63: return "";
64: }
65: }
66:
67: /**
68: * Special Attribute for the cocoon portal tool example:
69: * you can store even extra attributes in the bean
70: *
71: * @return name of the picture file
72: */
73: public String getPicture() {
74: return picture;
75: }
76:
77: /**
78: * Special Attribute for the cocoon portal tool example:
79: * you can store even extra attributes in the bean
80: *
81: * @param string name of the picture file
82: */
83: public void setPicture(String string) {
84: picture = string;
85: }
86: }
|