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);
|
List<RelationToken> path = shortestPaths.get(id);
|
||||||
PersonNodeDTO node = new PersonNodeDTO(
|
PersonNodeDTO node = new PersonNodeDTO(
|
||||||
p.getId(), p.getDisplayName(),
|
p.getId(), p.getDisplayName(),
|
||||||
p.getBirthDate() != null ? p.getBirthDate().getYear() : null,
|
RelationshipService.yearOf(p.getBirthDate()),
|
||||||
p.getDeathDate() != null ? p.getDeathDate().getYear() : null,
|
RelationshipService.yearOf(p.getDeathDate()),
|
||||||
p.getGeneration(), p.isFamilyMember());
|
p.getGeneration(), p.isFamilyMember());
|
||||||
out.add(new InferredRelationshipWithPersonDTO(node, labelFor(path), path.size()));
|
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
|
// 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).
|
// for persons with no date entered (ADR-039, REQ-PERSON-DATE-01). Package-private
|
||||||
private static Integer yearOf(LocalDate date) {
|
// so RelationshipInferenceService shares the same derivation.
|
||||||
|
static Integer yearOf(LocalDate date) {
|
||||||
return date != null ? date.getYear() : null;
|
return date != null ? date.getYear() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user