}
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?