View Javadoc

1   /*
2    * Copyright 2005 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.pluto.descriptors.portlet;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  import java.util.Iterator;
21  
22  /***
23   * Portlet Application Configuration.
24   *
25   * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
26   * @version $Id: PortletAppDD.java 158816 2005-03-23 18:18:44Z ddewolf $
27   * @since Mar 6, 2005
28   */
29  public class PortletAppDD {
30  
31      /*** The defined portlets within the system. */
32      private List portlets = new ArrayList();
33  
34      /***
35       * Default Constructor.
36       */
37      public PortletAppDD() {
38      }
39  
40      /***
41       * Retrieve the portlets which exist within this application.
42       * @return
43       */
44      public List getPortlets() {
45          return portlets;
46      }
47  
48      /***
49       * Set the portlets that exist within this application.
50       * @param portlets
51       */
52      public void setPortlets(List portlets) {
53          this.portlets = portlets;
54      }
55  
56  // Helpers
57  
58      public PortletDD getPortlet(String name) {
59          ArrayList list = new ArrayList(portlets);
60          Iterator it = list.iterator();
61          PortletDD dd;
62          while(name != null && it.hasNext()) {
63              dd = (PortletDD)it.next();
64              if(name.equals(dd.getPortletName())) {
65                  return dd;
66              }
67          }
68          return null;
69      }
70  
71  
72  }
73