001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.Address;
023    import com.liferay.portal.model.Country;
024    import com.liferay.portal.model.ListType;
025    import com.liferay.portal.model.Phone;
026    import com.liferay.portal.model.Region;
027    import com.liferay.portal.model.User;
028    
029    import java.util.Calendar;
030    import java.util.Date;
031    import java.util.GregorianCalendar;
032    import java.util.List;
033    
034    /**
035     * @author Brian Wing Shun Chan
036     */
037    public class UserAttributes {
038    
039            // Mandatory Liferay attributes
040    
041            public static final String LIFERAY_COMPANY_ID = "liferay.company.id";
042    
043            public static final String LIFERAY_USER_ID = "liferay.user.id";
044    
045            public static final String USER_NAME_FULL = "user.name.full";
046    
047            // See page 249 of the JSR 286 spec
048    
049            public static final String USER_BDATE = "user.bdate";
050    
051            public static final String USER_BDATE_DAY = "user.bdate.ymd.day";
052    
053            public static final String USER_BDATE_FRACTIONSECOND =
054                    "user.bdate.fractionsecond";
055    
056            public static final String USER_BDATE_HOUR = "user.bdate.hms.hour";
057    
058            public static final String USER_BDATE_MINUTE = "user.bdate.hms.minute";
059    
060            public static final String USER_BDATE_MONTH = "user.bdate.ymd.month";
061    
062            public static final String USER_BDATE_SECOND = "user.bdate.hms.second";
063    
064            public static final String USER_BDATE_TIMEZONE = "user.bdate.timezone";
065    
066            public static final String USER_BDATE_YEAR = "user.bdate.ymd.year";
067    
068            public static final String USER_GENDER = "user.gender";
069    
070            public static final String USER_EMPLOYER = "user.employer";
071    
072            public static final String USER_DEPARTMENT = "user.department";
073    
074            public static final String USER_JOBTITLE = "user.jobtitle";
075    
076            public static final String USER_NAME_PREFIX = "user.name.prefix";
077    
078            public static final String USER_NAME_GIVEN = "user.name.given";
079    
080            public static final String USER_NAME_FAMILY = "user.name.family";
081    
082            public static final String USER_NAME_MIDDLE = "user.name.middle";
083    
084            public static final String USER_NAME_SUFFIX = "user.name.suffix";
085    
086            public static final String USER_NAME_NICKNAME = "user.name.nickName";
087    
088            public static final String USER_HOME_INFO_POSTAL_NAME =
089                    "user.home-info.postal.name";
090    
091            public static final String USER_HOME_INFO_POSTAL_STREET =
092                    "user.home-info.postal.street";
093    
094            public static final String USER_HOME_INFO_POSTAL_CITY =
095                    "user.home-info.postal.city";
096    
097            public static final String USER_HOME_INFO_POSTAL_STATEPROV =
098                    "user.home-info.postal.stateprov";
099    
100            public static final String USER_HOME_INFO_POSTAL_POSTALCODE =
101                    "user.home-info.postal.postalcode";
102    
103            public static final String USER_HOME_INFO_POSTAL_COUNTRY =
104                    "user.home-info.postal.country";
105    
106            public static final String USER_HOME_INFO_POSTAL_ORGANIZATION =
107                    "user.home-info.postal.organization";
108    
109            public static final String USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE =
110                    "user.home-info.telecom.telephone.intcode";
111    
112            public static final String USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE =
113                    "user.home-info.telecom.telephone.loccode";
114    
115            public static final String USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER =
116                    "user.home-info.telecom.telephone.number";
117    
118            public static final String USER_HOME_INFO_TELECOM_TELEPHONE_EXT =
119                    "user.home-info.telecom.telephone.ext";
120    
121            public static final String USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT =
122                    "user.home-info.telecom.telephone.comment";
123    
124            public static final String USER_HOME_INFO_TELECOM_FAX_INTCODE =
125                    "user.home-info.telecom.fax.intcode";
126    
127            public static final String USER_HOME_INFO_TELECOM_FAX_LOCCODE =
128                    "user.home-info.telecom.fax.loccode";
129    
130            public static final String USER_HOME_INFO_TELECOM_FAX_NUMBER =
131                    "user.home-info.telecom.fax.number";
132    
133            public static final String USER_HOME_INFO_TELECOM_FAX_EXT =
134                    "user.home-info.telecom.fax.ext";
135    
136            public static final String USER_HOME_INFO_TELECOM_FAX_COMMENT =
137                    "user.home-info.telecom.fax.comment";
138    
139            public static final String USER_HOME_INFO_TELECOM_MOBILE_INTCODE =
140                    "user.home-info.telecom.mobile.intcode";
141    
142            public static final String USER_HOME_INFO_TELECOM_MOBILE_LOCCODE =
143                    "user.home-info.telecom.mobile.loccode";
144    
145            public static final String USER_HOME_INFO_TELECOM_MOBILE_NUMBER =
146                    "user.home-info.telecom.mobile.number";
147    
148            public static final String USER_HOME_INFO_TELECOM_MOBILE_EXT =
149                    "user.home-info.telecom.mobile.ext";
150    
151            public static final String USER_HOME_INFO_TELECOM_MOBILE_COMMENT =
152                    "user.home-info.telecom.mobile.comment";
153    
154            public static final String USER_HOME_INFO_TELECOM_PAGER_INTCODE =
155                    "user.home-info.telecom.pager.intcode";
156    
157            public static final String USER_HOME_INFO_TELECOM_PAGER_LOCCODE =
158                    "user.home-info.telecom.pager.loccode";
159    
160            public static final String USER_HOME_INFO_TELECOM_PAGER_NUMBER =
161                    "user.home-info.telecom.pager.number";
162    
163            public static final String USER_HOME_INFO_TELECOM_PAGER_EXT =
164                    "user.home-info.telecom.pager.ext";
165    
166            public static final String USER_HOME_INFO_TELECOM_PAGER_COMMENT =
167                    "user.home-info.telecom.pager.comment";
168    
169            public static final String USER_HOME_INFO_ONLINE_EMAIL =
170                    "user.home-info.online.email";
171    
172            public static final String USER_HOME_INFO_ONLINE_URI =
173                    "user.home-info.online.uri";
174    
175            public static final String USER_BUSINESS_INFO_POSTAL_NAME =
176                    "user.business-info.postal.name";
177    
178            public static final String USER_BUSINESS_INFO_POSTAL_STREET =
179                    "user.business-info.postal.street";
180    
181            public static final String USER_BUSINESS_INFO_POSTAL_CITY =
182                    "user.business-info.postal.city";
183    
184            public static final String USER_BUSINESS_INFO_POSTAL_STATEPROV =
185                    "user.business-info.postal.stateprov";
186    
187            public static final String USER_BUSINESS_INFO_POSTAL_POSTALCODE =
188                    "user.business-info.postal.postalcode";
189    
190            public static final String USER_BUSINESS_INFO_POSTAL_COUNTRY =
191                    "user.business-info.postal.country";
192    
193            public static final String USER_BUSINESS_INFO_POSTAL_ORGANIZATION =
194                    "user.business-info.postal.organization";
195    
196            public static final String USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE =
197                    "user.business-info.telecom.telephone.intcode";
198    
199            public static final String USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE =
200                    "user.business-info.telecom.telephone.loccode";
201    
202            public static final String USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER =
203                    "user.business-info.telecom.telephone.number";
204    
205            public static final String USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT =
206                    "user.business-info.telecom.telephone.ext";
207    
208            public static final String USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT =
209                    "user.business-info.telecom.telephone.comment";
210    
211            public static final String USER_BUSINESS_INFO_TELECOM_FAX_INTCODE =
212                    "user.business-info.telecom.fax.intcode";
213    
214            public static final String USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE =
215                    "user.business-info.telecom.fax.loccode";
216    
217            public static final String USER_BUSINESS_INFO_TELECOM_FAX_NUMBER =
218                    "user.business-info.telecom.fax.number";
219    
220            public static final String USER_BUSINESS_INFO_TELECOM_FAX_EXT =
221                    "user.business-info.telecom.fax.ext";
222    
223            public static final String USER_BUSINESS_INFO_TELECOM_FAX_COMMENT =
224                    "user.business-info.telecom.fax.comment";
225    
226            public static final String USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE =
227                    "user.business-info.telecom.mobile.intcode";
228    
229            public static final String USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE =
230                    "user.business-info.telecom.mobile.loccode";
231    
232            public static final String USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER =
233                    "user.business-info.telecom.mobile.number";
234    
235            public static final String USER_BUSINESS_INFO_TELECOM_MOBILE_EXT =
236                    "user.business-info.telecom.mobile.ext";
237    
238            public static final String USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT =
239                    "user.business-info.telecom.mobile.comment";
240    
241            public static final String USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE =
242                    "user.business-info.telecom.pager.intcode";
243    
244            public static final String USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE =
245                    "user.business-info.telecom.pager.loccode";
246    
247            public static final String USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER =
248                    "user.business-info.telecom.pager.number";
249    
250            public static final String USER_BUSINESS_INFO_TELECOM_PAGER_EXT =
251                    "user.business-info.telecom.pager.ext";
252    
253            public static final String USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT =
254                    "user.business-info.telecom.pager.comment";
255    
256            public static final String USER_BUSINESS_INFO_ONLINE_EMAIL =
257                    "user.business-info.online.email";
258    
259            public static final String USER_BUSINESS_INFO_ONLINE_URI =
260                    "user.business-info.online.uri";
261    
262            public static final String USER_LOGIN_ID = "user.login.id";
263    
264            public UserAttributes(User user) {
265                    _user = user;
266    
267                    try {
268                            List<Address> addresses = user.getAddresses();
269    
270                            for (Address address : addresses) {
271                                    ListType listType = address.getType();
272    
273                                    String listTypeName = listType.getName();
274    
275                                    if (listTypeName.equals("business")) {
276                                            _businessAddress = address;
277                                    }
278                                    else if (listTypeName.equals("personal")) {
279                                            _personalAddress = address;
280                                    }
281                            }
282    
283                            List<Phone> phones = user.getPhones();
284    
285                            for (Phone phone : phones) {
286                                    ListType listType = phone.getType();
287    
288                                    String listTypeName = listType.getName();
289    
290                                    if (listTypeName.equals("business")) {
291                                            _businessPhone = phone;
292                                    }
293                                    else if (listTypeName.equals("business-fax")) {
294                                            _businessFaxPhone = phone;
295                                    }
296                                    else if (listTypeName.equals("mobile-phone")) {
297                                            _mobilePhone = phone;
298                                    }
299                                    else if (listTypeName.equals("pager")) {
300                                            _pagerPhone = phone;
301                                    }
302                                    else if (listTypeName.equals("personal")) {
303                                            _personalPhone = phone;
304                                    }
305                                    else if (listTypeName.equals("personal-fax")) {
306                                            _personalFaxPhone = phone;
307                                    }
308                            }
309                    }
310                    catch (Exception e) {
311                            _log.error(e, e);
312                    }
313            }
314    
315            public String getValue(String name)
316                    throws PortalException, SystemException {
317    
318                    if (name == null) {
319                            return null;
320                    }
321    
322                    if (name.equals(LIFERAY_COMPANY_ID)) {
323                            return String.valueOf(_user.getCompanyId());
324                    }
325                    else if (name.equals(LIFERAY_USER_ID)) {
326                            return String.valueOf(_user.getUserId());
327                    }
328                    else if (name.equals(USER_NAME_FULL)) {
329                            return _user.getFullName();
330                    }
331                    else if (name.equals(USER_BDATE)) {
332                            Date birthday = _user.getBirthday();
333    
334                            return birthday.toString();
335                    }
336                    else if (name.equals(USER_BDATE_DAY)) {
337                            Date birthday = _user.getBirthday();
338    
339                            if (birthday != null) {
340                                    _calendar.setTime(birthday);
341    
342                                    return String.valueOf(_calendar.get(Calendar.DATE));
343                            }
344    
345                            return null;
346                    }
347                    else if (name.equals(USER_BDATE_FRACTIONSECOND)) {
348                            Date birthday = _user.getBirthday();
349    
350                            if (birthday != null) {
351                                    _calendar.setTime(birthday);
352    
353                                    return String.valueOf(_calendar.get(Calendar.MILLISECOND));
354                            }
355    
356                            return null;
357                    }
358                    else if (name.equals(USER_BDATE_HOUR)) {
359                            Date birthday = _user.getBirthday();
360    
361                            if (birthday != null) {
362                                    _calendar.setTime(birthday);
363    
364                                    return String.valueOf(_calendar.get(Calendar.HOUR));
365                            }
366    
367                            return null;
368                    }
369                    else if (name.equals(USER_BDATE_MINUTE)) {
370                            Date birthday = _user.getBirthday();
371    
372                            if (birthday != null) {
373                                    _calendar.setTime(birthday);
374    
375                                    return String.valueOf(_calendar.get(Calendar.MINUTE));
376                            }
377    
378                            return null;
379                    }
380                    else if (name.equals(USER_BDATE_MONTH)) {
381                            Date birthday = _user.getBirthday();
382    
383                            if (birthday != null) {
384                                    _calendar.setTime(birthday);
385    
386                                    return String.valueOf(_calendar.get(Calendar.MONTH) + 1);
387                            }
388    
389                            return null;
390                    }
391                    else if (name.equals(USER_BDATE_SECOND)) {
392                            Date birthday = _user.getBirthday();
393    
394                            if (birthday != null) {
395                                    _calendar.setTime(birthday);
396    
397                                    return String.valueOf(_calendar.get(Calendar.SECOND));
398                            }
399    
400                            return null;
401                    }
402                    else if (name.equals(USER_BDATE_TIMEZONE)) {
403                            Date birthday = _user.getBirthday();
404    
405                            if (birthday != null) {
406                                    _calendar.setTime(birthday);
407    
408                                    return String.valueOf(_calendar.get(Calendar.ZONE_OFFSET));
409                            }
410    
411                            return null;
412                    }
413                    else if (name.equals(USER_BDATE_YEAR)) {
414                            Date birthday = _user.getBirthday();
415    
416                            if (birthday != null) {
417                                    _calendar.setTime(birthday);
418    
419                                    return String.valueOf(_calendar.get(Calendar.YEAR));
420                            }
421    
422                            return null;
423                    }
424                    else if (name.equals(USER_GENDER)) {
425                            return _user.isMale() ? "male" : "female";
426                    }
427                    else if (name.equals(USER_EMPLOYER)) {
428                            return StringPool.BLANK;
429                    }
430                    else if (name.equals(USER_DEPARTMENT)) {
431                            return StringPool.BLANK;
432                    }
433                    else if (name.equals(USER_JOBTITLE)) {
434                            return _user.getJobTitle();
435                    }
436                    else if (name.equals(USER_NAME_PREFIX)) {
437                            return StringPool.BLANK;
438                    }
439                    else if (name.equals(USER_NAME_GIVEN)) {
440                            return _user.getFirstName();
441                    }
442                    else if (name.equals(USER_NAME_FAMILY)) {
443                            return _user.getLastName();
444                    }
445                    else if (name.equals(USER_NAME_MIDDLE)) {
446                            return _user.getMiddleName();
447                    }
448                    else if (name.equals(USER_NAME_SUFFIX)) {
449                            return StringPool.BLANK;
450                    }
451                    else if (name.equals(USER_NAME_NICKNAME)) {
452                            return _user.getScreenName();
453                    }
454                    else if (name.equals(USER_LOGIN_ID)) {
455                            return _user.getScreenName();
456                    }
457                    else if (name.equals(USER_HOME_INFO_POSTAL_NAME)) {
458                            return StringPool.BLANK;
459                    }
460                    else if (name.equals(USER_HOME_INFO_POSTAL_STREET)) {
461                            if (_personalAddress != null) {
462                                    return _personalAddress.getStreet1();
463                            }
464    
465                            return StringPool.BLANK;
466                    }
467                    else if (name.equals(USER_HOME_INFO_POSTAL_CITY)) {
468                            if (_personalAddress != null) {
469                                    return _personalAddress.getCity();
470                            }
471    
472                            return StringPool.BLANK;
473                    }
474                    else if (name.equals(USER_HOME_INFO_POSTAL_STATEPROV)) {
475                            if (_personalAddress != null) {
476                                    Region region = _personalAddress.getRegion();
477    
478                                    return String.valueOf(region.getRegionCode());
479                            }
480    
481                            return StringPool.BLANK;
482                    }
483                    else if (name.equals(USER_HOME_INFO_POSTAL_POSTALCODE)) {
484                            if (_personalAddress != null) {
485                                    return _personalAddress.getZip();
486                            }
487    
488                            return StringPool.BLANK;
489                    }
490                    else if (name.equals(USER_HOME_INFO_POSTAL_COUNTRY)) {
491                            if (_personalAddress != null) {
492                                    Country country = _personalAddress.getCountry();
493    
494                                    return String.valueOf(country.getName());
495                            }
496    
497                            return StringPool.BLANK;
498                    }
499                    else if (name.equals(USER_HOME_INFO_POSTAL_ORGANIZATION)) {
500                            return StringPool.BLANK;
501                    }
502                    else if (name.equals(USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE)) {
503                            return StringPool.BLANK;
504                    }
505                    else if (name.equals(USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE)) {
506                            return StringPool.BLANK;
507                    }
508                    else if (name.equals(USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER)) {
509                            if (_personalPhone != null) {
510                                    return _personalPhone.getNumber();
511                            }
512    
513                            return StringPool.BLANK;
514                    }
515                    else if (name.equals(USER_HOME_INFO_TELECOM_TELEPHONE_EXT)) {
516                            if (_personalPhone != null) {
517                                    return _personalPhone.getExtension();
518                            }
519    
520                            return StringPool.BLANK;
521                    }
522                    else if (name.equals(USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT)) {
523                            return StringPool.BLANK;
524                    }
525                    else if (name.equals(USER_HOME_INFO_TELECOM_FAX_INTCODE)) {
526                            return StringPool.BLANK;
527                    }
528                    else if (name.equals(USER_HOME_INFO_TELECOM_FAX_LOCCODE)) {
529                            return StringPool.BLANK;
530                    }
531                    else if (name.equals(USER_HOME_INFO_TELECOM_FAX_NUMBER)) {
532                            if (_personalFaxPhone != null) {
533                                    return _personalFaxPhone.getNumber();
534                            }
535    
536                            return StringPool.BLANK;
537                    }
538                    else if (name.equals(USER_HOME_INFO_TELECOM_FAX_EXT)) {
539                            if (_personalFaxPhone != null) {
540                                    return _personalFaxPhone.getExtension();
541                            }
542    
543                            return StringPool.BLANK;
544                    }
545                    else if (name.equals(USER_HOME_INFO_TELECOM_FAX_COMMENT)) {
546                            return StringPool.BLANK;
547                    }
548                    else if (name.equals(USER_HOME_INFO_TELECOM_MOBILE_INTCODE)) {
549                            return StringPool.BLANK;
550                    }
551                    else if (name.equals(USER_HOME_INFO_TELECOM_MOBILE_LOCCODE)) {
552                            return StringPool.BLANK;
553                    }
554                    else if (name.equals(USER_HOME_INFO_TELECOM_MOBILE_NUMBER)) {
555                            if (_mobilePhone != null) {
556                                    return _mobilePhone.getNumber();
557                            }
558    
559                            return StringPool.BLANK;
560                    }
561                    else if (name.equals(USER_HOME_INFO_TELECOM_MOBILE_EXT)) {
562                            if (_mobilePhone != null) {
563                                    return _mobilePhone.getExtension();
564                            }
565    
566                            return StringPool.BLANK;
567                    }
568                    else if (name.equals(USER_HOME_INFO_TELECOM_MOBILE_COMMENT)) {
569                            return StringPool.BLANK;
570                    }
571                    else if (name.equals(USER_HOME_INFO_TELECOM_PAGER_INTCODE)) {
572                            return StringPool.BLANK;
573                    }
574                    else if (name.equals(USER_HOME_INFO_TELECOM_PAGER_LOCCODE)) {
575                            return StringPool.BLANK;
576                    }
577                    else if (name.equals(USER_HOME_INFO_TELECOM_PAGER_NUMBER)) {
578                            if (_pagerPhone != null) {
579                                    return _pagerPhone.getNumber();
580                            }
581    
582                            return StringPool.BLANK;
583                    }
584                    else if (name.equals(USER_HOME_INFO_TELECOM_PAGER_EXT)) {
585                            if (_pagerPhone != null) {
586                                    return _pagerPhone.getExtension();
587                            }
588    
589                            return StringPool.BLANK;
590                    }
591                    else if (name.equals(USER_HOME_INFO_TELECOM_PAGER_COMMENT)) {
592                            return StringPool.BLANK;
593                    }
594                    else if (name.equals(USER_HOME_INFO_ONLINE_EMAIL)) {
595                            return _user.getEmailAddress();
596                    }
597                    else if (name.equals(USER_HOME_INFO_ONLINE_URI)) {
598                            return StringPool.BLANK;
599                    }
600                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_NAME)) {
601                            return StringPool.BLANK;
602                    }
603                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_STREET)) {
604                            if (_businessAddress != null) {
605                                    return _businessAddress.getStreet1();
606                            }
607    
608                            return StringPool.BLANK;
609                    }
610                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_CITY)) {
611                            if (_businessAddress != null) {
612                                    return _businessAddress.getCity();
613                            }
614    
615                            return StringPool.BLANK;
616                    }
617                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_STATEPROV)) {
618                            if (_businessAddress != null) {
619                                    Region region = _businessAddress.getRegion();
620    
621                                    return String.valueOf(region.getRegionCode());
622                            }
623    
624                            return StringPool.BLANK;
625                    }
626                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_POSTALCODE)) {
627                            if (_businessAddress != null) {
628                                    return _businessAddress.getZip();
629                            }
630    
631                            return StringPool.BLANK;
632                    }
633                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_COUNTRY)) {
634                            if (_businessAddress != null) {
635                                    Country country = _businessAddress.getCountry();
636    
637                                    return String.valueOf(country.getName());
638                            }
639    
640                            return StringPool.BLANK;
641                    }
642                    else if (name.equals(USER_BUSINESS_INFO_POSTAL_ORGANIZATION)) {
643                            return StringPool.BLANK;
644                    }
645                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE)) {
646                            return StringPool.BLANK;
647                    }
648                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE)) {
649                            return StringPool.BLANK;
650                    }
651                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER)) {
652                            if (_businessPhone != null) {
653                                    return _businessPhone.getNumber();
654                            }
655    
656                            return StringPool.BLANK;
657                    }
658                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT)) {
659                            if (_businessPhone != null) {
660                                    return _businessPhone.getExtension();
661                            }
662    
663                            return StringPool.BLANK;
664                    }
665                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT)) {
666                            return StringPool.BLANK;
667                    }
668                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_FAX_INTCODE)) {
669                            return StringPool.BLANK;
670                    }
671                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE)) {
672                            return StringPool.BLANK;
673                    }
674                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_FAX_NUMBER)) {
675                            if (_businessFaxPhone != null) {
676                                    return _businessFaxPhone.getNumber();
677                            }
678    
679                            return StringPool.BLANK;
680                    }
681                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_FAX_EXT)) {
682                            if (_businessFaxPhone != null) {
683                                    return _businessFaxPhone.getExtension();
684                            }
685    
686                            return StringPool.BLANK;
687                    }
688                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_FAX_COMMENT)) {
689                            return StringPool.BLANK;
690                    }
691                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE)) {
692                            return StringPool.BLANK;
693                    }
694                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE)) {
695                            return StringPool.BLANK;
696                    }
697                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER)) {
698                            if (_mobilePhone != null) {
699                                    return _mobilePhone.getNumber();
700                            }
701    
702                            return StringPool.BLANK;
703                    }
704                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_MOBILE_EXT)) {
705                            if (_mobilePhone != null) {
706                                    return _mobilePhone.getExtension();
707                            }
708    
709                            return StringPool.BLANK;
710                    }
711                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT)) {
712                            return StringPool.BLANK;
713                    }
714                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE)) {
715                            return StringPool.BLANK;
716                    }
717                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE)) {
718                            return StringPool.BLANK;
719                    }
720                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER)) {
721                            if (_pagerPhone != null) {
722                                    return _pagerPhone.getNumber();
723                            }
724    
725                            return StringPool.BLANK;
726                    }
727                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_PAGER_EXT)) {
728                            if (_pagerPhone != null) {
729                                    return _pagerPhone.getExtension();
730                            }
731    
732                            return StringPool.BLANK;
733                    }
734                    else if (name.equals(USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT)) {
735                            return StringPool.BLANK;
736                    }
737                    else if (name.equals(USER_BUSINESS_INFO_ONLINE_EMAIL)) {
738                            return _user.getEmailAddress();
739                    }
740                    else if (name.equals(USER_BUSINESS_INFO_ONLINE_URI)) {
741                            return StringPool.BLANK;
742                    }
743                    else {
744                            return null;
745                    }
746            }
747    
748            private static Log _log = LogFactoryUtil.getLog(UserAttributes.class);
749    
750            private Address _businessAddress;
751            private Phone _businessFaxPhone;
752            private Phone _businessPhone;
753            private Calendar _calendar = new GregorianCalendar();
754            private Phone _mobilePhone;
755            private Phone _pagerPhone;
756            private Address _personalAddress;
757            private Phone _personalFaxPhone;
758            private Phone _personalPhone;
759            private User _user;
760    
761    }