%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionImpl |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * 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.jetspeed.om.folder.impl; |
|
18 | ||
19 | import java.util.List; |
|
20 | ||
21 | import org.apache.jetspeed.om.folder.MenuDefinition; |
|
22 | import org.apache.jetspeed.page.impl.DatabasePageManagerUtils; |
|
23 | ||
24 | /** |
|
25 | * BaseMenuDefinitionImpl |
|
26 | * |
|
27 | * @author <a href="mailto:rwatler@apache.org">Randy Watler</a> |
|
28 | * @version $Id:$ |
|
29 | */ |
|
30 | 0 | public abstract class BaseMenuDefinitionImpl extends BaseMenuDefinitionMetadata implements MenuDefinition |
31 | { |
|
32 | private String name; |
|
33 | private String options; |
|
34 | private int depth; |
|
35 | private boolean paths; |
|
36 | private boolean regexp; |
|
37 | private String profile; |
|
38 | private String order; |
|
39 | private String skin; |
|
40 | private String title; |
|
41 | private String shortTitle; |
|
42 | private List elements; |
|
43 | ||
44 | /** |
|
45 | * accessElements |
|
46 | * |
|
47 | * Access mutable persistent collection member for List wrappers. |
|
48 | * |
|
49 | * @return persistent collection |
|
50 | */ |
|
51 | public List accessElements() |
|
52 | { |
|
53 | // create initial collection if necessary |
|
54 | 0 | if (elements == null) |
55 | { |
|
56 | 0 | elements = DatabasePageManagerUtils.createList(); |
57 | } |
|
58 | 0 | return elements; |
59 | } |
|
60 | ||
61 | /* (non-Javadoc) |
|
62 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getName() |
|
63 | */ |
|
64 | public String getName() |
|
65 | { |
|
66 | 0 | return name; |
67 | } |
|
68 | ||
69 | /* (non-Javadoc) |
|
70 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setName(java.lang.String) |
|
71 | */ |
|
72 | public void setName(String name) |
|
73 | { |
|
74 | 0 | this.name = name; |
75 | 0 | } |
76 | ||
77 | /* (non-Javadoc) |
|
78 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getOptions() |
|
79 | */ |
|
80 | public String getOptions() |
|
81 | { |
|
82 | 0 | return options; |
83 | } |
|
84 | ||
85 | /* (non-Javadoc) |
|
86 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setOptions(java.lang.String) |
|
87 | */ |
|
88 | public void setOptions(String options) |
|
89 | { |
|
90 | 0 | this.options = options; |
91 | 0 | } |
92 | ||
93 | /* (non-Javadoc) |
|
94 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getDepth() |
|
95 | */ |
|
96 | public int getDepth() |
|
97 | { |
|
98 | 0 | return depth; |
99 | } |
|
100 | ||
101 | /* (non-Javadoc) |
|
102 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setDepth(int) |
|
103 | */ |
|
104 | public void setDepth(int depth) |
|
105 | { |
|
106 | 0 | this.depth = depth; |
107 | 0 | } |
108 | ||
109 | /* (non-Javadoc) |
|
110 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getPaths() |
|
111 | */ |
|
112 | public boolean isPaths() |
|
113 | { |
|
114 | 0 | return paths; |
115 | } |
|
116 | ||
117 | /* (non-Javadoc) |
|
118 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setPaths(boolean) |
|
119 | */ |
|
120 | public void setPaths(boolean paths) |
|
121 | { |
|
122 | 0 | this.paths = paths; |
123 | 0 | } |
124 | ||
125 | /* (non-Javadoc) |
|
126 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getRegexp() |
|
127 | */ |
|
128 | public boolean isRegexp() |
|
129 | { |
|
130 | 0 | return regexp; |
131 | } |
|
132 | ||
133 | /* (non-Javadoc) |
|
134 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setRegexp(boolean) |
|
135 | */ |
|
136 | public void setRegexp(boolean regexp) |
|
137 | { |
|
138 | 0 | this.regexp = regexp; |
139 | 0 | } |
140 | ||
141 | /* (non-Javadoc) |
|
142 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getProfile() |
|
143 | */ |
|
144 | public String getProfile() |
|
145 | { |
|
146 | 0 | return profile; |
147 | } |
|
148 | ||
149 | /* (non-Javadoc) |
|
150 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setProfile(java.lang.String) |
|
151 | */ |
|
152 | public void setProfile(String locatorName) |
|
153 | { |
|
154 | 0 | profile = locatorName; |
155 | 0 | } |
156 | ||
157 | /* (non-Javadoc) |
|
158 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getOrder() |
|
159 | */ |
|
160 | public String getOrder() |
|
161 | { |
|
162 | 0 | return order; |
163 | } |
|
164 | ||
165 | /* (non-Javadoc) |
|
166 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setOrder(java.lang.String) |
|
167 | */ |
|
168 | public void setOrder(String order) |
|
169 | { |
|
170 | 0 | this.order = order; |
171 | 0 | } |
172 | ||
173 | /* (non-Javadoc) |
|
174 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getSkin() |
|
175 | */ |
|
176 | public String getSkin() |
|
177 | { |
|
178 | 0 | return skin; |
179 | } |
|
180 | ||
181 | /* (non-Javadoc) |
|
182 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setSkin(java.lang.String) |
|
183 | */ |
|
184 | public void setSkin(String name) |
|
185 | { |
|
186 | 0 | skin = name; |
187 | 0 | } |
188 | ||
189 | /* (non-Javadoc) |
|
190 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getTitle() |
|
191 | */ |
|
192 | public String getTitle() |
|
193 | { |
|
194 | 0 | return title; |
195 | } |
|
196 | ||
197 | /* (non-Javadoc) |
|
198 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setTitle(java.lang.String) |
|
199 | */ |
|
200 | public void setTitle(String title) |
|
201 | { |
|
202 | 0 | this.title = title; |
203 | 0 | } |
204 | ||
205 | /* (non-Javadoc) |
|
206 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getShortTitle() |
|
207 | */ |
|
208 | public String getShortTitle() |
|
209 | { |
|
210 | 0 | return shortTitle; |
211 | } |
|
212 | ||
213 | /* (non-Javadoc) |
|
214 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setShortTitle(java.lang.String) |
|
215 | */ |
|
216 | public void setShortTitle(String title) |
|
217 | { |
|
218 | 0 | this.shortTitle = title; |
219 | 0 | } |
220 | ||
221 | /* (non-Javadoc) |
|
222 | * @see org.apache.jetspeed.om.folder.MenuDefinition#getMenuElements() |
|
223 | */ |
|
224 | public abstract List getMenuElements(); |
|
225 | ||
226 | /* (non-Javadoc) |
|
227 | * @see org.apache.jetspeed.om.folder.MenuDefinition#setMenuElements(java.util.List) |
|
228 | */ |
|
229 | public void setMenuElements(List elements) |
|
230 | { |
|
231 | // set menu elements by replacing |
|
232 | // existing entries with new elements if |
|
233 | // new collection is specified |
|
234 | 0 | List menuElements = getMenuElements(); |
235 | 0 | if (elements != menuElements) |
236 | { |
|
237 | // replace all menu elements |
|
238 | 0 | menuElements.clear(); |
239 | 0 | if (elements != null) |
240 | { |
|
241 | 0 | menuElements.addAll(elements); |
242 | } |
|
243 | } |
|
244 | 0 | } |
245 | ||
246 | /* (non-Javadoc) |
|
247 | * @see java.lang.Object#equals(java.lang.Object) |
|
248 | */ |
|
249 | public boolean equals(Object o) |
|
250 | { |
|
251 | 0 | if (o instanceof BaseMenuDefinitionImpl) |
252 | { |
|
253 | 0 | if (name != null) |
254 | { |
|
255 | 0 | return name.equals(((BaseMenuDefinitionImpl)o).getName()); |
256 | } |
|
257 | else |
|
258 | { |
|
259 | 0 | return (((BaseMenuDefinitionImpl)o).getName() == null); |
260 | } |
|
261 | } |
|
262 | 0 | return false; |
263 | } |
|
264 | ||
265 | /* (non-Javadoc) |
|
266 | * @see java.lang.Object#hashCode() |
|
267 | */ |
|
268 | public int hashCode() |
|
269 | { |
|
270 | 0 | if (name != null) |
271 | { |
|
272 | 0 | return name.hashCode(); |
273 | } |
|
274 | 0 | return 0; |
275 | } |
|
276 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |