private void copyPersonData(VCard card, Map<String, Object> contact, TransformerContext context) {
if (!card.getAddresses().isEmpty()) {
safeSet(
"homeAddress",
context.transform(LinkedHashMap.class, card.getAddresses().get(0)),
contact);
}
card.getEmails().stream().filter(v -> v.getValue() != null).forEach(v -> addEmail(v, contact));
card.getTelephoneNumbers()
.stream()
.filter(t -> t.getText() != null)
.forEach(
telephone -> {
for (TelephoneType telephoneType : telephone.getTypes()) {
if (TelephoneType.CELL.equals(telephoneType)) {
contact.put("mobilePhone", telephone.getText());
} else if (TelephoneType.WORK.equals(telephoneType)) {
addPhone("businessPhones", telephone, contact);
} else {
addPhone("homePhones", telephone, contact);
}
}
});
if (card.getBirthday() != null) {
safeSet("birthday", card.getBirthday().getText(), contact);
}
}