protected Iterator<Representation> processVcard(VCard vCard,Map<String,Mapping> mappings,
Map<EntityType,Map<String,Set<String>>> entityMap){
//NOTE: this is protected to allow direct access from the VCardIterator
String name = null;
EntityType entityType = null;
Property nameProperty = vCard.getProperty(Property.Id.FN);
if(nameProperty != null && nameProperty.getValue() != null && !nameProperty.getValue().isEmpty()){
entityType = EntityType.person;
name = nameProperty.getValue();
} else { //FN name -> maybe a ORG was exported
Property orgProperty = vCard.getProperty(Property.Id.ORG);
if(orgProperty != null && ((Org)orgProperty).getValues() != null && ((Org)orgProperty).getValues().length>0){
entityType = EntityType.organization;
name = ((Org)orgProperty).getValues()[0];
}
}
if(entityType == null){
log.warn("Unable to index vCard object without values for FN or ORG parameter (vCard: {})",vCard);
return Collections.emptyList().iterator();
}
String id = null;
Property uid = vCard.getProperty(Property.Id.UID);
if(uid != null){
id = uid.getValue();
} else {
id = name;
}
id = entityByName(entityMap, entityType, name, id,true);