1 16 package com.blandware.atleap.model.core; 17 18 import java.util.ArrayList ; 19 import java.util.HashMap ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 import java.util.Map ; 23 24 49 public abstract class Page extends Localizable { 50 51 53 56 protected String uri; 57 60 protected Integer usageCounter; 61 64 protected Boolean active; 65 66 69 protected Map title = new HashMap (); 70 73 protected Map keywords = new HashMap (); 74 77 protected Map description = new HashMap (); 78 79 82 protected List linkedContentFieldValues = new ArrayList (); 83 86 protected List linkedMenuItems = new ArrayList (); 87 88 91 protected List roles = new ArrayList (); 92 93 94 96 108 public String getUri() { 109 return uri; 110 } 111 112 117 public void setUri(String uri) { 118 this.uri = uri; 119 } 120 121 127 public Integer getUsageCounter() { 128 return usageCounter; 129 } 130 131 136 public void setUsageCounter(Integer usageCounter) { 137 this.usageCounter = usageCounter; 138 } 139 140 147 public Boolean getActive() { 148 return active; 149 } 150 151 156 public void setActive(Boolean active) { 157 this.active = active; 158 } 159 160 162 168 public Map getTitle() { 169 return title; 170 } 171 172 177 public void setTitle(Map title) { 178 this.title = title; 179 } 180 181 187 public Map getKeywords() { 188 return keywords; 189 } 190 191 196 public void setKeywords(Map keywords) { 197 this.keywords = keywords; 198 } 199 200 206 public Map getDescription() { 207 return description; 208 } 209 210 215 public void setDescription(Map description) { 216 this.description = description; 217 } 218 219 227 public List getLinkedContentFieldValues() { 228 return linkedContentFieldValues; 229 } 230 231 236 public void setLinkedContentFieldValues(List linkedContentFieldValues) { 237 this.linkedContentFieldValues = linkedContentFieldValues; 238 } 239 240 248 public List getLinkedMenuItems() { 249 return linkedMenuItems; 250 } 251 252 257 public void setLinkedMenuItems(List linkedMenuItems) { 258 this.linkedMenuItems = linkedMenuItems; 259 } 260 261 266 public boolean isInUse() { 267 return !linkedContentFieldValues.isEmpty() || !linkedMenuItems.isEmpty() || usageCounter.intValue() > 0; 268 } 269 270 276 public boolean doUnmodifiableLinkedObjectsExist() { 277 for (Iterator i = linkedMenuItems.iterator(); i.hasNext();) { 278 MenuItem menuItem = (MenuItem) i.next(); 279 if (!menuItem.isDynamic()) { 280 return true; 281 } 282 } 283 return false; 284 } 285 286 296 public List getRoles() { 297 return roles; 298 } 299 300 305 public void setRoles(List roles) { 306 this.roles = roles; 307 } 308 309 314 public String getRolesAsString() { 315 StringBuffer roles = new StringBuffer (); 316 if ( this.roles != null && !this.roles.isEmpty() ) { 317 for ( Iterator i = this.roles.iterator(); i.hasNext(); ) { 318 Role role = (Role) i.next(); 319 roles.append(role.getTitle()); 320 if ( i.hasNext() ) { 321 roles.append(", "); 322 } 323 } 324 } 325 return roles.toString(); 326 } 327 328 333 public void addRole(Role role) { 334 if ( !role.getPages().contains(this) ) { 335 role.getPages().add(this); 336 } 337 if ( !getRoles().contains(role) ) { 338 getRoles().add(role); 339 } 340 } 341 342 347 public void removeRole(Role role) { 348 role.getPages().remove(this); 349 getRoles().remove(role); 350 } 351 352 public boolean equals(Object o) { 353 if ( this == o ) { 354 return true; 355 } 356 if ( !(o instanceof Page) ) { 357 return false; 358 } 359 360 final Page page = (Page) o; 361 362 if ( uri != null ? !uri.equals(page.uri) : page.uri != null ) { 363 return false; 364 } 365 366 return true; 367 } 368 369 public int hashCode() { 370 return (uri != null ? uri.hashCode() : 0); 371 } 372 373 } 374 | Popular Tags |