1
0
forked from PGL/Clyde

added extention entities

This commit is contained in:
Bartha Maxime 2024-04-09 19:52:31 +02:00
parent fdf4993def
commit b7a729c899
7 changed files with 120 additions and 2 deletions

View File

@ -4,5 +4,7 @@ public enum FileType {
ProfilePicture, ProfilePicture,
EducationCertificate EducationCertificate,
Article,
} }

View File

@ -0,0 +1,7 @@
package ovh.herisson.Clyde.Tables.ScientificPublications;
public enum Access {
OpenSource,
Restricted,
Private,
}

View File

@ -0,0 +1,51 @@
package ovh.herisson.Clyde.Tables.ScientificPublications;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import ovh.herisson.Clyde.Tables.User;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Article {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
@ManyToOne(fetch = FetchType.EAGER)
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name ="Users")
private User author;
//todo change user to Researcher
@CreationTimestamp
@Column(nullable = false)
private Date releaseDate;
private PublishType publishType;
private String pdfLocation;
private String bibTexLocation;
private String language;
private Access access;
private String domain;
private String summary;
private int views;
}

View File

@ -0,0 +1,27 @@
package ovh.herisson.Clyde.Tables.ScientificPublications;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ArticleCoAuthors {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "Researcher")
private Researcher coAuthor;
@ManyToOne(fetch = FetchType.EAGER)
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "Article")
private Article article;
}

View File

@ -0,0 +1,6 @@
package ovh.herisson.Clyde.Tables.ScientificPublications;
public enum PublishType {
article,
slides,
}

View File

@ -0,0 +1,25 @@
package ovh.herisson.Clyde.Tables.ScientificPublications;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import ovh.herisson.Clyde.Tables.User;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Researcher {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@OneToOne
private User user;
private String orcidId;
private String site;
private String Domain;
}

View File

@ -28,11 +28,11 @@ public class User {
////// Extension Messagerie ///// ////// Extension Messagerie /////
@OneToMany(mappedBy = "author", cascade = CascadeType.ALL) @OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
private List<Message> msgs; private List<Message> msgs;
/////////////////////////////////
@ManyToMany( mappedBy = "members" ) @ManyToMany( mappedBy = "members" )
private List<Discussion> discussions; private List<Discussion> discussions;
/////////////////////////////////
public User(String lastName, String firstName, String email, String address, public User(String lastName, String firstName, String email, String address,
String country, Date birthDate, String profilePictureUrl, Role role, String password) String country, Date birthDate, String profilePictureUrl, Role role, String password)
{ {