KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > profile > impl > UserProfile


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.profile.impl;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.Iterator JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.apache.cocoon.portal.layout.CompositeLayout;
23 import org.apache.cocoon.portal.layout.Item;
24 import org.apache.cocoon.portal.layout.Layout;
25
26 /**
27  * This data object holds all information about the current user:
28  * - references to the configuration
29  * - all selected coplets (coplet instance datas)
30  * - layout objects
31  *
32  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
33  * @version CVS $Id: MapProfileLS.java 30941 2004-07-29 19:56:58Z vgritsenko $
34  */

35 public class UserProfile {
36     
37     protected Map JavaDoc copletBaseDatas;
38     
39     protected Map JavaDoc copletDatas;
40     
41     protected Map JavaDoc copletInstanceDatas;
42     
43     protected Map JavaDoc layouts;
44     
45     protected Layout rootLayout;
46     
47     /**
48      * @return Returns the copletBaseDatas.
49      */

50     public Map JavaDoc getCopletBaseDatas() {
51         return copletBaseDatas;
52     }
53     
54     /**
55      * @param copletBaseDatas The copletBaseDatas to set.
56      */

57     public void setCopletBaseDatas(Map JavaDoc copletBaseDatas) {
58         this.copletBaseDatas = copletBaseDatas;
59     }
60     
61     /**
62      * @return Returns the copletDatas.
63      */

64     public Map JavaDoc getCopletDatas() {
65         return copletDatas;
66     }
67     
68     /**
69      * @param copletDatas The copletDatas to set.
70      */

71     public void setCopletDatas(Map JavaDoc copletDatas) {
72         this.copletDatas = copletDatas;
73     }
74     
75     /**
76      * @return Returns the copletInstanceDatas.
77      */

78     public Map JavaDoc getCopletInstanceDatas() {
79         return copletInstanceDatas;
80     }
81     
82     /**
83      * @param copletInstanceDatas The copletInstanceDatas to set.
84      */

85     public void setCopletInstanceDatas(Map JavaDoc copletInstanceDatas) {
86         this.copletInstanceDatas = copletInstanceDatas;
87     }
88     
89     /**
90      * @return Returns the layouts.
91      */

92     public Map JavaDoc getLayouts() {
93         return layouts;
94     }
95     
96     /**
97      * @return Returns the rootLayout.
98      */

99     public Layout getRootLayout() {
100         return rootLayout;
101     }
102     
103     /**
104      * @param rootLayout The rootLayout to set.
105      */

106     public void setRootLayout(Layout rootLayout) {
107         this.rootLayout = rootLayout;
108         this.layouts = new HashMap JavaDoc();
109         this.cacheLayouts(this.layouts, rootLayout);
110     }
111     
112     protected void cacheLayouts(Map JavaDoc layoutMap, Layout layout) {
113         if ( layout != null ) {
114             if ( layout.getId() != null ) {
115                 layoutMap.put( layout.getId(), layout );
116             }
117             if ( layout instanceof CompositeLayout ) {
118                 final CompositeLayout cl = (CompositeLayout)layout;
119                 final Iterator JavaDoc i = cl.getItems().iterator();
120                 while ( i.hasNext() ) {
121                     final Item current = (Item)i.next();
122                     this.cacheLayouts( layoutMap, current.getLayout() );
123                 }
124             }
125         }
126     }
127     
128 }
129
Popular Tags