1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.jetspeed.om.portlet.impl; |
18 |
|
|
19 |
|
import javax.portlet.PortletMode; |
20 |
|
|
21 |
|
import org.apache.jetspeed.om.common.portlet.CustomPortletMode; |
22 |
|
|
23 |
|
public class CustomPortletModeImpl implements CustomPortletMode |
24 |
|
{ |
25 |
|
|
26 |
|
protected long appId; |
27 |
|
|
28 |
|
protected long id; |
29 |
|
|
30 |
|
protected String customName; |
31 |
|
|
32 |
|
protected String mappedName; |
33 |
|
|
34 |
|
protected String description; |
35 |
|
|
36 |
|
protected transient PortletMode customMode; |
37 |
|
|
38 |
|
protected transient PortletMode mappedMode; |
39 |
|
|
40 |
|
public CustomPortletModeImpl() |
41 |
0 |
{ |
42 |
0 |
} |
43 |
|
|
44 |
|
public void setCustomName(String customName) |
45 |
|
{ |
46 |
0 |
if (customName == null) |
47 |
|
{ |
48 |
0 |
throw new IllegalArgumentException("CustomName is required"); |
49 |
0 |
} else if (this.customName != null) |
50 |
|
{ |
51 |
0 |
throw new IllegalStateException("CustomName already set"); |
52 |
|
} |
53 |
0 |
this.customName = customName.toLowerCase(); |
54 |
0 |
} |
55 |
|
|
56 |
|
public void setDescription(String description) |
57 |
|
{ |
58 |
0 |
this.description = description; |
59 |
0 |
} |
60 |
|
|
61 |
|
public void setMappedName(String mappedName) |
62 |
|
{ |
63 |
0 |
if (this.mappedName != null || class="keyword">this.mappedMode != class="keyword">null) |
64 |
|
{ |
65 |
0 |
throw new IllegalArgumentException("MappedName already set"); |
66 |
0 |
} else if (mappedName != null) |
67 |
|
{ |
68 |
0 |
this.mappedName = mappedName.toLowerCase(); |
69 |
|
} |
70 |
0 |
} |
71 |
|
|
72 |
|
public PortletMode getCustomMode() |
73 |
|
{ |
74 |
0 |
if (customMode == null) |
75 |
|
{ |
76 |
0 |
customMode = new PortletMode(customName); |
77 |
|
} |
78 |
0 |
return customMode; |
79 |
|
} |
80 |
|
|
81 |
|
public PortletMode getMappedMode() |
82 |
|
{ |
83 |
0 |
if (mappedMode == null) |
84 |
|
{ |
85 |
0 |
if (mappedName != null) |
86 |
|
{ |
87 |
0 |
mappedMode = new PortletMode(mappedName); |
88 |
|
} else |
89 |
|
{ |
90 |
0 |
mappedMode = getCustomMode(); |
91 |
|
} |
92 |
|
} |
93 |
0 |
return mappedMode; |
94 |
|
} |
95 |
|
|
96 |
|
public String getDescription() |
97 |
|
{ |
98 |
0 |
return description; |
99 |
|
} |
100 |
|
|
101 |
|
public int hashCode() |
102 |
|
{ |
103 |
0 |
return customName != null ? customName.hashCode() : super.hashCode(); |
104 |
|
} |
105 |
|
|
106 |
|
public boolean equals(Object object) |
107 |
|
{ |
108 |
0 |
if (object instanceof CustomPortletModeImpl) |
109 |
0 |
return customName.equals(((CustomPortletModeImpl) object).customName); |
110 |
|
else |
111 |
0 |
return false; |
112 |
|
} |
113 |
|
} |