Quellcode durchsuchen

GatherBirthCertificateNewBornTimeLineData Refactored(2)

Andrew Grant vor 2 Monaten
Ursprung
Commit
64ef4975a3

+ 13 - 11
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/level2/GatherBirthCertificateNewBornTimeLineDataImpl.java

@@ -15,7 +15,6 @@ import scot.carricksoftware.grantswriter.domains.certificates.birthcertificate.B
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.SortedSet;
 import java.util.TreeMap;
 
 @Component
@@ -33,13 +32,18 @@ public class GatherBirthCertificateNewBornTimeLineDataImpl implements GatherBirt
     public void gather(List<BirthCertificate> birthCertificates) {
         logger.info("GatherBirthCertificateNewBornTimeLineDataImpl::Gather");
         for (BirthCertificate birthCertificate : birthCertificates) {
-            addWhenBorn(timelineData.getTimeLine(), timelineData.getRefs(), birthCertificate);
-            addWhenRegistered(timelineData.getTimeLine(), timelineData.getRefs(), birthCertificate);
-            addMotherAndFather(timelineData.getTimeLine(), timelineData.getRefs(), birthCertificate);
+            addWhenBorn(timelineData.getTimeLine(), birthCertificate);
+            addWhenRegistered(timelineData.getTimeLine(), birthCertificate);
+            addMotherAndFather(timelineData.getTimeLine(), birthCertificate);
+            addRefs(birthCertificate);
         }
     }
 
-    private void addWhenBorn(TreeMap<DMY, List<String>> timeLine, SortedSet<String> refs, BirthCertificate birthCertificate) {
+    private void addRefs(BirthCertificate birthCertificate) {
+        timelineData.getRefs().add("Birth Certificate for : " + birthCertificate.getNewBorn());
+    }
+
+    private void addWhenBorn(TreeMap<DMY, List<String>> timeLine, BirthCertificate birthCertificate) {
         logger.info("GatherBirthCertificateNewBornTimeLineDataImpl::AddWhenBorn");
 
         List<String> existingValues = timeLine.get(getDMY(birthCertificate.getWhenBorn()));
@@ -52,12 +56,10 @@ public class GatherBirthCertificateNewBornTimeLineDataImpl implements GatherBirt
         } else {
             existingValues.add("Born at " + birthCertificate.getUntrackedWhereBorn());
         }
-        timeLine.put(getDMY(birthCertificate.getWhenBorn()), existingValues);
-
-        refs.add("Birth Certificate for : " + birthCertificate.getNewBorn());
+        timeLine.put(getDMY(birthCertificate.getWhenRegistered()), existingValues);
     }
 
-    private void addWhenRegistered(TreeMap<DMY, List<String>> timeLine, SortedSet<String> refs, BirthCertificate birthCertificate) {
+    private void addWhenRegistered(TreeMap<DMY, List<String>> timeLine, BirthCertificate birthCertificate) {
         logger.info("GatherBirthCertificateNewBornTimeLineDataImpl::AddWhenRegistered");
 
         List<String> existingValues = timeLine.get(getDMY(birthCertificate.getWhenRegistered()));
@@ -74,7 +76,7 @@ public class GatherBirthCertificateNewBornTimeLineDataImpl implements GatherBirt
 
     }
 
-    private void addMotherAndFather(TreeMap<DMY, List<String>> timeLine, SortedSet<String> refs, BirthCertificate birthCertificate) {
+    private void addMotherAndFather(TreeMap<DMY, List<String>> timeLine, BirthCertificate birthCertificate) {
         logger.info("GatherBirthCertificateNewBornTimeLineDataImpl::AddMotherAndFather");
 
         List<String> existingValues = timeLine.get(getDMY(birthCertificate.getWhenRegistered()));
@@ -85,7 +87,7 @@ public class GatherBirthCertificateNewBornTimeLineDataImpl implements GatherBirt
         existingValues.add("Mother Registered as " + birthCertificate.getMother().toString());
         existingValues.add("Father Registered as " + birthCertificate.getFather().toString());
 
-       timeLine.put(getDMY(birthCertificate.getWhenRegistered()), existingValues);
+        timeLine.put(getDMY(birthCertificate.getWhenRegistered()), existingValues);
     }
 
     private DMY getDMY(String dateKey) {