1 109 package com.ivata.groupware.business.addressbook.person.group; 110 111 import java.util.HashSet ; 112 import java.util.Set ; 113 114 import org.apache.log4j.Logger; 115 116 import com.ivata.groupware.business.addressbook.person.PersonDO; 117 import com.ivata.groupware.container.persistence.NamedDO; 118 import com.ivata.groupware.web.tree.TreeNode; 119 120 135 public class GroupDO extends NamedDO implements TreeNode { 136 139 private static Logger logger = Logger.getLogger(GroupDO.class); 140 144 private String description; 145 146 151 private PersonDO head; 152 153 157 private String name; 158 161 private GroupDO parent; 162 163 166 private Set people = new HashSet (); 167 168 171 private Set users = new HashSet (); 172 173 181 public final GroupDO getAddressBook() { 182 assert (parent != null); 184 if (GroupConstants.equals(getId(), GroupConstants.ADDRESS_BOOK) 185 || GroupConstants.equals(GroupConstants.ADDRESS_BOOK, 186 parent.getId())) { 187 return this; 188 } 189 GroupDO addressBook = this; 190 assert (addressBook.parent.parent != null); 191 192 while (!GroupConstants.equals( 194 addressBook.parent.parent.getId(), 195 GroupConstants.ADDRESS_BOOK)) { 196 addressBook = addressBook.parent; 197 if (addressBook.parent.parent == null) { 201 throw new NullPointerException ("ERROR in GroupDO: the group " 202 + "hierarchy is invalid: group '" 203 + name 204 + "' (" 205 + getId() 206 + ") has no address book as a parent."); 207 } 208 } 209 return addressBook; 210 } 211 212 220 public final String getDescription() { 221 return description; 222 } 223 224 231 public final String getDisplayValue() { 232 return name; 233 } 234 235 243 public PersonDO getHead() { 244 return head; 245 } 246 255 public final String getName() { 256 return name; 257 } 258 259 268 public final GroupDO getParent () { 269 return parent; 270 } 271 272 284 public final Set getPeople() { 285 return people; 286 } 287 288 302 public final Set getUsers() { 303 return users; 304 } 305 306 313 public final void setDescription(final String description) { 314 this.description = description; 315 } 316 323 public void setHead(PersonDO headParam) { 324 if (logger.isDebugEnabled()) { 325 logger.debug("setHead before: '" + head + "', after: '" 326 + headParam + "'"); 327 } 328 329 head = headParam; 330 } 331 337 public void setName(String nameParam) { 338 if (logger.isDebugEnabled()) { 339 logger.debug("setName before: '" + name + "', after: '" 340 + nameParam + "'"); 341 } 342 343 name = nameParam; 344 } 345 350 public void setParent(GroupDO parentParam) { 351 if (logger.isDebugEnabled()) { 352 logger.debug("setParent before: '" + parent 353 + "', after: '" + parentParam + "'"); 354 } 355 356 parent = parentParam; 357 } 358 363 public void setPeople(Set peopleParam) { 364 if (logger.isDebugEnabled()) { 365 logger.debug("setPeople before: '" + people 366 + "', after: '" + peopleParam + "'"); 367 } 368 369 people = peopleParam; 370 } 371 376 public void setUsers(Set usersParam) { 377 if (logger.isDebugEnabled()) { 378 logger.debug("setUsers before: '" + users 379 + "', after: '" + usersParam+ "'"); 380 } 381 382 users = usersParam; 383 } 384 } 385 | Popular Tags |