git-extractor/src/main/java/ru/ulstu/extractor/model/Commit.java

77 lines
1.7 KiB
Java
Raw Normal View History

2021-03-19 11:45:03 +04:00
package ru.ulstu.extractor.model;
2021-02-19 16:00:09 +04:00
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import java.util.ArrayList;
2021-02-19 16:00:09 +04:00
import java.util.Date;
import java.util.List;
2021-02-19 16:00:09 +04:00
@Entity
public class Commit extends BaseEntity {
private String hash;
2021-02-19 16:00:09 +04:00
private Date date;
private String message;
@ManyToOne
private Author author;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "commit_id", unique = true)
@Fetch(FetchMode.SUBSELECT)
private List<FileChange> fileChanges = new ArrayList<>();
2021-02-19 16:00:09 +04:00
public Commit() {
}
public Commit(String message, Author author, Date date) {
2021-02-19 16:00:09 +04:00
this.message = message;
2021-03-09 15:54:59 +04:00
this.author = author;
this.date = date;
2021-02-19 16:00:09 +04:00
}
public String getMessage() {
return message;
}
public Date getDate() {
return date;
}
public String getHash() {
return hash;
2021-02-19 16:00:09 +04:00
}
2021-03-10 14:47:43 +04:00
public void setHash(String hash) {
this.hash = hash;
2021-03-10 14:47:43 +04:00
}
public void setDate(Date date) {
this.date = date;
}
public void setMessage(String message) {
this.message = message;
}
public void setAuthor(Author author) {
this.author = author;
}
public List<FileChange> getFileChanges() {
return fileChanges;
}
public void setFileChanges(List<FileChange> fileChanges) {
this.fileChanges = fileChanges;
}
public Author getAuthor() {
return author;
2021-03-10 14:47:43 +04:00
}
2021-02-19 16:00:09 +04:00
}