31 lines
873 B
Java
31 lines
873 B
Java
package eu.eudat.models.rda.mapper;
|
|
|
|
import eu.eudat.data.UserEntity;
|
|
import eu.eudat.models.rda.Contact;
|
|
|
|
public class ContactRDAMapper {
|
|
|
|
public static Contact toRDA(UserEntity creator) {
|
|
Contact rda = new Contact();
|
|
if (creator.getName() == null) {
|
|
throw new IllegalArgumentException("Contact Name is missing");
|
|
}
|
|
rda.setName(creator.getName());
|
|
//TODO: GetEmail
|
|
// if (creator.getEmail() == null) {
|
|
// throw new IllegalArgumentException("Contact Email is missing");
|
|
// }
|
|
// rda.setMbox(creator.getEmail());
|
|
rda.setContactId(ContactIdRDAMapper.toRDA(creator.getId()));
|
|
return rda;
|
|
}
|
|
|
|
public static UserEntity toEntity(Contact rda) {
|
|
UserEntity entity = new UserEntity();
|
|
entity.setId(ContactIdRDAMapper.toEntity(rda.getContactId()));
|
|
entity.setName(rda.getName());
|
|
// entity.setEmail(rda.getMbox());//TODO: GetEmail
|
|
return entity;
|
|
}
|
|
}
|