Fixed "Getters of lazy classes cannot be final"

This commit is contained in:
neviyn 2021-04-04 15:05:37 +01:00
parent b11e273d7e
commit db6282eec6

View File

@ -16,10 +16,10 @@ import javax.persistence.OneToMany
@Entity
open class User(
var username: String = "INVALID",
var email: String = "INVALID",
open var username: String = "INVALID",
open var email: String = "INVALID",
@JsonIgnore
var password: String = "INVALID",
open var password: String = "INVALID",
@ManyToMany(cascade = [CascadeType.ALL])
@JsonIgnore
@JoinTable(
@ -27,20 +27,20 @@ open class User(
joinColumns = [JoinColumn(name = "user_id", referencedColumnName = "id")],
inverseJoinColumns = [JoinColumn(name = "project_id", referencedColumnName = "id")]
)
var projects: MutableSet<Project> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
open var projects: MutableSet<Project> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) open var id: Long? = null
)
@Entity
class Project(
var title: String = "INVALID",
open class Project(
open var title: String = "INVALID",
@ManyToMany(mappedBy = "projects")
@JsonIgnore
var members: MutableSet<User> = mutableSetOf(),
open var members: MutableSet<User> = mutableSetOf(),
@OneToMany(mappedBy = "project")
@JsonIgnore
var events: MutableSet<Event> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
open var events: MutableSet<Event> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) open var id: Long? = null
) {
fun addMember(member: User) {
members.add(member)
@ -54,46 +54,46 @@ class Project(
}
@Entity
class Event(
var title: String = "INVALID",
var description: String = "INVALID",
open class Event(
open var title: String = "INVALID",
open var description: String = "INVALID",
@Column(name = "start_time")
var start: Instant = Instant.MIN,
open var start: Instant = Instant.MIN,
@Column(name = "end_time")
var end: Instant = Instant.MIN,
open var end: Instant = Instant.MIN,
@ManyToOne
@JoinColumn(name = "project_id")
@JsonIgnore
var project: Project? = null,
open var project: Project? = null,
@ManyToMany(mappedBy = "events")
@JsonIgnore
var tags: MutableSet<Tag> = mutableSetOf(),
open var tags: MutableSet<Tag> = mutableSetOf(),
@OneToMany(mappedBy = "event")
var comments: MutableList<Comment> = mutableListOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
open var comments: MutableList<Comment> = mutableListOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) open var id: Long? = null
)
@Entity
class Comment(
open class Comment(
@ManyToOne
@JoinColumn(name = "user_id")
var user: User? = null,
open var user: User? = null,
@ManyToOne
@JoinColumn(name = "event_id")
@JsonIgnore
var event: Event? = null,
open var event: Event? = null,
@ManyToMany(mappedBy = "comments")
var tags: MutableSet<Tag> = mutableSetOf(),
var created: Instant = Instant.MIN,
var comment: String = "INVALID",
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
open var tags: MutableSet<Tag> = mutableSetOf(),
open var created: Instant = Instant.MIN,
open var comment: String = "INVALID",
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) open var id: Long? = null
) {
fun toFlatComment(): FlatComment = FlatComment(created, comment, user!!.username)
}
@Entity
class Tag(
var tag: String = "INVALID",
open class Tag(
open var tag: String = "INVALID",
@ManyToMany
@JoinTable(
name = "comment_tags",
@ -101,7 +101,7 @@ class Tag(
inverseJoinColumns = [JoinColumn(name = "comment_id", referencedColumnName = "id")]
)
@JsonIgnore
var comments: MutableSet<Comment> = mutableSetOf(),
open var comments: MutableSet<Comment> = mutableSetOf(),
@ManyToMany
@JoinTable(
name = "event_tags",
@ -109,6 +109,6 @@ class Tag(
inverseJoinColumns = [JoinColumn(name = "event_id", referencedColumnName = "id")]
)
@JsonIgnore
var events: MutableSet<Event> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
open var events: MutableSet<Event> = mutableSetOf(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) open var id: Long? = null
)