/** * Build out this place reference with a field. * * @param field The field. * @return this. */ public PlaceReference field(Field field) { addField(field); return this; }
/** * Build out this place reference with a reference to a place description. * * @param ref The reference to the place description. * @return this. */ public PlaceReference description(URI ref) { setDescriptionRef(ref); return this; }
/** * Build out this place reference with an original string. * * @param original The original string. * @return this. */ public PlaceReference original(String original) { setOriginal(original); return this; }
/** * Create a date/place fact with the passed in type and values. * * @param factType the fact type. * @param date The date of applicability of this fact. * @param place The place of applicability of this fact. */ public Fact(FactType factType, String date, String place) { this(factType, new Date().original(date), new PlaceReference().original(place), null); }
/** * Check to see if the given placeRef can be found in the given DocMap (if the placeRef and its description ref are non-null * and refer to a local id, i.e., one starting with "#"). If it is local and can't be found, add an error to 'errors'. * @param errors - StringBuilder to add a message to if there is a problem (i.e., if placeRef references a local place description * via a URI starting with "#", and there is no corresponding place description in the same document). * @param placeRef - PlaceReference object to check for a broken local link. * @param docMap - DocMap for a GedcomX document. */ private static void checkPlace(StringBuilder errors, PlaceReference placeRef, DocMap docMap) { if (placeRef != null && placeRef.getDescriptionRef() != null && placeRef.getDescriptionRef().toString().startsWith("#")) { if (docMap.getPlaceDescription(placeRef) == null) { errors.append("Error 13: Could not find referenced place ").append(placeRef.toString()).append("\n"); } } }
@Override public void visitPlaceReference(PlaceReference place) { this.contextStack.push(place); List<Field> fields = place.getFields(); if (fields != null) { for (Field field : fields) { if (field != null) { field.accept(this); } } } this.contextStack.pop(); }
@Override public void visitEvent(Event event) { this.contextStack.push(event); visitSubject(event); Date date = event.getDate(); if (date != null) { date.accept(this); } PlaceReference place = event.getPlace(); if (place != null) { place.accept(this); } List<EventRole> roles = event.getRoles(); if (roles != null) { for (EventRole role : roles) { if (role != null) { role.accept(this); } } } this.contextStack.pop(); }
/** * Build out this place reference with an normalized string. * * @param normalized The normalized string. * @return this. */ public PlaceReference normalized(String normalized) { addNormalizedExtension(new TextValue(normalized)); return this; }
/** * Find the PlaceDescription with the given PlaceReference. * @param placeReference - PlaceReference that contains the (probably local) id of a PlaceDescription. * @return PlaceDescription object with the given local id or URI. */ public PlaceDescription getPlaceDescription(PlaceReference placeReference) { return placeReference == null ? null : getPlaceDescription(placeReference.getDescriptionRef()); }
addFields(fact.getPlace().getFields(), person, personFieldsMap);
@Override public void visitFact(Fact fact) { this.contextStack.push(fact); visitConclusion(fact); Date date = fact.getDate(); if (date != null) { date.accept(this); } PlaceReference place = fact.getPlace(); if (place != null) { place.accept(this); } List<Field> fields = fact.getFields(); if (fields != null) { for (Field field : fields) { if (field != null) { field.accept(this); } } } this.contextStack.pop(); }
/** * Build out this place reference with a reference to a place description. * * @param description The reference to the place description. * @return this. */ public PlaceReference description(PlaceDescription description) { setDescriptionRef(URI.create("#" + description.getId())); return this; }