KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > addressbook > facade > ContactItem


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.addressbook.facade;
19
20
21 /**
22  * Convenience class implementation of IContactItem. This implementation class can be used by clients
23  * of the addressbook facade if desired, or can be implemented differently, if necessary.
24  */

25 public class ContactItem extends HeaderItem implements IContactItem {
26
27     private String JavaDoc firstName;
28     private String JavaDoc lastName;
29     private String JavaDoc address;
30     
31     public ContactItem() {
32         super(true);
33     }
34     
35     public ContactItem(String JavaDoc id) {
36         super(id, true);
37     }
38     
39     /**
40      *
41      * @param id unique id as generated by the contact store
42      * @param name display name, as seen as "Sort as" in the contact editor dialog
43      * @param firstName optional firstName, can be <code>null</code>
44      * @param lastName optional lastName, can be <code>null</code>
45      * @param address email address
46      */

47     public ContactItem(String JavaDoc id, String JavaDoc name, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc address) {
48         super(id, true);
49         
50         if ( name == null ) throw new IllegalArgumentException JavaDoc("name == null");
51         if ( address == null ) throw new IllegalArgumentException JavaDoc("address == null");
52         
53         this.firstName = firstName;
54         this.lastName = lastName;
55         this.address = address;
56         
57         setName(name);
58         
59     }
60     
61     public String JavaDoc getFirstName() {
62         return firstName;
63     }
64
65     public String JavaDoc getLastName() {
66         return lastName;
67     }
68
69     public String JavaDoc getEmailAddress() {
70         return address;
71     }
72     
73
74     public void setFirstName(String JavaDoc firstName) {
75         this.firstName = firstName;
76     }
77
78     public void setLastName(String JavaDoc lastName) {
79         this.lastName = lastName;
80     }
81
82     public void setEmailAddress(String JavaDoc emailAddress) {
83         this.address = emailAddress;
84     }
85 }
86
Popular Tags