2021-03-19 11:45:03 +04:00
|
|
|
package ru.ulstu.extractor.model;
|
2021-02-19 16:00:09 +04:00
|
|
|
|
2021-03-29 11:38:27 +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;
|
2021-03-29 11:38:27 +04:00
|
|
|
import java.util.List;
|
2021-02-19 16:00:09 +04:00
|
|
|
|
2021-03-29 11:38:27 +04:00
|
|
|
@Entity
|
|
|
|
public class Commit extends BaseEntity {
|
|
|
|
private String hash;
|
2021-02-19 16:00:09 +04:00
|
|
|
private Date date;
|
2021-03-29 11:38:27 +04:00
|
|
|
private String message;
|
2021-03-29 14:40:20 +04:00
|
|
|
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
2021-03-29 11:38:27 +04:00
|
|
|
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
|
|
|
|
2021-03-29 11:38:27 +04:00
|
|
|
public Commit() {
|
|
|
|
}
|
|
|
|
|
2021-03-29 14:40:20 +04:00
|
|
|
public Commit(String message, Author author, Date date, String hash) {
|
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-03-29 14:40:20 +04:00
|
|
|
this.hash = hash;
|
2021-02-19 16:00:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getMessage() {
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getDate() {
|
|
|
|
return date;
|
|
|
|
}
|
|
|
|
|
2021-03-29 11:38:27 +04:00
|
|
|
public String getHash() {
|
|
|
|
return hash;
|
2021-02-19 16:00:09 +04:00
|
|
|
}
|
2021-03-10 14:47:43 +04:00
|
|
|
|
2021-03-29 11:38:27 +04:00
|
|
|
public void setHash(String hash) {
|
|
|
|
this.hash = hash;
|
2021-03-10 14:47:43 +04:00
|
|
|
}
|
|
|
|
|
2021-03-29 11:38:27 +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
|
|
|
}
|