task/3382: Harmonisera tabellnamn #6
@ -11,46 +11,61 @@ import jakarta.persistence.JoinColumn;
|
|||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "plagiarism_request")
|
@Table(name = "plagiarism_request")
|
||||||
class PlagiarismRequest {
|
class PlagiarismRequest {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (plagiarism_request) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
@JoinColumn(name = "document_reference_id")
|
@JoinColumn(name = "document_file_reference_id", referencedColumnName = "id")
|
||||||
private FileReference document;
|
private FileReference document;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "receiver_user_id", referencedColumnName = "id")
|
||||||
private User receiver;
|
private User receiver;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getReceiver() {
|
|
||||||
return this.receiver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileReference getDocument() {
|
||||||
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDocument(FileReference fileDescription) {
|
public void setDocument(FileReference fileDescription) {
|
||||||
this.document = fileDescription;
|
this.document = fileDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getReceiver() {
|
||||||
|
return this.receiver;
|
||||||
|
}
|
||||||
|
|
||||||
public void setReceiver(User receiver) {
|
public void setReceiver(User receiver) {
|
||||||
this.receiver = receiver;
|
this.receiver = receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
@ -62,10 +77,6 @@ class PlagiarismRequest {
|
|||||||
&& Objects.equals(this.getReceiver(), other.getReceiver());
|
&& Objects.equals(this.getReceiver(), other.getReceiver());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof PlagiarismRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getDocument(), this.getReceiver());
|
return Objects.hash(this.getId(), this.getDocument(), this.getReceiver());
|
||||||
@ -73,6 +84,14 @@ class PlagiarismRequest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PlagiarismRequest(id=" + this.getId() + ", fileDescription=" + this.getDocument() + ", receiver=" + this.getReceiver() + ")";
|
return "PlagiarismRequest(id=" + this.getId() + ", fileDescription=" + this.getDocument() +
|
||||||
|
", receiver=" + this.getReceiver() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other method
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof PlagiarismRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,139 +17,159 @@ import jakarta.persistence.ManyToOne;
|
|||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "urkund_submission")
|
@Table(name = "urkund_submission")
|
||||||
public class UrkundSubmission extends DomainObject {
|
public class UrkundSubmission extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public enum State {
|
// Basic JPA-mappings
|
||||||
SUBMISSION_FAILED, SUBMITTED, REJECTED, ACCEPTED, ANALYZED, ERROR;
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public boolean isFinal() {
|
|
||||||
return !(this == SUBMITTED || this == ACCEPTED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private User receiver;
|
@Column(name = "submitted_date", nullable = false)
|
||||||
|
private Instant submitted;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
private String analysisAddress;
|
@Column(name = "state", nullable = false)
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private State state;
|
private State state;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
private Instant submitted;
|
@Column(name = "next_poll_date", nullable = false)
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private Instant nextPoll;
|
private Instant nextPoll;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "polling_delay", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private PollingDelay pollingDelay = PollingDelay.FIRST;
|
private PollingDelay pollingDelay = PollingDelay.FIRST;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
|
||||||
@JoinColumn(name = "document_reference_id")
|
|
||||||
private FileReference document;
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "message")
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "report_url")
|
||||||
private String reportUrl;
|
private String reportUrl;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "significance")
|
||||||
private Float significance;
|
private Float significance;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "analysis_address")
|
||||||
|
private String analysisAddress;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (urkund_submission) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "document_file_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference document;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "receiver_user_id", referencedColumnName = "id")
|
||||||
|
private User receiver;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAnalysisAddress() {
|
|
||||||
return this.analysisAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public State getState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getSubmitted() {
|
|
||||||
return this.submitted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return this.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReportUrl() {
|
|
||||||
return this.reportUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getSignificance() {
|
|
||||||
return this.significance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UrkundSubmission(id=" + this.getId() + ", receiver=" + this.getReceiver() + ", analysisAddress=" + this.getAnalysisAddress() + ", state=" + this.getState() + ", submitted=" + this.getSubmitted() + ", nextPoll=" + this.getNextPoll() + ", pollingDelay=" + this.getPollingDelay() + ", fileDescription=" + this.getDocument() + ", message=" + this.getMessage() + ", reportUrl=" + this.getReportUrl() + ", significance=" + this.getSignificance() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
void setId(Long id) {
|
void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setReceiver(User receiver) {
|
public Instant getSubmitted() {
|
||||||
this.receiver = receiver;
|
return this.submitted;
|
||||||
}
|
|
||||||
|
|
||||||
void setAnalysisAddress(String analysisAddress) {
|
|
||||||
this.analysisAddress = analysisAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setState(State state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSubmitted(Instant submitted) {
|
void setSubmitted(Instant submitted) {
|
||||||
this.submitted = submitted;
|
this.submitted = submitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public State getState() {
|
||||||
|
return this.state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setState(State state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instant getNextPoll() {
|
||||||
|
return this.nextPoll;
|
||||||
|
}
|
||||||
|
|
||||||
void setNextPoll(Instant nextPoll) {
|
void setNextPoll(Instant nextPoll) {
|
||||||
this.nextPoll = nextPoll;
|
this.nextPoll = nextPoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PollingDelay getPollingDelay() {
|
||||||
|
return this.pollingDelay;
|
||||||
|
}
|
||||||
|
|
||||||
void setPollingDelay(PollingDelay pollingDelay) {
|
void setPollingDelay(PollingDelay pollingDelay) {
|
||||||
this.pollingDelay = pollingDelay;
|
this.pollingDelay = pollingDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDocument(FileReference fileDescription) {
|
public String getMessage() {
|
||||||
this.document = fileDescription;
|
return this.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMessage(String message) {
|
void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReportUrl() {
|
||||||
|
return this.reportUrl;
|
||||||
|
}
|
||||||
|
|
||||||
void setReportUrl(String reportUrl) {
|
void setReportUrl(String reportUrl) {
|
||||||
this.reportUrl = reportUrl;
|
this.reportUrl = reportUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Float getSignificance() {
|
||||||
|
return this.significance;
|
||||||
|
}
|
||||||
|
|
||||||
void setSignificance(Float significance) {
|
void setSignificance(Float significance) {
|
||||||
this.significance = significance;
|
this.significance = significance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAnalysisAddress() {
|
||||||
|
return this.analysisAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAnalysisAddress(String analysisAddress) {
|
||||||
|
this.analysisAddress = analysisAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getDocument() {
|
||||||
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDocument(FileReference fileDescription) {
|
||||||
|
this.document = fileDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
User getReceiver() {
|
||||||
|
return this.receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReceiver(User receiver) {
|
||||||
|
this.receiver = receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
@ -170,10 +190,6 @@ public class UrkundSubmission extends DomainObject {
|
|||||||
&& Objects.equals(this.getSignificance(), other.getSignificance());
|
&& Objects.equals(this.getSignificance(), other.getSignificance());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof UrkundSubmission;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(
|
return Objects.hash(
|
||||||
@ -190,15 +206,31 @@ public class UrkundSubmission extends DomainObject {
|
|||||||
this.getSignificance());
|
this.getSignificance());
|
||||||
}
|
}
|
||||||
|
|
||||||
User getReceiver() {
|
@Override
|
||||||
return this.receiver;
|
public String toString() {
|
||||||
|
return "UrkundSubmission(id=" + this.getId() + ", receiver=" + this.getReceiver() +
|
||||||
|
", analysisAddress=" + this.getAnalysisAddress() + ", state=" +
|
||||||
|
this.getState() + ", submitted=" + this.getSubmitted() +
|
||||||
|
", nextPoll=" + this.getNextPoll() + ", pollingDelay=" + this.getPollingDelay() +
|
||||||
|
", fileDescription=" + this.getDocument() + ", message=" + this.getMessage() +
|
||||||
|
", reportUrl=" + this.getReportUrl() + ", significance=" + this.getSignificance() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
Instant getNextPoll() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.nextPoll;
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof UrkundSubmission;
|
||||||
}
|
}
|
||||||
|
|
||||||
PollingDelay getPollingDelay() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.pollingDelay;
|
// Nested type
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public enum State {
|
||||||
|
SUBMISSION_FAILED, SUBMITTED, REJECTED, ACCEPTED, ANALYZED, ERROR;
|
||||||
|
|
||||||
|
public boolean isFinal() {
|
||||||
|
return !(this == SUBMITTED || this == ACCEPTED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2770,6 +2770,58 @@ alter table `decision`
|
|||||||
foreign key (reviewer_approval_id) references reviewer_approval (id)
|
foreign key (reviewer_approval_id) references reviewer_approval (id)
|
||||||
on delete cascade on update cascade;
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Step 19: urkund_submission & plagiarium_request
|
||||||
|
*/
|
||||||
|
|
||||||
|
-- table: urkund_submission
|
||||||
|
|
||||||
|
alter table `urkund_submission` drop foreign key `urkund_submission_ibfk_2`;
|
||||||
|
alter table `urkund_submission` drop foreign key `FK_urkund_submission_document_reference`;
|
||||||
|
|
||||||
|
alter table `urkund_submission` drop key `FK_urkund_submission_document_reference`;
|
||||||
|
alter table `urkund_submission` drop key `FK_urkund_submission_receiver`;
|
||||||
|
|
||||||
|
alter table `urkund_submission` change `document_reference_id` `document_file_reference_id` bigint(20) not null;
|
||||||
|
alter table `urkund_submission` change `receiver_id` `receiver_user_id` bigint(20) not null after `document_file_reference_id`;
|
||||||
|
alter table `urkund_submission` change `submitted` `submitted_date` datetime not null;
|
||||||
|
alter table `urkund_submission` change `nextPoll` `next_poll_date` datetime not null;
|
||||||
|
alter table `urkund_submission` change `pollingDelay` `polling_delay` varchar(16) not null;
|
||||||
|
alter table `urkund_submission` change `reportUrl` `report_url` varchar(255) default null;
|
||||||
|
alter table `urkund_submission` change `analysisAddress` `analysis_address` varchar(255) default null;
|
||||||
|
|
||||||
|
alter table `urkund_submission`
|
||||||
|
add constraint fk_urkund_submission_document_file_reference_id
|
||||||
|
foreign key (document_file_reference_id) references file_reference (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
alter table `urkund_submission`
|
||||||
|
add constraint fk_urkund_submission_receiver_user_id
|
||||||
|
foreign key (receiver_user_id) references user (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
-- table: plagiarism_request
|
||||||
|
|
||||||
|
alter table `plagiarism_request` drop foreign key `plagiarism_request_ibfk_2`;
|
||||||
|
alter table `plagiarism_request` drop foreign key `FK_plagiarism_request_document_reference`;
|
||||||
|
|
||||||
|
alter table `plagiarism_request` drop key `FK_plagiarism_request_document_reference`;
|
||||||
|
alter table `plagiarism_request` drop key `FK_plagiarism_request_receiver`;
|
||||||
|
|
||||||
|
alter table `plagiarism_request` change `document_reference_id` `document_file_reference_id` bigint(20) not null;
|
||||||
|
alter table `plagiarism_request` change `receiver_id` `receiver_user_id` bigint(20) not null after `document_file_reference_id`;
|
||||||
|
|
||||||
|
alter table `plagiarism_request`
|
||||||
|
add constraint fk_plagiarism_request_document_file_reference_id
|
||||||
|
foreign key (document_file_reference_id) references file_reference (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
alter table `plagiarism_request`
|
||||||
|
add constraint fk_plagiarism_request_receiver_user_id
|
||||||
|
foreign key (receiver_user_id) references user (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
|
||||||
/* Useful SQL
|
/* Useful SQL
|
||||||
|
|
||||||
>>> SQL query for FK-to:
|
>>> SQL query for FK-to:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user