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