From 4f791b886b38ba0e88a74e39dbd16724719e2080 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Fri, 10 Jan 2020 12:19:20 +0000 Subject: [PATCH] Added defaults to all entity values for auto noargs constructor generation --- .../co/neviyn/observationdatabase/Entity.kt | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt index 2adb8f4..b690875 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt @@ -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 = 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, + val scenarios: List = listOf(), @ManyToMany(mappedBy = "observations") - val tutors: Set, - val person: String + val tutors: Set = 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 = ""