1 135 package com.ivata.groupware.business.addressbook.person; 136 137 138 import java.util.Date ; 139 import java.util.HashSet ; 140 import java.util.Iterator ; 141 import java.util.Set ; 142 143 import com.ivata.groupware.admin.security.user.UserDO; 144 import com.ivata.groupware.business.addressbook.address.AddressDO; 145 import com.ivata.groupware.business.addressbook.person.employee.EmployeeDO; 146 import com.ivata.groupware.business.addressbook.person.group.GroupDO; 147 import com.ivata.groupware.business.addressbook.telecomaddress.TelecomAddressConstants; 148 import com.ivata.groupware.business.addressbook.telecomaddress.TelecomAddressDO; 149 import com.ivata.groupware.container.persistence.NamedDO; 150 import com.ivata.mask.util.StringHandling; 151 152 153 175 public class PersonDO extends NamedDO implements Comparable { 176 179 private AddressDO address; 180 181 184 private String company; 185 186 189 private Date dateOfBirth; 190 191 197 private boolean deleted; 198 199 202 private EmployeeDO employee = null; 203 204 207 private String fileAs; 208 209 212 private String firstNames; 213 214 217 private GroupDO group; 218 219 222 private String jobTitle; 223 224 227 private String lastName; 228 229 233 private String salutation; 234 235 238 private Set telecomAddresses = new HashSet (); 239 240 243 private UserDO user; 244 245 253 public AddressDO getAddress() { 254 return address; 255 } 256 257 264 public final String getCompany() { 265 return company; 266 } 267 268 275 public final Date getDateOfBirth() { 276 return dateOfBirth; 277 } 278 279 286 public final String getDisplayValue() { 287 StringBuffer displayValue = new StringBuffer (); 288 if (!StringHandling.isNullOrEmpty(firstNames)) { 289 displayValue.append(firstNames); 290 } 291 if (!StringHandling.isNullOrEmpty(firstNames)) { 292 if (displayValue.length() > 0) { 293 displayValue.append(" "); 294 } 295 displayValue.append(lastName); 296 } 297 return displayValue.toString(); 298 } 299 300 315 public final String getEmailAddress() { 316 String firstEmailAddress = null; 317 for (Iterator telecomAddressIterator = telecomAddresses.iterator(); telecomAddressIterator.hasNext();) { 318 TelecomAddressDO address = (TelecomAddressDO) telecomAddressIterator.next(); 319 if (address.getType() == TelecomAddressConstants.TYPE_EMAIL) { 320 firstEmailAddress = address.getAddress(); 321 break; 322 } 323 } 324 if (firstEmailAddress == null) { 326 return null; 327 } 328 329 StringBuffer formattedEmailAddress = new StringBuffer (); 331 if (!StringHandling.isNullOrEmpty(firstNames)) { 332 formattedEmailAddress.append(firstNames); 333 } 334 if (!StringHandling.isNullOrEmpty(lastName)) { 335 if (formattedEmailAddress.length() > 0) { 336 formattedEmailAddress.append(" "); 337 } 338 formattedEmailAddress.append(lastName); 339 } 340 if (formattedEmailAddress.length() > 0) { 341 formattedEmailAddress.append(" "); 342 } 343 formattedEmailAddress.append("<"); 344 formattedEmailAddress.append(firstEmailAddress); 345 formattedEmailAddress.append(">"); 346 347 return formattedEmailAddress.toString(); 348 } 349 350 359 public final EmployeeDO getEmployee() { 360 return employee; 361 } 362 363 370 public final String getFileAs() { 371 return fileAs; 372 } 373 374 381 public final String getFirstNames() { 382 return firstNames; 383 } 384 385 393 public final GroupDO getGroup() { 394 return group; 395 } 396 403 public final String getJobTitle() { 404 return jobTitle; 405 } 406 407 414 public final String getLastName() { 415 return lastName; 416 } 417 418 426 public final String getName() { 427 return fileAs; 428 } 429 430 439 public final String getSalutation() { 440 return salutation; 441 } 442 443 456 public final Set getTelecomAddresses() { 457 return telecomAddresses; 458 } 459 460 468 public UserDO getUser() { 469 return user; 470 } 471 472 476 public boolean isDeleted() { 477 return deleted; 478 } 479 480 483 public final void setAddress(final AddressDO address) { 484 this.address = address; 485 } 486 491 public final void setCompany(final String company) { 492 this.company = company; 493 } 494 495 500 public final void setDateOfBirth(final java.util.Date dateOfBirth) { 501 this.dateOfBirth = dateOfBirth; 502 } 503 506 public void setDeleted(boolean deletedParam) { 507 deleted = deletedParam; 508 } 509 510 516 public final void setEmployee(final com.ivata.groupware.business.addressbook.person.employee.EmployeeDO employee) { 517 this.employee = employee; 518 } 519 520 525 public final void setFileAs(final String fileAs) { 526 this.fileAs = fileAs; 527 } 528 529 534 public final void setFirstNames(final String firstNames) { 535 this.firstNames = firstNames; 536 } 537 538 543 public final void setGroup(final GroupDO group) { 544 this.group = group; 545 } 546 547 552 public final void setJobTitle(final String jobTitle) { 553 this.jobTitle = jobTitle; 554 } 555 556 561 public final void setLastName(final String lastName) { 562 this.lastName = lastName; 563 } 564 565 572 public final void setSalutation(final String salutation) { 573 this.salutation = salutation; 574 } 575 576 579 public final void setTelecomAddresses(final Set set) { 580 telecomAddresses = set; 581 } 582 583 589 public final void setUser(final UserDO user) { 590 this.user = user; 591 } 592 } 593 | Popular Tags |