Added defaults to all entity values for auto noargs constructor generation

This commit is contained in:
neviyn 2020-01-10 12:19:20 +00:00
parent 6a6ceb7c87
commit 4f791b886b

View File

@ -26,7 +26,7 @@ data class Site(
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0, val id: Long = 0,
val name: String val name: String = "UNKNOWN"
) { ) {
@OneToMany(fetch = FetchType.LAZY) @OneToMany(fetch = FetchType.LAZY)
val tutors: MutableSet<Tutor> = mutableSetOf() val tutors: MutableSet<Tutor> = mutableSetOf()
@ -40,10 +40,10 @@ data class Tutor(
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0, val id: Long = 0,
val name: String, val name: String = "UNKNOWN",
@JsonIgnore @JsonIgnore
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
val site: Site val site: Site = Site(-1)
) { ) {
@JsonIgnore @JsonIgnore
@ManyToMany @ManyToMany
@ -54,7 +54,7 @@ data class Tutor(
} }
enum class TrainingType { enum class TrainingType {
INITIAL, CONTINUING INITIAL, CONTINUING, INVALID
} }
/** /**
@ -68,26 +68,26 @@ data class Observation(
val id: Long = 0, val id: Long = 0,
@JsonIgnore @JsonIgnore
@ManyToOne @ManyToOne
val site: Site, val site: Site = Site(-1),
@Column(nullable = false, name = "date") @Column(nullable = false, name = "date")
val date: LocalDate, val date: LocalDate = LocalDate.now(),
@Column(nullable = false) @Column(nullable = false)
val type: TrainingType, val type: TrainingType = TrainingType.INVALID,
@Column(nullable = false) @Column(nullable = false)
val observed: String, val observed: String = "UNKNOWN",
val monitoring: Double?, val monitoring: Double? = null,
val controlProcedural: Double?, val controlProcedural: Double? = null,
val control: Double?, val control: Double? = null,
val conservatism: Double?, val conservatism: Double? = null,
val teamworkCommunications: Double?, val teamworkCommunications: Double? = null,
val teamworkLeadership: Double?, val teamworkLeadership: Double? = null,
val teamworkWorkload: Double?, val teamworkWorkload: Double? = null,
val knowledge: Double?, val knowledge: Double? = null,
@OneToMany(cascade = [CascadeType.ALL]) @OneToMany(cascade = [CascadeType.ALL])
val scenarios: List<Scenario>, val scenarios: List<Scenario> = listOf(),
@ManyToMany(mappedBy = "observations") @ManyToMany(mappedBy = "observations")
val tutors: Set<Tutor>, val tutors: Set<Tutor> = setOf(),
val person: String val person: String = "UNKNOWN"
) { ) {
fun toCsvFormat(): String { fun toCsvFormat(): String {
val dataPortion = "${date.toString("dd/MM/yyyy")},\"${scenarios.joinToString { it.title }}\"," + val dataPortion = "${date.toString("dd/MM/yyyy")},\"${scenarios.joinToString { it.title }}\"," +
@ -128,29 +128,29 @@ data class Scenario(
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0, val id: Long = 0,
val title: String, val title: String = "UNKNOWN",
val monitoringRating: Int, val monitoringRating: Int = -1,
val monitoringStrengths: String = "", val monitoringStrengths: String = "",
val monitoringImprovements: String = "", val monitoringImprovements: String = "",
val controlProceduralRating: Int, val controlProceduralRating: Int = -1,
val controlProceduralStrengths: String = "", val controlProceduralStrengths: String = "",
val controlProceduralImprovements: String = "", val controlProceduralImprovements: String = "",
val controlRating: Int, val controlRating: Int = -1,
val controlStrengths: String = "", val controlStrengths: String = "",
val controlImprovements: String = "", val controlImprovements: String = "",
val conservatismRating: Int, val conservatismRating: Int = -1,
val conservatismStrengths: String = "", val conservatismStrengths: String = "",
val conservatismImprovements: String = "", val conservatismImprovements: String = "",
val teamworkCommunicationsRating: Int, val teamworkCommunicationsRating: Int = -1,
val teamworkCommunicationsStrengths: String = "", val teamworkCommunicationsStrengths: String = "",
val teamworkCommunicationsImprovements: String = "", val teamworkCommunicationsImprovements: String = "",
val teamworkLeadershipRating: Int, val teamworkLeadershipRating: Int = -1,
val teamworkLeadershipStrengths: String = "", val teamworkLeadershipStrengths: String = "",
val teamworkLeadershipImprovements: String = "", val teamworkLeadershipImprovements: String = "",
val teamworkWorkloadRating: Int, val teamworkWorkloadRating: Int = -1,
val teamworkWorkloadStrengths: String = "", val teamworkWorkloadStrengths: String = "",
val teamworkWorkloadImprovements: String = "", val teamworkWorkloadImprovements: String = "",
val knowledgeRating: Int, val knowledgeRating: Int = -1,
val knowledgeStrengths: String = "", val knowledgeStrengths: String = "",
val knowledgeImprovements: String = "" val knowledgeImprovements: String = ""