public void toPerson(org.folg.gedcom.model.Person dqPerson, GedcomxConversionResult result) throws IOException {
if (dqPerson == null) {
return;
}
Marker personContext = ConversionContext.getDetachedMarker(String.format("@%s@ INDI", dqPerson.getId()));
ConversionContext.addReference(personContext);
try {
Person gedxPerson = new Person();
gedxPerson.setId(dqPerson.getId());
//////////////////////////////////////////////////////////////////////
// Process NAMES
int index = 0;
List<Name> gedxNames = new ArrayList<Name>();
for (org.folg.gedcom.model.Name dqName : dqPerson.getNames()) {
Marker nameContext = ConversionContext.getDetachedMarker("NAME." + (++index));
ConversionContext.addReference(nameContext);
try {
int cntNamesBeforeThisNameObj = gedxNames.size();
gedxNames.addAll(toNameList(dqName, result));
if ((cntNamesBeforeThisNameObj == 0) && (gedxNames.size() > 0)) {
// the first name encountered is assumed to be the preferred name per the recommendation given in the GEDCOM 5.5.1 specification
gedxNames.get(0).setPreferred(Boolean.TRUE);
}
} finally {
ConversionContext.removeReference(nameContext);
}
}
if (gedxNames.size() > 0) {
gedxPerson.setNames(gedxNames);
}
//////////////////////////////////////////////////////////////////////
// Process facts
processFacts(gedxPerson, dqPerson.getEventsFacts(), result);
//////////////////////////////////////////////////////////////////////
// Process sources
List<SourceReference> sources = CommonMapper.toSourcesAndSourceReferences(dqPerson.getSourceCitations(), result);
gedxPerson.setSources(sources);
//////////////////////////////////////////////////////////////////////
// Add the person to the conversion results
java.util.Date lastModified = CommonMapper.toDate(dqPerson.getChange()); //todo: set the timestamp on the attribution?
//////////////////////////////////////////////////////////////////////
// Warn about all fields we are not processing
if (dqPerson.getAssociations() != null && dqPerson.getAssociations().size() > 0) {
logger.warn(ConversionContext.getContext(), "Associations ignored.");
}
if (dqPerson.getRecordFileNumber() != null) {
logger.warn(ConversionContext.getContext(), "Record file number ignored: {}", dqPerson.getRecordFileNumber());
}
if (dqPerson.getReferenceNumbers() != null && dqPerson.getReferenceNumbers().size() > 0) {
logger.warn(ConversionContext.getContext(), "Reference numbers ignored.");
}
if (dqPerson.getAncestorInterestSubmitterRef() != null) {
logger.warn(ConversionContext.getContext(), "Ancestor interest ignored: {}.", dqPerson.getAncestorInterestSubmitterRef());
}
if (dqPerson.getDescendantInterestSubmitterRef() != null) {
logger.warn(ConversionContext.getContext(), "Descendant interest ignored: {}.", dqPerson.getDescendantInterestSubmitterRef());
}
int cntLdsOrdinances = dqPerson.getLdsOrdinances().size();
if (cntLdsOrdinances > 0) {
logger.warn(ConversionContext.getContext(), "Did not process information for {} LDS ordinances.", cntLdsOrdinances);
}
if (dqPerson.getAddress() != null) {
logger.warn(ConversionContext.getContext(), "Address was ignored: {}", dqPerson.getAddress().getDisplayValue());
}
if (dqPerson.getEmail() != null) {
logger.warn(ConversionContext.getContext(), "e-mail ({}) was ignored.", dqPerson.getEmail());
}
if (dqPerson.getFax() != null) {
logger.warn(ConversionContext.getContext(), "fax ({}) was ignored.", dqPerson.getFax());
}
if (dqPerson.getPhone() != null) {
logger.warn(ConversionContext.getContext(), "phone ({}) was ignored.", dqPerson.getPhone());
}
if (dqPerson.getWww() != null) {
logger.warn(ConversionContext.getContext(), "www ({}) was ignored.", dqPerson.getWww());
}
if (dqPerson.getUid() != null) {
Marker uidContext = ConversionContext.getDetachedMarker(dqPerson.getUidTag());
ConversionContext.addReference(uidContext);
logger.warn(ConversionContext.getContext(), "UID ({}) was ignored.", dqPerson.getUid());
ConversionContext.removeReference(uidContext);
}