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.pluto.driver.services.portal;
18:
19: import java.util.ArrayList;
20: import java.util.Collection;
21:
22: /**
23: */
24: public class PageConfig {
25:
26: private String name;
27: private String uri;
28: private Collection portletIds;
29: private int orderNumber;
30:
31: public PageConfig() {
32: this .portletIds = new ArrayList();
33: }
34:
35: public String getName() {
36: return name;
37: }
38:
39: public void setName(String name) {
40: this .name = name;
41: }
42:
43: public String getUri() {
44: return uri;
45: }
46:
47: public void setUri(String uri) {
48: this .uri = uri;
49: }
50:
51: public Collection getPortletIds() {
52: return portletIds;
53: }
54:
55: public void setPortletIds(Collection ids) {
56: this .portletIds = ids;
57: }
58:
59: public void addPortlet(String contextPath, String portletName) {
60: synchronized (portletIds) {
61: portletIds.add(PortletWindowConfig.createPortletId(
62: contextPath, portletName, createPlacementId()));
63: }
64: }
65:
66: public void removePortlet(String portletId) {
67: portletIds.remove(portletId);
68: }
69:
70: void setOrderNumber(int number) {
71: this .orderNumber = number;
72: }
73:
74: int getOrderNumber() {
75: return orderNumber;
76: }
77:
78: private String createPlacementId() {
79: return getName().hashCode() + "|" + portletIds.size();
80: }
81:
82: }
|