Download this file

Contact.java    200 lines (179 with data), 4.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package eu.alfred.personalization_manager.model;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
public class Contact {
private String id;
private String alfredUserName; // contacts can be alfred users, we point to this user
private String contactsAlfredId;
private String userID;
private String firstName;
private String middleName;
private String lastName;
private String prefferedName;
private Gender gender;
private Date dateOfBirth;
private String phone;
private String mobilePhone;
private String email;
private Address residentialAddress;
private Address postalAddress;
private Relation[] relationToUser;
private AccessLevels accessLevels;
private String[] socialMediaProfiles;
private HashMap<String,Boolean> accessRightsToAttributes;
public Contact() {
setId();
}
public String getId() {
return id;
}
// For cases we create id for the contact
public String setId() {
this.id = "alfred-user-contact-"+UUID.randomUUID().toString();
return this.id; // When creating a new contact we provide the id back so they assign them to the users
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPrefferedName() {
return prefferedName;
}
public void setPrefferedName(String prefferedName) {
this.prefferedName = prefferedName;
}
public Gender getGender() {
return gender;
}
public void setGender(Gender gender) {
this.gender = gender;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Address getResidentialAddress() {
return residentialAddress;
}
public void setResidentialAddress(Address residentialAddress) {
this.residentialAddress = residentialAddress;
}
public Address getPostalAddress() {
return postalAddress;
}
public void setPostalAddress(Address postalAddress) {
this.postalAddress = postalAddress;
}
public Relation[] getRelationToUser() {
return relationToUser;
}
public void setRelationToUser(Relation[] relationToUser) {
this.relationToUser = relationToUser;
}
public String[] getSocialMediaProfiles() {
return socialMediaProfiles;
}
public void setSocialMediaProfiles(String[] socialMediaProfiles) {
this.socialMediaProfiles = socialMediaProfiles;
}
public AccessLevels getAccessLevels() {
return accessLevels;
}
public void setAccessLevels(AccessLevels accessLevels) {
this.accessLevels = accessLevels;
}
public HashMap<String, Boolean> getAccessRightsToAttributes() {
return accessRightsToAttributes;
}
public void setAccessRightsToAttributes(
HashMap<String, Boolean> accessRightsToAttributes) {
this.accessRightsToAttributes = accessRightsToAttributes;
}
@Override
public String toString() {
return "id: " + this.getId() + ", first-name: " + this.getFirstName() + "...";
}
public String getAlfredUserName() {
return alfredUserName;
}
public void setAlfredUserName(String alfredUserName) {
this.alfredUserName = alfredUserName;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Contact other = (Contact) obj;
if (dateOfBirth == null) {
if (other.dateOfBirth != null)
return false;
} else if (!dateOfBirth.equals(other.dateOfBirth))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public String getContactsAlfredId() {
return contactsAlfredId;
}
public void setContactsAlfredId(String contactsAlfredId) {
this.contactsAlfredId = contactsAlfredId;
}
}