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.WindowState; |
20 |
|
|
21 |
|
import org.apache.jetspeed.om.common.portlet.CustomWindowState; |
22 |
|
|
23 |
|
public class CustomWindowStateImpl implements CustomWindowState |
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 WindowState customState; |
37 |
|
|
38 |
|
protected transient WindowState mappedState; |
39 |
|
|
40 |
|
public CustomWindowStateImpl() |
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 |
|
} |
50 |
0 |
else if ( this.customName != null ) |
51 |
|
{ |
52 |
0 |
throw new IllegalStateException("CustomName already set"); |
53 |
|
} |
54 |
0 |
this.customName = customName.toLowerCase(); |
55 |
0 |
} |
56 |
|
|
57 |
|
public void setDescription(String description) |
58 |
|
{ |
59 |
0 |
this.description = description; |
60 |
0 |
} |
61 |
|
|
62 |
|
public void setMappedName(String mappedName) |
63 |
|
{ |
64 |
0 |
if ( this.mappedName != null || class="keyword">this.mappedState != class="keyword">null ) |
65 |
|
{ |
66 |
0 |
throw new IllegalArgumentException("MappedName already set"); |
67 |
|
} |
68 |
0 |
else if ( mappedName != null ) |
69 |
|
{ |
70 |
0 |
this.mappedName = mappedName.toLowerCase(); |
71 |
|
} |
72 |
0 |
} |
73 |
|
|
74 |
|
public WindowState getCustomState() |
75 |
|
{ |
76 |
0 |
if (customState == null) |
77 |
|
{ |
78 |
0 |
customState = new WindowState(customName); |
79 |
|
} |
80 |
0 |
return customState; |
81 |
|
} |
82 |
|
|
83 |
|
public WindowState getMappedState() |
84 |
|
{ |
85 |
0 |
if (mappedState == null) |
86 |
|
{ |
87 |
0 |
if (mappedName != null) |
88 |
|
{ |
89 |
0 |
mappedState = new WindowState(mappedName); |
90 |
|
} else |
91 |
|
{ |
92 |
0 |
mappedState = getCustomState(); |
93 |
|
} |
94 |
|
} |
95 |
0 |
return mappedState; |
96 |
|
} |
97 |
|
|
98 |
|
public String getDescription() |
99 |
|
{ |
100 |
0 |
return description; |
101 |
|
} |
102 |
|
|
103 |
|
public int hashCode() |
104 |
|
{ |
105 |
0 |
return customName != null ? customName.hashCode() : super.hashCode(); |
106 |
|
} |
107 |
|
|
108 |
|
public boolean equals(Object object) |
109 |
|
{ |
110 |
0 |
if (object instanceof CustomWindowStateImpl) |
111 |
0 |
return customName.equals(((CustomWindowStateImpl) object).customName); |
112 |
|
else |
113 |
0 |
return false; |
114 |
|
} |
115 |
|
} |