|
@@ -9,18 +9,17 @@ import org.apache.logging.log4j.LogManager;
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import scot.carricksoftware.grantswriter.constants.LatexConstants;
|
|
|
import scot.carricksoftware.grantswriter.data.TimelineData;
|
|
|
import scot.carricksoftware.grantswriter.domains.census.CensusEntry;
|
|
|
import scot.carricksoftware.grantswriter.domains.people.Person;
|
|
|
import scot.carricksoftware.grantswriter.services.censusentry.CensusEntryService;
|
|
|
-import scot.carricksoftware.grantswriter.services.censusentry.CensusEntryServiceImpl;
|
|
|
import scot.carricksoftware.grantswriter.writer.FileWriter;
|
|
|
+import scot.carricksoftware.grantswriter.writer.latex.LatexLongTabLeEnd;
|
|
|
+import scot.carricksoftware.grantswriter.writer.latex.LatexLongTableStart;
|
|
|
import scot.carricksoftware.grantswriter.writer.latex.LatexSubSectionHeader;
|
|
|
|
|
|
-import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.TreeSet;
|
|
|
|
|
|
@Component
|
|
|
public class PersonSubSectionTimeLineWriterImpl implements PersonSubSectionTimeLineWriter {
|
|
@@ -31,15 +30,19 @@ public class PersonSubSectionTimeLineWriterImpl implements PersonSubSectionTimeL
|
|
|
private final CensusEntryService censusEntryService;
|
|
|
private final TimelineData timelineData;
|
|
|
private final FileWriter fileWriter;
|
|
|
+ private final LatexLongTableStart latexLongTableStart;
|
|
|
+ private final LatexLongTabLeEnd latexLongTabLeEnd;
|
|
|
|
|
|
public PersonSubSectionTimeLineWriterImpl(LatexSubSectionHeader latexSubSectionHeader,
|
|
|
CensusEntryService censusEntryService,
|
|
|
TimelineData timelineData,
|
|
|
- FileWriter fileWriter) {
|
|
|
+ FileWriter fileWriter, LatexLongTableStart latexLongTableStart, LatexLongTabLeEnd latexLongTabLeEnd) {
|
|
|
this.latexSubSectionHeader = latexSubSectionHeader;
|
|
|
this.censusEntryService = censusEntryService;
|
|
|
this.timelineData = timelineData;
|
|
|
this.fileWriter = fileWriter;
|
|
|
+ this.latexLongTableStart = latexLongTableStart;
|
|
|
+ this.latexLongTabLeEnd = latexLongTabLeEnd;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -49,7 +52,9 @@ public class PersonSubSectionTimeLineWriterImpl implements PersonSubSectionTimeL
|
|
|
List<CensusEntry> censusEntryList = censusEntryService.findAllByPerson(person);
|
|
|
timelineData.clear();
|
|
|
timelineData.add(censusEntryList);
|
|
|
+ latexLongTableStart.write("l l");
|
|
|
writeData(timelineData.getTimeline());
|
|
|
+ latexLongTabLeEnd.write();
|
|
|
}
|
|
|
|
|
|
private void writeData(LinkedMultiValueMap<String, String> map) {
|
|
@@ -57,13 +62,14 @@ public class PersonSubSectionTimeLineWriterImpl implements PersonSubSectionTimeL
|
|
|
|
|
|
for (String key : map.keySet()) {
|
|
|
List<String> value = map.get(key);
|
|
|
- for (String v : value) {
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- builder.append(key);
|
|
|
- builder.append("&");
|
|
|
- builder.append(v);
|
|
|
- builder.append("&\\\\");
|
|
|
- fileWriter.writeLine(builder.toString());
|
|
|
+ if (value != null) {
|
|
|
+ for (String v : value) {
|
|
|
+ String builder = key +
|
|
|
+ LatexConstants.TABLE_COLUMN_END +
|
|
|
+ v +
|
|
|
+ LatexConstants.TABLE_LINE_END;
|
|
|
+ fileWriter.writeLine(builder);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|