Эх сурвалжийг харах

GatherBirthCertificateTimeLineData added to structure

Andrew Grant 2 сар өмнө
parent
commit
b72226c1be

+ 5 - 1
docs/Structure.txt

@@ -1,6 +1,10 @@
 TexController -> TexWriter -> PartsWriter -> PeoplePartWriter -> (PeoplePartHeader+PersonSectionWriter) ->
     (PersonPart SubSectionHeading + PersonSubSectionTimeLineWriter + PersonSubSectionReferencesWriter)
 
+TexController::start -> TexWriter::write -> (docStart::write, partsWriter::write, docEnd::write)
+partsWriter::write -> partsWriter::write -> peoplePartWriter::write  -> (for each person)::personSection::write
+personSection::write -> (personSectionHeader::write, clearExistingTimeLineData::clear, gatherTimeLineData::gather,
+           personSubSectionTimeLineWriter::write, personSubSectionReferencesWriter::write
 
 
-
+gatherTimeLineData::gather -> (gatherCensusTimeLineData::gather, GatherBirthCertificateTimeLineData::gather)

+ 6 - 0
src/main/java/scot/carricksoftware/grantswriter/data/TimeLineDataImpl.java

@@ -5,6 +5,8 @@
 
 package scot.carricksoftware.grantswriter.data;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.springframework.stereotype.Component;
 import scot.carricksoftware.grantswriter.data.helpers.AddCensusEntry;
 import scot.carricksoftware.grantswriter.domains.census.CensusEntry;
@@ -17,6 +19,8 @@ import java.util.TreeSet;
 @Component
 public class TimeLineDataImpl implements TimeLineData {
 
+    private static final Logger logger = LogManager.getLogger(TimeLineDataImpl.class);
+
     private TreeMap<DMY, List<String>> timeLine;
 
     private SortedSet<String> refs;
@@ -35,11 +39,13 @@ public class TimeLineDataImpl implements TimeLineData {
 
     @Override
     public void addCensusEntry(List<CensusEntry> censusEntryList) {
+        logger.info("TimeLineDataImpl::addCensusEntry");
         addCensusEntry.add(timeLine, refs, censusEntryList);
     }
 
     @Override
     public void clear() {
+        logger.info("TimeLineDataImpl::clear");
         timeLine.clear();
         refs.clear();
     }

+ 0 - 1
src/main/java/scot/carricksoftware/grantswriter/data/helpers/AddCensusEntryImpl.java

@@ -19,7 +19,6 @@ import java.util.TreeMap;
 
 @Component
 public class AddCensusEntryImpl implements AddCensusEntry {
-
     private static final Logger logger = LogManager.getLogger(AddCensusEntryImpl.class);
 
     @Override

+ 1 - 11
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherBirthCertificateTimeLineData.java

@@ -8,16 +8,6 @@ package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections.
 import scot.carricksoftware.grantswriter.domains.people.Person;
 
 public interface GatherBirthCertificateTimeLineData {
-    @SuppressWarnings("unused")
-    void gatherNewBorn(Person person);
-
-    @SuppressWarnings("unused")
-    void gatherFather(Person person);
-
-    @SuppressWarnings("unused")
-    void gatherMother(Person person);
-
-    @SuppressWarnings("unused")
-    void gatherInformant(Person person);
+   void gather(@SuppressWarnings("unused") Person person);
 
 }

+ 15 - 9
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherBirthCertificateTimeLineDataImpl.java

@@ -14,7 +14,7 @@ import scot.carricksoftware.grantswriter.services.certificates.birthcertificate.
 public class GatherBirthCertificateTimeLineDataImpl implements GatherBirthCertificateTimeLineData {
 
     @SuppressWarnings({"FieldCanBeLocal", "unused"})
-    private final BirthCertificateService  birthCertificateService;
+    private final BirthCertificateService birthCertificateService;
     @SuppressWarnings({"FieldCanBeLocal", "unused"})
     private final TimeLineData timelineData;
 
@@ -23,24 +23,30 @@ public class GatherBirthCertificateTimeLineDataImpl implements GatherBirthCertif
         this.timelineData = timelineData;
     }
 
-
     @Override
-    public void gatherNewBorn(Person person) {
+    public void gather(Person person) {
         throw new UnsupportedOperationException();
     }
 
-    @Override
-    public void gatherFather(Person person) {
+    @SuppressWarnings("unused")
+    private void gatherNewBorn(@SuppressWarnings("unused") Person person) {
         throw new UnsupportedOperationException();
     }
 
-    @Override
-    public void gatherMother(Person person) {
+    @SuppressWarnings("unused")
+    private void gatherFather(@SuppressWarnings("unused") Person person) {
         throw new UnsupportedOperationException();
     }
 
-    @Override
-    public void gatherInformant(Person person) {
+    @SuppressWarnings("unused")
+    private void gatherMother(@SuppressWarnings("unused") Person person) {
         throw new UnsupportedOperationException();
     }
+
+    @SuppressWarnings("unused")
+    private void gatherInformant(@SuppressWarnings("unused") Person person) {
+        throw new UnsupportedOperationException();
+    }
+
+
 }

+ 4 - 1
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherTimeLineDataImpl.java

@@ -12,14 +12,17 @@ import scot.carricksoftware.grantswriter.domains.people.Person;
 public class GatherTimeLineDataImpl implements GatherTimeLineData {
 
    private final GatherCensusTimeLineData gatherCensusTimeLineData;
+    private final GatherBirthCertificateTimeLineData gatherBirthCertificateTimeLineData;
 
     public GatherTimeLineDataImpl(
-            GatherCensusTimeLineData gatherCensusTimeLineData) {
+            GatherCensusTimeLineData gatherCensusTimeLineData, GatherBirthCertificateTimeLineData gatherBirthCertificateTimeLineData) {
         this.gatherCensusTimeLineData = gatherCensusTimeLineData;
+        this.gatherBirthCertificateTimeLineData = gatherBirthCertificateTimeLineData;
     }
 
     @Override
     public void gather(Person person) {
         gatherCensusTimeLineData.gather(person);
+        gatherBirthCertificateTimeLineData.gather(person);
     }
 }

+ 11 - 2
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherTimeLineDataTest.java

@@ -22,18 +22,27 @@ class GatherTimeLineDataTest {
     @Mock
     private GatherCensusTimeLineData gatherCensusTimeLineDataMock;
 
+    @Mock
+    private GatherBirthCertificateTimeLineData gatherBirthCertificateTimeLineDataMock;
+
     @Mock
     private Person personMock;
 
     @BeforeEach
     void setUp() {
-        gatherTimeLineData = new GatherTimeLineDataImpl(gatherCensusTimeLineDataMock);
+        gatherTimeLineData = new GatherTimeLineDataImpl(gatherCensusTimeLineDataMock, gatherBirthCertificateTimeLineDataMock);
     }
 
     @Test
-    void gatherTest() {
+    void gatherCensusEntryDataTest() {
         gatherTimeLineData.gather(personMock);
         verify(gatherCensusTimeLineDataMock).gather(personMock);
     }
 
+    @Test
+    void gatherBirthCertificateDataTest() {
+        gatherTimeLineData.gather(personMock);
+        verify(gatherBirthCertificateTimeLineDataMock).gather(personMock);
+    }
+
 }