Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
be2bb0c6fa |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,4 @@
|
|||||||
out/
|
out/
|
||||||
conf.ini
|
conf.ini
|
||||||
log/
|
log/log4j/log.out/
|
||||||
reports/
|
reports/
|
||||||
.idea/dataSources*
|
|
9
.idea/libraries/iText_4_2_0_com_itextpdf.xml
generated
Normal file
9
.idea/libraries/iText_4_2_0_com_itextpdf.xml
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="iText-4.2.0-com.itextpdf">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/iText-4.2.0-com.itextpdf.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
@ -10,7 +10,7 @@
|
|||||||
<orderEntry type="library" name="lib" level="project" />
|
<orderEntry type="library" name="lib" level="project" />
|
||||||
<orderEntry type="library" name="org.ini4j:ini4j:0.5.4" level="project" />
|
<orderEntry type="library" name="org.ini4j:ini4j:0.5.4" level="project" />
|
||||||
<orderEntry type="library" name="log4j:log4j:1.2.17" level="project" />
|
<orderEntry type="library" name="log4j:log4j:1.2.17" level="project" />
|
||||||
<orderEntry type="library" name="org.apache.pdfbox:pdfbox:1.8.9" level="project" />
|
|
||||||
<orderEntry type="library" name="org.postgresql:postgresql:42.2.19" level="project" />
|
<orderEntry type="library" name="org.postgresql:postgresql:42.2.19" level="project" />
|
||||||
|
<orderEntry type="library" name="iText-4.2.0-com.itextpdf" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
BIN
lib/iText-4.2.0-com.itextpdf.jar
Normal file
BIN
lib/iText-4.2.0-com.itextpdf.jar
Normal file
Binary file not shown.
171
log/log4j/log.out
Normal file
171
log/log4j/log.out
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
2021-04-15 00:36:26 ERROR FileNotFoundException:33 - D:\FH_OFFLINE\tourplaner\conf.ini (Das System kann die angegebene Datei nicht finden)
|
||||||
|
2021-04-15 00:36:26 ERROR NullPointerException:33 -
|
||||||
|
2021-04-15 00:37:18 ERROR FileNotFoundException:33 - D:\FH_OFFLINE\tourplaner\conf.ini (Das System kann die angegebene Datei nicht finden)
|
||||||
|
2021-04-15 00:37:18 ERROR NullPointerException:33 -
|
||||||
|
2021-04-15 00:38:24 ERROR PSQLException:33 - Der Verbindungsversuch schlug fehl.
|
||||||
|
2021-04-15 00:38:31 ERROR SQLException:33 - No suitable driver found for jdbc:postgresql://http://postgres.dergeorg.at:5432/tourplaner
|
||||||
|
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 00:38:38 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 00:40:43 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 00:44:11 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 16:30:08 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 16:33:57 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 16:38:55 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 16:50:23 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 16:51:01 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:08:17 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:08:21 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Das System kann den angegebenen Pfad nicht finden)
|
||||||
|
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:21:48 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:21:57 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
||||||
|
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:31:40 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:32:30 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:37:57 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:37:57 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:37:57 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:37:58 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:37:58 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:38:41 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:40:30 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:48:48 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 17:49:14 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 18:00:58 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 18:00:58 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 18:00:59 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 18:00:59 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 18:00:59 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 18:09:56 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
||||||
|
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 18:10:01 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 18:10:06 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
||||||
|
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table created
|
||||||
|
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
||||||
|
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table unique created
|
||||||
|
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
||||||
|
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table primary created
|
||||||
|
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
||||||
|
2021-04-15 18:12:47 INFO PostgresHelper:15 - Log Table created
|
||||||
|
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
||||||
|
2021-04-15 18:13:38 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
@ -1,34 +1,237 @@
|
|||||||
package tourplaner.business;
|
package tourplaner.business;
|
||||||
|
|
||||||
import org.apache.pdfbox.exceptions.COSVisitorException;
|
import tourplaner.object.Log;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import tourplaner.object.Tour;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
|
||||||
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
|
|
||||||
import org.apache.pdfbox.pdmodel.font.PDFont;
|
|
||||||
import org.apache.pdfbox.pdmodel.font.PDType1Font;
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.itextpdf.text.Anchor;
|
||||||
|
import com.itextpdf.text.BadElementException;
|
||||||
|
import com.itextpdf.text.Chapter;
|
||||||
|
import com.itextpdf.text.Document;
|
||||||
|
import com.itextpdf.text.DocumentException;
|
||||||
|
import com.itextpdf.text.Element;
|
||||||
|
import com.itextpdf.text.Font;
|
||||||
|
import com.itextpdf.text.List;
|
||||||
|
import com.itextpdf.text.ListItem;
|
||||||
|
import com.itextpdf.text.Paragraph;
|
||||||
|
import com.itextpdf.text.Phrase;
|
||||||
|
import com.itextpdf.text.Section;
|
||||||
|
import com.itextpdf.text.pdf.PdfPCell;
|
||||||
|
import com.itextpdf.text.pdf.PdfPTable;
|
||||||
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class Reporter {
|
public class Reporter {
|
||||||
|
|
||||||
public static void createTourReport(String tourname) throws IOException, COSVisitorException {
|
private static Font catFont = new Font(Font.TIMES_ROMAN, 18,
|
||||||
PDDocument document = new PDDocument();
|
Font.BOLD);
|
||||||
PDPage page = new PDPage();
|
private static Font redFont = new Font(Font.TIMES_ROMAN, 12,
|
||||||
document.addPage(page);
|
Font.NORMAL, Color.RED);
|
||||||
|
private static Font subFont = new Font(Font.TIMES_ROMAN, 16,
|
||||||
|
Font.BOLD);
|
||||||
|
private static Font smallBold = new Font(Font.TIMES_ROMAN, 12,
|
||||||
|
Font.BOLD);
|
||||||
|
|
||||||
PDFont font = PDType1Font.HELVETICA;
|
public static void createTourReport(String tourname) {
|
||||||
PDPageContentStream contentStream = new PDPageContentStream(document, page);
|
Tour tour = TourPlaner.getTour(tourname);
|
||||||
contentStream.beginText();
|
tour.setLog(TourPlaner.getLogs(tourname));
|
||||||
contentStream.setFont(font, 12);
|
String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "report", "path") + tourname+".pdf";
|
||||||
contentStream.moveTextPositionByAmount(100,700);
|
try {
|
||||||
contentStream.drawString(tourname);
|
Document document = new Document();
|
||||||
// contentStream.drawString();
|
PdfWriter.getInstance(document, new FileOutputStream(file));
|
||||||
contentStream.endText();
|
document.open();
|
||||||
|
addMetaData(document, tour);
|
||||||
|
// addTitlePage(document, tour);
|
||||||
|
addContent(document, tour);
|
||||||
|
document.close();
|
||||||
|
} catch (DocumentException | FileNotFoundException e) {
|
||||||
|
LogHelper.error(e.getMessage(), e.getClass().getName());
|
||||||
|
}
|
||||||
|
openDefault(file);
|
||||||
|
}
|
||||||
|
|
||||||
contentStream.close();
|
// iText allows to add metadata to the PDF which can be viewed in your Adobe
|
||||||
|
// Reader
|
||||||
|
// under File -> Properties
|
||||||
|
private static void addMetaData(Document document, Tour tour) {
|
||||||
|
document.addTitle("Tour Report -> " + tour.getName());
|
||||||
|
document.addSubject("Tourplaner by DerGeorg");
|
||||||
|
document.addKeywords("Tourplaner, Tour, Report");
|
||||||
|
document.addAuthor("Tourplaner");
|
||||||
|
document.addCreator("Tourplaner");
|
||||||
|
}
|
||||||
|
|
||||||
document.save(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "report", "path") + "test.pdf");
|
private static void addContent(Document document, Tour tour) throws DocumentException {
|
||||||
document.close();
|
Anchor anchor = new Anchor("Tour Report von -> " + tour.getName(), catFont);
|
||||||
|
anchor.setName("Tour Report von -> " + tour.getName());
|
||||||
|
|
||||||
|
// Second parameter is the number of the chapter
|
||||||
|
Chapter catPart = new Chapter(new Paragraph(anchor), 1);
|
||||||
|
|
||||||
|
Paragraph subPara = new Paragraph("Tour", subFont);
|
||||||
|
Section subCatPart = catPart.addSection(subPara);
|
||||||
|
subCatPart.add(new Paragraph("Report erstellt von: " + System.getProperty("user.name") + ", " + new Date()));
|
||||||
|
subCatPart.add(new Paragraph("Startpunkt der Tour: " + tour.getStart()));
|
||||||
|
subCatPart.add(new Paragraph("Zielpunkt der Tour: " + tour.getZiel()));
|
||||||
|
subCatPart.add(new Paragraph("Berechnete Dauer der Tour: " + tour.getDauer()));
|
||||||
|
subCatPart.add(new Paragraph("Berechnete Strecke der Tour: " + tour.getStrecke()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// now add all this to the document
|
||||||
|
document.add(catPart);
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<Log> logs = tour.getLogs();
|
||||||
|
// Second parameter is the number of the chapter
|
||||||
|
anchor = new Anchor("Logs", catFont);
|
||||||
|
anchor.setName("Logs");
|
||||||
|
catPart = new Chapter(new Paragraph(anchor), 2);
|
||||||
|
catPart.add(new Paragraph("Anzahl der Logeinträge: " + logs.size()));
|
||||||
|
|
||||||
|
for (Log log: logs) {
|
||||||
|
subPara = new Paragraph("Log vom: " + log.getDatum() , subFont);
|
||||||
|
subCatPart = catPart.addSection(subPara);
|
||||||
|
subCatPart.add(new Paragraph("Dauer: " + log.getDauer()));
|
||||||
|
subCatPart.add(new Paragraph("Davon Pause: " + log.getPause()));
|
||||||
|
subCatPart.add(new Paragraph("Davon gegangen: " + log.getGegangen()));
|
||||||
|
subCatPart.add(new Paragraph("Berechnete Durchschnittliche Geschwindigkeit: " + log.getAvgspeed()));
|
||||||
|
subCatPart.add(new Paragraph("Entfernung: " + log.getStrecke()));
|
||||||
|
subCatPart.add(new Paragraph("Höhenmeter: " + log.getHightmeter()));
|
||||||
|
subCatPart.add(new Paragraph("Bemerkung: " + log.getBemerkung()));
|
||||||
|
}
|
||||||
|
// now add all this to the document
|
||||||
|
document.add(catPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createTable(Section subCatPart)
|
||||||
|
throws BadElementException {
|
||||||
|
PdfPTable table = new PdfPTable(5);
|
||||||
|
|
||||||
|
// t.setBorderColor(BaseColor.GRAY);
|
||||||
|
// t.setPadding(4);
|
||||||
|
// t.setSpacing(4);
|
||||||
|
// t.setBorderWidth(1);
|
||||||
|
|
||||||
|
PdfPCell c1 = new PdfPCell(new Phrase("NR"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Datum"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Entfernung"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Höhenmeter"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("AVG Geschwindigkeit"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
|
||||||
|
table.setHeaderRows(1);
|
||||||
|
|
||||||
|
table.addCell("1.0");
|
||||||
|
table.addCell("1.1");
|
||||||
|
table.addCell("1.2");
|
||||||
|
table.addCell("1.3");
|
||||||
|
table.addCell("1.4");
|
||||||
|
table.addCell("1.5");
|
||||||
|
|
||||||
|
table.addCell("2.0");
|
||||||
|
table.addCell("2.1");
|
||||||
|
table.addCell("2.2");
|
||||||
|
table.addCell("2.3");
|
||||||
|
table.addCell("2.4");
|
||||||
|
table.addCell("2.5");
|
||||||
|
|
||||||
|
subCatPart.add(table);
|
||||||
|
|
||||||
|
}
|
||||||
|
private static void createTable2(Section subCatPart)
|
||||||
|
throws BadElementException {
|
||||||
|
PdfPTable table = new PdfPTable(5);
|
||||||
|
|
||||||
|
// t.setBorderColor(BaseColor.GRAY);
|
||||||
|
// t.setPadding(4);
|
||||||
|
// t.setSpacing(4);
|
||||||
|
// t.setBorderWidth(1);
|
||||||
|
|
||||||
|
PdfPCell c1 = new PdfPCell(new Phrase("NR"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Dauer"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Davon Gegangen"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Davon Pause"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
c1 = new PdfPCell(new Phrase("Bemerkung"));
|
||||||
|
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||||
|
table.addCell(c1);
|
||||||
|
|
||||||
|
|
||||||
|
table.setHeaderRows(1);
|
||||||
|
|
||||||
|
table.addCell("1.0");
|
||||||
|
table.addCell("1.1");
|
||||||
|
table.addCell("1.2");
|
||||||
|
table.addCell("1.3");
|
||||||
|
table.addCell("1.4");
|
||||||
|
table.addCell("1.5");
|
||||||
|
|
||||||
|
table.addCell("2.0");
|
||||||
|
table.addCell("2.1");
|
||||||
|
table.addCell("2.2");
|
||||||
|
table.addCell("2.3");
|
||||||
|
table.addCell("2.4");
|
||||||
|
table.addCell("2.5");
|
||||||
|
|
||||||
|
subCatPart.add(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addEmptyLine(Paragraph paragraph, int number) {
|
||||||
|
for (int i = 0; i < number; i++) {
|
||||||
|
paragraph.add(new Paragraph(" "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void openDefault(String f){
|
||||||
|
// A reference to a text file
|
||||||
|
File file = new File(f);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Desktop desktop = Desktop.getDesktop();
|
||||||
|
|
||||||
|
// Open a file using the default program for the file type. In the example
|
||||||
|
// we will launch a default registered program to open a text file. For
|
||||||
|
// example on Windows operating system this call might launch a notepad.exe
|
||||||
|
// to open the file.
|
||||||
|
desktop.open(file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package tourplaner.business;
|
package tourplaner.business;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.pdfbox.exceptions.COSVisitorException;
|
|
||||||
import tourplaner.data.DbConnect;
|
import tourplaner.data.DbConnect;
|
||||||
import tourplaner.data.PostgresHelper;
|
|
||||||
import tourplaner.object.Log;
|
import tourplaner.object.Log;
|
||||||
import tourplaner.object.Tour;
|
import tourplaner.object.Tour;
|
||||||
|
|
||||||
@ -60,13 +58,11 @@ public class TourPlaner{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void doReport(String tourname){
|
public static void doReport(String tourname){
|
||||||
try {
|
Reporter.createTourReport(tourname);
|
||||||
Reporter.createTourReport(tourname);
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
public static Tour getTour(String tourname){
|
||||||
} catch (COSVisitorException e) {
|
return new DbConnect().getTour(tourname);
|
||||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean addLog(String tourname, Log log){
|
public static boolean addLog(String tourname, Log log){
|
||||||
|
@ -180,4 +180,41 @@ public class DbConnect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holt eine Tour aus der Datenbank
|
||||||
|
* @param tn Tourname
|
||||||
|
* @return Null bei fehler, sonst eine List aus den IDs
|
||||||
|
*/
|
||||||
|
public Tour getTour(String tn){
|
||||||
|
this.c = PostgresHelper.con();
|
||||||
|
String tourname, mapjson, start, ziel;
|
||||||
|
double dauer, strecke;
|
||||||
|
|
||||||
|
Tour touren = null;
|
||||||
|
try {
|
||||||
|
stmt = this.c.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("select * from tour where tourname = '"+tn+"';");
|
||||||
|
while (rs.next()) {
|
||||||
|
tourname = rs.getString("tourname");
|
||||||
|
mapjson = rs.getString("mapjson");
|
||||||
|
start = rs.getString("start");
|
||||||
|
ziel = rs.getString("ziel");
|
||||||
|
dauer = rs.getDouble("dauer");
|
||||||
|
strecke = rs.getDouble("strecke");
|
||||||
|
if (!tourname.isEmpty()) {
|
||||||
|
touren = new Tour(tourname, dauer + "", mapjson, strecke, start, ziel);
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
stmt.close();
|
||||||
|
this.c.close();
|
||||||
|
return touren;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println(e.getClass().getName() + ": " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ public class Tour {
|
|||||||
this.log = tour.getLogs();
|
this.log = tour.getLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLog(ArrayList<Log> log) {
|
||||||
|
this.log = log;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt einen einzigen Log Eintrag anhand der Id
|
* Holt einen einzigen Log Eintrag anhand der Id
|
||||||
* @param id Id des Eintrags der zu besorgen ist
|
* @param id Id des Eintrags der zu besorgen ist
|
||||||
|
@ -2,10 +2,7 @@ package tourplaner.viewmodels;
|
|||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import org.apache.pdfbox.exceptions.COSVisitorException;
|
|
||||||
import tourplaner.business.Reporter;
|
|
||||||
import tourplaner.business.TourPlaner;
|
import tourplaner.business.TourPlaner;
|
||||||
import tourplaner.data.DbConnect;
|
|
||||||
import tourplaner.ui.AlertHelper;
|
import tourplaner.ui.AlertHelper;
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
import tourplaner.business.LogHelper;
|
import tourplaner.business.LogHelper;
|
||||||
|
Reference in New Issue
Block a user