Skip to content
Snippets Groups Projects
Commit d1ea4d73 authored by dre0059's avatar dre0059
Browse files

Bootstrap implemented

parent 87e38683
No related merge requests found
Showing
with 115 additions and 119 deletions
......@@ -28,6 +28,8 @@
</scm>
<properties>
<java.version>17</java.version>
<lombok.version>1.18.36</lombok.version>
</properties>
<!-- -->
......@@ -40,6 +42,13 @@
</repositories>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
......@@ -142,6 +151,25 @@
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>5.2.3</version> <!-- Alebo najnovšiu verziu -->
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars.npm/bootstrap-icons -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-icons</artifactId>
<version>1.10.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.6.0</version> <!-- Alebo najnovšiu verziu -->
</dependency>
</dependencies>
......@@ -157,13 +185,22 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<failOnError>false</failOnError>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.6.3</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
......
......@@ -45,8 +45,14 @@ public class DocumentController {
public String viewDocument(Model model, @PathVariable("id") Long id) {
var references = documentService.getReferencedDocumentsById(id);
if (documentService.getDocumentById(id) == null) {
throw new IllegalArgumentException("Document with ID " + id + " not found.");
}
model.addAttribute("documentId", id);
model.addAttribute("references", references);
model.addAttribute("docTitle", documentService.getDocumentById(id).getTitle());
return "view-pdf";
}
......
......@@ -47,6 +47,7 @@ public class FileUploadController {
}
try {
System.out.println("Processing file " + file.getOriginalFilename());
File tmpFile = File.createTempFile("article-", ".pdf");
// save data from file to tmpFile
......@@ -55,12 +56,19 @@ public class FileUploadController {
} catch (IOException e) {
return ResponseEntity.internalServerError().body("FAILURE - cannot process file : " + e.getMessage());
}
//System.out.println("File written to temporary location. ");
String header = grobidClient.processHeader(tmpFile);
//System.out.println("GROBID Header processed: " + header);
String references = grobidClient.processReferences(tmpFile);
//System.out.println("GROBID Reference processed: " + references);
headerService.processHeader(header, categoryId, tmpFile);
//System.out.println("Header saved to database.");
referenceService.extractReferences(references);
//System.out.println("References extracted..");
tmpFile.delete();
......
package com.dre0059.articleprocessor.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DocumentDto {
private Long id;
private String title;
......@@ -10,68 +15,5 @@ public class DocumentDto {
private String publisher;
private String target;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getPublicationYear() {
return publicationYear;
}
public void setPublicationYear(Integer publicationYear) {
this.publicationYear = publicationYear;
}
public String getDoi() {
return doi;
}
public void setDoi(String doi) {
this.doi = doi;
}
public String getAbstractText() {
return abstractText;
}
public void setAbstractText(String abstractText) {
this.abstractText = abstractText;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
}
package com.dre0059.articleprocessor.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SimpleDocumentDto {
private Long id;
private String title;
private String status;
public String getLink() {
return "/api/document/"+getId();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
......@@ -11,7 +11,7 @@ import org.mapstruct.Mapping;
@Mapper(componentModel = "spring")
public interface DocumentMapper {
@Mapping(target = "publicationYear", source = "year")
//@Mapping(target = "publication_year", source = "year")
DocumentDto toDocumentDto(Dokument entity);
DocumentContentDto toDocumentContentDto(Dokument entity);
......
......@@ -15,9 +15,13 @@ import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.annotations.Cascade;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Cascade;
@Setter
@Getter
@Entity
@Table(name = "documents")
public class Dokument {
......@@ -73,41 +77,7 @@ public class Dokument {
this.status = status;
}
public Long getId() { return id; }
public String getTitle() { return title; }
public Integer getYear() { return publicationYear; }
public String getDoi() { return doi; }
//public String getAbstractText() { return abstractText; }
public String getStatus() { return status; }
public String getPublisher() { return publisher; }
public List<Reference> getReferences() { return references; }
public List<Author> getAuthors() { return authors; }
public byte[] getAbstractText() { return abstractText; }
public byte[] getContent() { return content; }
public void setAuthors(List<Author> authors) { this.authors = authors; }
public void setTitle(String title) { this.title = title; }
public void setTarget(String target) { this.target = target; }
public void setPublicationYear(Integer publicationYear) {
this.publicationYear = publicationYear;
}
public void setDoi(String doi) {
this.doi = doi;
}
public void setStatus(String status) {
this.status = status;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public void setReferences(List<Reference> references) {
this.references = references;
}
public void setCategory(Category category) { this.category = category;}
public void setAbstractText(byte[] abstractText) { this.abstractText = abstractText; }
public void setContent(byte[] content) { this.content = content; }
public String getTarget() {
return target;
public Integer getYear(){
return publicationYear;
}
}
package com.dre0059.articleprocessor.model;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.stereotype.Service;
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class Tag {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String title;
}
......@@ -4,7 +4,11 @@ import com.dre0059.articleprocessor.dto.DocumentContentDto;
import com.dre0059.articleprocessor.dto.DocumentDto;
import com.dre0059.articleprocessor.dto.SimpleDocumentDto;
import com.dre0059.articleprocessor.mapper.DocumentMapper;
import com.dre0059.articleprocessor.model.Author;
import com.dre0059.articleprocessor.model.Category;
import com.dre0059.articleprocessor.model.Dokument;
import com.dre0059.articleprocessor.repository.AuthorRepository;
import com.dre0059.articleprocessor.repository.CategoryRepository;
import com.dre0059.articleprocessor.repository.DocumentRepository;
import jakarta.transaction.Transactional;
import java.util.List;
......@@ -16,19 +20,27 @@ public class DocumentService {
private final DocumentMapper documentMapper;
private final DocumentRepository documentRepository;
private final AuthorRepository authorRepository;
private final CategoryRepository categoryRepository;
public DocumentService(DocumentMapper documentMapper, DocumentRepository documentRepository,
AuthorRepository authorRepository) {
AuthorRepository authorRepository, CategoryRepository categoryRepository) {
this.documentMapper = documentMapper;
this.documentRepository = documentRepository;
this.authorRepository = authorRepository;
this.categoryRepository = categoryRepository;
}
@Transactional
public DocumentDto getDocumentById(Long documentId) {
return documentMapper.toDocumentDto(documentRepository.findById(documentId).orElse(null));
Dokument dokument = documentRepository.findById(documentId).orElse(null);
// Použitie mappera na konverziu dokumentu do DTO
DocumentDto documentDto = documentMapper.toDocumentDto(dokument);
return documentDto;
}
@Transactional
public DocumentContentDto getDocumentContentById(Long documentId) {
return documentMapper.toDocumentContentDto(documentRepository.findById(documentId).orElse(null));
......
src/main/resources/static/assets/favicon.ico

22.9 KiB

src/main/resources/static/assets/img/background.png

3.32 MiB

src/main/resources/static/assets/img/bg-showcase-1.jpg

298 KiB

src/main/resources/static/assets/img/bg-showcase-2.jpg

193 KiB

src/main/resources/static/assets/img/bg-showcase-3.jpg

35.2 KiB

src/main/resources/static/assets/img/bg_pdf.png

2.36 MiB

src/main/resources/static/assets/img/bg_pdf1.png

3.08 MiB

src/main/resources/static/assets/img/testimonials-1.jpg

133 KiB

src/main/resources/static/assets/img/testimonials-2.jpg

189 KiB

src/main/resources/static/assets/img/testimonials-3.jpg

244 KiB

/*!
* Start Bootstrap - Landing Page v6.0.6 (https://startbootstrap.com/theme/landing-page)
* Copyright 2013-2023 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-landing-page/blob/master/LICENSE)
*/
// This file is intentionally blank
// Use this file to add JavaScript to your project
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment