Source Code Cross Referenced for ContactModel.java in  » Mail-Clients » columba-1.4 » org » columba » addressbook » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » columba 1.4 » org.columba.addressbook.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.addressbook.model;
019:
020:        import java.util.Date;
021:        import java.util.Iterator;
022:        import java.util.Vector;
023:
024:        import javax.swing.ImageIcon;
025:
026:        import org.columba.addressbook.facade.IContactItem;
027:        import org.columba.addressbook.parser.ParserUtil;
028:        import org.columba.core.base.UUIDGenerator;
029:        import org.columba.core.logging.Logging;
030:        import org.columba.ristretto.message.Address;
031:        import org.columba.ristretto.parser.ParserException;
032:
033:        /**
034:         * Contact model POJO.
035:         * 
036:         * @author fdietz
037:         */
038:        public class ContactModel implements  IContactModel {
039:
040:            private String id;
041:
042:            private String organisation;
043:
044:            private String department;
045:
046:            private String office;
047:
048:            private String title;
049:
050:            private String profession;
051:
052:            private String manager;
053:
054:            private String sortString;
055:
056:            private String familyName;
057:
058:            private String givenName;
059:
060:            private String additionalNames;
061:
062:            private String nickName;
063:
064:            private String namePrefix;
065:
066:            private String nameSuffix;
067:
068:            private String fullName;
069:
070:            private String formattedName;
071:
072:            private String homePage;
073:
074:            private String weblog;
075:
076:            private String calendar;
077:
078:            private String freeBusy;
079:
080:            private Date birthday;
081:
082:            private ImageIcon photo;
083:
084:            private String category;
085:
086:            private Vector emailAddressVector = new Vector();
087:
088:            private String preferredPhone;
089:
090:            private Vector phoneVector = new Vector();
091:
092:            private Vector instantMessagingVector = new Vector();
093:
094:            private Vector addressVector = new Vector();
095:
096:            private String note;
097:
098:            public ContactModel(IContactItem contactItem) {
099:                if (contactItem == null
100:                        || contactItem.getEmailAddress() == null
101:                        || contactItem.getEmailAddress().length() == 0)
102:                    throw new IllegalArgumentException(
103:                            "address == null or empty String");
104:
105:                Address adr;
106:
107:                String fn = contactItem.getName() != null ? contactItem
108:                        .getName() : contactItem.getEmailAddress();
109:                setFormattedName(fn);
110:
111:                // backwards compatibility
112:                setSortString(fn);
113:                addEmail(new EmailModel(contactItem.getEmailAddress(),
114:                        EmailModel.TYPE_WORK));
115:
116:                String[] result = ParserUtil.tryBreakName(fn);
117:                setGivenName(contactItem.getFirstName());
118:                setFamilyName(contactItem.getLastName());
119:
120:            }
121:
122:            public ContactModel() {
123:                this .id = new UUIDGenerator().newUUID();
124:            }
125:
126:            public ContactModel(String id) {
127:                if (id == null)
128:                    throw new IllegalArgumentException("id == null");
129:
130:                this .id = id;
131:            }
132:
133:            public String getId() {
134:                return id;
135:            }
136:
137:            /**
138:             * @see org.columba.addressbook.model.IContactModel#getAdditionalNames()
139:             */
140:            public String getAdditionalNames() {
141:                return additionalNames;
142:            }
143:
144:            /**
145:             * @see org.columba.addressbook.model.IContactModel#getDepartment()
146:             */
147:            public String getDepartment() {
148:                return department;
149:            }
150:
151:            /**
152:             * @see org.columba.addressbook.model.IContactModel#getPreferredEmail()
153:             */
154:            public String getPreferredEmail() {
155:                Iterator it = getEmailIterator();
156:
157:                // get first item
158:                IEmailModel model = (IEmailModel) it.next();
159:
160:                // backwards compatiblity
161:                // -> its not possible anymore to create a contact model without email
162:                // address
163:                if (model == null)
164:                    return null;
165:
166:                return model.getAddress();
167:            }
168:
169:            /**
170:             * @see org.columba.addressbook.model.IContactModel#getFamilyName()
171:             */
172:            public String getFamilyName() {
173:                return familyName;
174:            }
175:
176:            /**
177:             * @see org.columba.addressbook.model.IContactModel#getGivenName()
178:             */
179:            public String getGivenName() {
180:                return givenName;
181:            }
182:
183:            /**
184:             * @see org.columba.addressbook.model.IContactModel#getNickName()
185:             */
186:            public String getNickName() {
187:                return nickName;
188:            }
189:
190:            /**
191:             * @see org.columba.addressbook.model.IContactModel#getOrganisation()
192:             */
193:            public String getOrganisation() {
194:                return organisation;
195:            }
196:
197:            /**
198:             * @see org.columba.addressbook.model.IContactModel#getProfession()
199:             */
200:            public String getProfession() {
201:                return profession;
202:            }
203:
204:            /**
205:             * @see org.columba.addressbook.model.IContactModel#getNamePrefix()
206:             */
207:            public String getNamePrefix() {
208:                return namePrefix;
209:            }
210:
211:            /**
212:             * @see org.columba.addressbook.model.IContactModel#getNameSuffix()
213:             */
214:            public String getNameSuffix() {
215:                return nameSuffix;
216:            }
217:
218:            /**
219:             * @param familyName
220:             *            The familyName to set.
221:             */
222:            public void setFamilyName(String familyName) {
223:                this .familyName = familyName;
224:            }
225:
226:            /**
227:             * @param additionalNames
228:             *            The additionalNames to set.
229:             */
230:            public void setAdditionalNames(String additionalNames) {
231:                this .additionalNames = additionalNames;
232:            }
233:
234:            /**
235:             * @param department
236:             *            The department to set.
237:             */
238:            public void setDepartment(String department) {
239:                this .department = department;
240:            }
241:
242:            /**
243:             * @param given
244:             *            The given to set.
245:             */
246:            public void setGivenName(String given) {
247:                this .givenName = given;
248:            }
249:
250:            /**
251:             * @param nickname
252:             *            The nickname to set.
253:             */
254:            public void setNickName(String nickname) {
255:                this .nickName = nickname;
256:            }
257:
258:            /**
259:             * @param organisation
260:             *            The organisation to set.
261:             */
262:            public void setOrganisation(String organisation) {
263:                this .organisation = organisation;
264:            }
265:
266:            /**
267:             * @param position
268:             *            The position to set.
269:             */
270:            public void setProfession(String position) {
271:                this .profession = position;
272:            }
273:
274:            /**
275:             * @param prefix
276:             *            The prefix to set.
277:             */
278:            public void setNamePrefix(String prefix) {
279:                this .namePrefix = prefix;
280:            }
281:
282:            /**
283:             * @param suffix
284:             *            The suffix to set.
285:             */
286:            public void setNameSuffix(String suffix) {
287:                this .nameSuffix = suffix;
288:            }
289:
290:            public String getHomePage() {
291:                return homePage;
292:            }
293:
294:            public String getWeblog() {
295:                return weblog;
296:            }
297:
298:            public String getCalendar() {
299:                return calendar;
300:            }
301:
302:            public String getFreeBusy() {
303:                return freeBusy;
304:            }
305:
306:            /**
307:             * @param calendar
308:             *            The calendar to set.
309:             */
310:            public void setCalendar(String calendar) {
311:                this .calendar = calendar;
312:            }
313:
314:            /**
315:             * @param freeBusy
316:             *            The freeBusy to set.
317:             */
318:            public void setFreeBusy(String freeBusy) {
319:                this .freeBusy = freeBusy;
320:            }
321:
322:            /**
323:             * @param homePage
324:             *            The homePage to set.
325:             */
326:            public void setHomePage(String homePage) {
327:                this .homePage = homePage;
328:            }
329:
330:            /**
331:             * @param weblog
332:             *            The weblog to set.
333:             */
334:            public void setWeblog(String weblog) {
335:                this .weblog = weblog;
336:            }
337:
338:            /**
339:             * @deprecated use getFormattedName() instead
340:             * 
341:             * @see org.columba.addressbook.model.IContactModel#getFullName()
342:             */
343:            public String getFullName() {
344:                return fullName;
345:            }
346:
347:            /**
348:             * @deprecated use setFormattedName() instead
349:             * 
350:             * @param fullName
351:             *            The fullName to set.
352:             */
353:            public void setFullName(String fullName) {
354:                this .fullName = fullName;
355:            }
356:
357:            public String getFormattedName() {
358:                return formattedName;
359:            }
360:
361:            /**
362:             * @param formattedName
363:             *            The formattedName to set.
364:             */
365:            public void setFormattedName(String formattedName) {
366:                this .formattedName = formattedName;
367:            }
368:
369:            public Iterator getEmailIterator() {
370:                return emailAddressVector.iterator();
371:            }
372:
373:            public void addEmail(IEmailModel emailAddress) {
374:                if (emailAddress == null)
375:                    throw new IllegalArgumentException("emailModel == null");
376:
377:                emailAddressVector.add(emailAddress);
378:            }
379:
380:            // public String getAgent() {
381:            // return agent;
382:            // }
383:
384:            public Date getBirthday() {
385:                return birthday;
386:            }
387:
388:            public String getSortString() {
389:                return sortString;
390:            }
391:
392:            public ImageIcon getPhoto() {
393:                return photo;
394:            }
395:
396:            /**
397:             * @param birthday
398:             *            The birthday to set.
399:             */
400:            public void setBirthday(Date birthday) {
401:                this .birthday = birthday;
402:            }
403:
404:            /**
405:             * @param photo
406:             *            The photo to set.
407:             */
408:            public void setPhoto(ImageIcon photo) {
409:                this .photo = photo;
410:            }
411:
412:            /**
413:             * @param sortString
414:             *            The sortString to set.
415:             */
416:            public void setSortString(String sortString) {
417:                this .sortString = sortString;
418:            }
419:
420:            public Iterator getPhoneIterator() {
421:                return phoneVector.iterator();
422:            }
423:
424:            public void addPhone(PhoneModel phoneModel) {
425:                if (phoneModel == null)
426:                    throw new IllegalArgumentException("phoneModel == null");
427:
428:                phoneVector.add(phoneModel);
429:            }
430:
431:            public Iterator getInstantMessagingIterator() {
432:                return instantMessagingVector.iterator();
433:            }
434:
435:            public void addInstantMessaging(
436:                    InstantMessagingModel instantMessagingModel) {
437:                if (instantMessagingModel == null)
438:                    throw new IllegalArgumentException(
439:                            "instantMessaging == null");
440:
441:                instantMessagingVector.add(instantMessagingModel);
442:            }
443:
444:            public String getPreferredPhone() {
445:                return preferredPhone;
446:            }
447:
448:            public void addAddress(AddressModel model) {
449:                if (model == null)
450:                    throw new IllegalArgumentException("model == null");
451:
452:                addressVector.add(model);
453:            }
454:
455:            public Iterator getAddressIterator() {
456:                return addressVector.iterator();
457:            }
458:
459:            public String getTitle() {
460:                return title;
461:            }
462:
463:            /**
464:             * @param title
465:             *            The title to set.
466:             */
467:            public void setTitle(String title) {
468:                this .title = title;
469:            }
470:
471:            public String getNote() {
472:                return note;
473:            }
474:
475:            /**
476:             * @param note
477:             *            The note to set.
478:             */
479:            public void setNote(String note) {
480:                this .note = note;
481:            }
482:
483:            public String getCategory() {
484:                return category;
485:            }
486:
487:            /**
488:             * @param category
489:             *            The category to set.
490:             */
491:            public void setCategory(String category) {
492:                this .category = category;
493:            }
494:
495:            public String getOffice() {
496:                return office;
497:            }
498:
499:            /**
500:             * @param office The office to set.
501:             */
502:            public void setOffice(String office) {
503:                this .office = office;
504:            }
505:
506:            public String getPreferredInstantMessaging() {
507:                Iterator it = getInstantMessagingIterator();
508:                if (it.hasNext()) {
509:                    InstantMessagingModel m = (InstantMessagingModel) it.next();
510:                    return m.getUserId();
511:                }
512:
513:                return null;
514:            }
515:
516:            public String getManager() {
517:                return manager;
518:            }
519:
520:            public void setManager(String manager) {
521:                this.manager = manager;
522:            }
523:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.