KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > om > portlet > impl > PortletApplicationDefinitionListImpl


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.portlet.impl;
21
22 import java.util.HashSet JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25 import org.apache.pluto.om.common.ObjectID;
26 import org.apache.pluto.om.portlet.PortletApplicationDefinition;
27 import org.apache.pluto.om.portlet.PortletApplicationDefinitionList;
28 import org.apache.pluto.util.StringUtils;
29
30 public class PortletApplicationDefinitionListImpl extends HashSet JavaDoc
31 implements PortletApplicationDefinitionList, java.io.Serializable JavaDoc {
32
33     public PortletApplicationDefinitionListImpl()
34     {
35     }
36
37     // PortletApplicationDefinitionList implementation.
38

39     public PortletApplicationDefinition get(ObjectID objectId)
40     {
41         Iterator JavaDoc iterator = this.iterator();
42         while (iterator.hasNext()) {
43             PortletApplicationDefinition portletApplicationDefinition = (PortletApplicationDefinition)iterator.next();
44             if (portletApplicationDefinition.getId().equals(objectId)) {
45                 return portletApplicationDefinition;
46             }
47         }
48         return null;
49     }
50
51     // additional internal methods
52

53     public PortletApplicationDefinition get(String JavaDoc objectId)
54     {
55         Iterator JavaDoc iterator = this.iterator();
56         while (iterator.hasNext()) {
57             PortletApplicationDefinition portletApplicationDefinition = (PortletApplicationDefinition)iterator.next();
58             if (portletApplicationDefinition.getId().toString().equals(objectId)) {
59                 return portletApplicationDefinition;
60             }
61         }
62         return null;
63     }
64
65     public String JavaDoc toString()
66     {
67         return toString(0);
68     }
69
70     public String JavaDoc toString(int indent)
71     {
72         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
73         StringUtils.newLine(buffer,indent);
74         buffer.append(getClass().toString());
75         buffer.append(": ");
76         Iterator JavaDoc iterator = this.iterator();
77         while (iterator.hasNext()) {
78             buffer.append(((PortletApplicationDefinitionImpl)iterator.next()).toString(indent+2));
79         }
80         return buffer.toString();
81     }
82 }
83
Popular Tags