diff --git a/data/demo.mv.db b/data/demo.mv.db index d8f8773b4b4ecf7b631b43ad282f99b1dcb992bd..ffd29e5632ef9a131d2e65647c27ed4f451be013 100644 Binary files a/data/demo.mv.db and b/data/demo.mv.db differ diff --git a/data/demo.trace.db b/data/demo.trace.db index 9060420013d3e880d6dc187be191cdf5ce630c1a..3cde3d557eac8e2db17864936f7172b79c1db6f1 100644 --- a/data/demo.trace.db +++ b/data/demo.trace.db @@ -3358,3 +3358,11 @@ Database is already closed (to disable automatic closing at VM shutdown, add ";D at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Thread.java:1575) +2025-04-28 22:14:15.501476+02:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLDataException: Hodnota je prĂliš dlhá pre stÄşpec "TITLE CHARACTER VARYING(255)": "'The in vitro induction of human immunodeficiency virus (HIV) replication in pur... (311)" +Value too long for column "TITLE CHARACTER VARYING(255)": "'The in vitro induction of human immunodeficiency virus (HIV) replication in pur... (311)"; SQL statement: +insert into documents (abstract_text,category_id,content,doi,notes,publication_year,publisher,status,target,title,id) values (?,?,?,?,?,?,?,?,?,?,default) [22001-232] +2025-04-28 22:16:56.048618+02:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLDataException: Hodnota je prĂliš dlhá pre stÄşpec "TITLE CHARACTER VARYING(255)": "'The in vitro induction of human immunodeficiency virus (HIV) replication in pur... (311)" +Value too long for column "TITLE CHARACTER VARYING(255)": "'The in vitro induction of human immunodeficiency virus (HIV) replication in pur... (311)"; SQL statement: +insert into documents (abstract_text,category_id,content,doi,notes,publication_year,publisher,status,target,title,id) values (?,?,?,?,?,?,?,?,?,?,default) [22001-232] diff --git a/src/main/java/com/dre0059/articleprocessor/service/HeaderService.java b/src/main/java/com/dre0059/articleprocessor/service/HeaderService.java index 5e4ac532432559f4eaee3fcb6db57d3e65c77dae..bcdfa43a67c4482abbc655d9de94b11bbb28315b 100644 --- a/src/main/java/com/dre0059/articleprocessor/service/HeaderService.java +++ b/src/main/java/com/dre0059/articleprocessor/service/HeaderService.java @@ -84,19 +84,25 @@ public class HeaderService { System.out.println("Author list before checking duplicity: " + authorList); System.out.println("Author last names before checking duplicity: " + authorLastNames); + // check duplicity of the document - if(documentRepository.existsByTitleAndAuthorsIn(title, authorLastNames)){ + /*if(documentRepository.existsByTitleAndAuthorsIn(title, authorLastNames)){ System.out.println("Document with this title and authors already exist"); + return null; - } + }*/ - Dokument dok = new Dokument(title, year, doi, publisher, "PDF"); + //Dokument dok = new Dokument(title, year, doi, publisher, "PDF"); List<Author> savedAuthors = authorRepository.saveAll(authorList); - Dokument dokument = new Dokument(title, year, doi, publisher, "PDF"); + + Dokument dokument = documentRepository.findByTitleAndAuthorsIn(title, authorLastNames) + .orElse(new Dokument(title, year, doi, publisher, "PDF")); + Category category = categoryRepository.getReferenceById(categoryId); dokument.setAuthors(savedAuthors); + dokument.setStatus("PDF"); System.out.println("Category: " + category); dokument.setCategory(category); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 99b23fdceccf71a06ccb2417393708059752e0bf..6e8e84f9e79c4ab6e957dce71cae173c785f280a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,27 +1,6 @@ server.port=8080 spring.application.name=articleProcessor -#spring.datasource.url=jdbc:sqlite:pdf_database.db -#spring.datasource.driver-class-name=org.sqlite.JDBC -#spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect -#spring.jpa.hibernate.ddl-auto=update - -#spring.datasource.url=jdbc:sqlite:"D:\\Bakalarka\\my_db\\first_database.db" -#driverClassName=org.sqlite.JDBC -#url=jdbc:sqlite:memory:myDb?cache=shared -#username=sa -#password=sa -#spring.jpa.database-platform=org.hibernate.community.dialect.SQLiteDialect -#spring.jpa.hibernate.ddl-auto=create-drop -#spring.jpa.show-sql=true - - -# SQLite database configuration -#spring.datasource.url=jdbc:sqlite:pdf_database.db -#spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect -#spring.jpa.hibernate.ddl-auto=create-drop -#spring.jpa.show-sql=true - #spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.url=jdbc:h2:file:./data/demo spring.datasource.driverClassName=org.h2.Driver @@ -46,5 +25,7 @@ spring.servlet.multipart.max-request-size=5MB spring.thymeleaf.cache=false spring.web.resources.cache.period=0 +# grobid URL v univerzitnej sieti grobid.host=http://158.196.98.65:8080 +