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