View Javadoc

1   /*
2    * Copyright 2003,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  /* 
17  
18   */
19  
20  package org.apache.pluto.portalImpl.om.page.impl;
21  
22  import java.util.ArrayList;
23  import java.util.Collection;
24  import java.util.Iterator;
25  
26  import javax.servlet.ServletConfig;
27  
28  import org.apache.pluto.util.StringUtils;
29  
30  public class PortalImpl implements java.io.Serializable {
31  
32      private ArrayList fragments = new ArrayList();
33  
34      public PortalImpl()
35      {
36      }
37  
38      // additional methods.
39      
40      public Collection getFragments()
41      {
42          return fragments;
43      }
44  
45      public org.apache.pluto.portalImpl.aggregation.RootFragment build(ServletConfig config)    
46      throws Exception
47      {
48          org.apache.pluto.portalImpl.aggregation.RootFragment root = 
49          new org.apache.pluto.portalImpl.aggregation.RootFragment(config);
50  
51          Iterator iterator = fragments.iterator();
52  
53          while (iterator.hasNext()) {
54              FragmentImpl fragmentimpl = (FragmentImpl)iterator.next();
55  
56              org.apache.pluto.portalImpl.aggregation.Fragment _fragment = 
57              fragmentimpl.build(config, root);
58              if (_fragment!=null) {
59                  root.addChild(_fragment);
60              }
61          }
62  
63          return root;
64      }
65  
66      public String toString()
67      {
68          StringBuffer buffer = new StringBuffer(2000);
69          StringUtils.newLine(buffer,0);
70          buffer.append(getClass().toString()); buffer.append(":");
71          StringUtils.newLine(buffer,0);
72          buffer.append("{");
73  
74          Iterator iterator = fragments.iterator();
75  
76          while (iterator.hasNext()) {
77              buffer.append(((FragmentImpl)iterator.next()).toString(2));
78          }
79  
80          StringUtils.newLine(buffer,0);
81          buffer.append("}");
82          return buffer.toString();
83      }
84  
85  }