refactor(person): share yearOf between relationship services
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,8 +97,8 @@ public class RelationshipInferenceService {
|
||||
List<RelationToken> path = shortestPaths.get(id);
|
||||
PersonNodeDTO node = new PersonNodeDTO(
|
||||
p.getId(), p.getDisplayName(),
|
||||
p.getBirthDate() != null ? p.getBirthDate().getYear() : null,
|
||||
p.getDeathDate() != null ? p.getDeathDate().getYear() : null,
|
||||
RelationshipService.yearOf(p.getBirthDate()),
|
||||
RelationshipService.yearOf(p.getDeathDate()),
|
||||
p.getGeneration(), p.isFamilyMember());
|
||||
out.add(new InferredRelationshipWithPersonDTO(node, labelFor(path), path.size()));
|
||||
}
|
||||
|
||||
@@ -158,8 +158,9 @@ public class RelationshipService {
|
||||
}
|
||||
|
||||
// Stammbaum DTOs stay year-shaped: derive the year from the LocalDate, null-safe
|
||||
// for persons with no date entered (ADR-039, REQ-PERSON-DATE-01).
|
||||
private static Integer yearOf(LocalDate date) {
|
||||
// for persons with no date entered (ADR-039, REQ-PERSON-DATE-01). Package-private
|
||||
// so RelationshipInferenceService shares the same derivation.
|
||||
static Integer yearOf(LocalDate date) {
|
||||
return date != null ? date.getYear() : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user