2019-10-11 15:39:29 +02:00
|
|
|
package eu.eudat.models.data.rda;
|
2019-06-04 16:04:04 +02:00
|
|
|
|
|
|
|
import eu.eudat.data.entities.UserInfo;
|
|
|
|
|
|
|
|
public class ContactRDAExportModel {
|
2019-11-28 12:13:33 +01:00
|
|
|
private String mbox;
|
2019-06-04 16:04:04 +02:00
|
|
|
private String name;
|
2019-11-28 12:13:33 +01:00
|
|
|
private IdRDAExportModel contact_id;
|
2019-06-04 16:04:04 +02:00
|
|
|
|
2019-11-28 12:13:33 +01:00
|
|
|
public String getMbox() {
|
|
|
|
return mbox;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
2019-11-28 12:13:33 +01:00
|
|
|
public void setMbox(String mbox) {
|
|
|
|
this.mbox = mbox;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
2019-11-28 12:13:33 +01:00
|
|
|
public IdRDAExportModel getContact_id() {
|
2019-06-04 16:04:04 +02:00
|
|
|
return contact_id;
|
|
|
|
}
|
2019-11-28 12:13:33 +01:00
|
|
|
public void setContact_id(IdRDAExportModel contact_id) {
|
2019-06-04 16:04:04 +02:00
|
|
|
this.contact_id = contact_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ContactRDAExportModel fromDataModel(UserInfo entity) {
|
2019-11-28 12:13:33 +01:00
|
|
|
ContactRDAExportModel contact = new ContactRDAExportModel();
|
|
|
|
contact.mbox = entity.getEmail();
|
|
|
|
contact.name = entity.getName();
|
2019-06-04 16:04:04 +02:00
|
|
|
// TODO: we should use a contact_id and not our UUID.
|
|
|
|
if (!entity.getId().toString().isEmpty()) {
|
2019-11-28 12:13:33 +01:00
|
|
|
contact.contact_id = new IdRDAExportModel(entity.getId().toString(), "other");
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-11-28 12:13:33 +01:00
|
|
|
contact.contact_id = null;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
2019-11-28 12:13:33 +01:00
|
|
|
return contact;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
|
|
|
}
|