Skip to content
Permalink
Browse files

Rework which entity properties are optional/mandatory

  • Loading branch information
erikhofer committed Mar 28, 2019
1 parent 503c6a3 commit 3cb65b88415c89615cfd1a037555f74fcc723e3d
@@ -1,5 +1,6 @@
#Thu Mar 28 13:00:59 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
@@ -13,20 +13,20 @@ class Assignment(
* e.g. "Java Threads and Runnable"
*/
@Column(nullable = false)
var title: String? = null,
var title: String,

/**
* The lecturer who created this assignment
*/
@ManyToOne
var owner: User? = null,
var owner: User,

/**
* The classroom this assignment belongs to
* This can be null for assignments that are shared via link
*/
@ManyToOne(optional = true)
var classroom: Classroom? = null,
var classroom: Classroom?,

/**
* A list of tasks in this assignment ordered by their position
@@ -12,50 +12,47 @@ class AssignmentTask(
* Related assignment this task belongs to
*/
@ManyToOne
var assignment: Assignment? = null,
var assignment: Assignment,

/**
* Position/Index in the assignment (zero-based)
*/
@Column(nullable = false)
var position: Long? = null,
var position: Long,

/**
* Title of the task
*/
@Column(nullable = false)
var title: String? = null,
var title: String,

/**
* The task body/description of what to do
*/
@Lob
@Column(nullable = false)
var body: String? = null,
var body: String?,

/**
* A tar archive of files that act as boilerplate code
*/
@Column(nullable = false)
@Lob
var files: ByteArray? = null,
var files: ByteArray?,

/**
* A weight >=0, <=100 how the task is weighted
* The total weight of all tasks should not be > 100
*/
@Column(nullable = false)
var weight: Int? = null,
var weight: Int?,

/**
* Evaluations that will be applied to this task
*/
@OneToMany(mappedBy = "task")
var evaluation: List<TaskEvaluation>? = ArrayList()
var evaluation: List<TaskEvaluation> = ArrayList()
) : JpaPersistable() {

/**
* Same like position but one-based index
*/
val number get() = this.position?.plus(1L)
val number get() = this.position.plus(1L)
}
@@ -10,7 +10,7 @@ class Classroom(
* Name of this course
*/
@Column(nullable = false)
var name: String? = null,
var name: String,

/**
* Assignments in this course
@@ -9,11 +9,11 @@ class Submission(
* The user that handed in this submissions
*/
@ManyToOne
var user: User? = null,
var user: User,

/**
* The assignment this submission belongs to
*/
@ManyToOne
var assignment: Assignment? = null
var assignment: Assignment
) : JpaPersistable()
@@ -10,11 +10,11 @@ class SubmissionTask(
* The submission of which this task is part of
*/
@ManyToOne
var submission: Submission? = null,
var submission: Submission,

/**
* A tar archive of files that have been submitted
*/
@Lob
var files: ByteArray? = null
var files: ByteArray
) : JpaPersistable()
@@ -12,14 +12,14 @@ class TaskEvaluation(
* The task that should be evaluated
*/
@ManyToOne
var task: AssignmentTask? = null,
var task: AssignmentTask,

/**
* The adapter that is responsible for evaluation
*
* TODO: Create a enum/registry that holds all possible evaluators – see #12
*/
var adapter: String? = null,
var adapter: String,

/**
* Configuration for the adapter as key-value pairs
@@ -9,16 +9,16 @@ class TaskEvaluationResult(
* The submission of which this task is part of
*/
@ManyToOne
var submissionTask: SubmissionTask? = null,
var submissionTask: SubmissionTask,

/**
* Link to the evaluation that has been used to create the result
*/
@ManyToOne
var evaluation: TaskEvaluation? = null,
var evaluation: TaskEvaluation,

/**
* A tar archive of files that have been submitted
* The result value that was determined by the evaluation
*/
var result: Long? = null
var result: Long
) : JpaPersistable()
@@ -10,7 +10,6 @@
# spring.datasource.password=postgres
# spring.datasource.driver-class-name=org.postgresql.Driver
# spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
# spring.jpa.properties.hibernate.globally_quoted_identifiers=true
#
# or in-memory (DO NOT USE IN PRODUCTION)
#
@@ -27,3 +26,6 @@ spring.profiles.active=dev

# Hides HHH000424: Disabling contextual LOB creation as createClob() method threw error
logging.level.org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl = WARN

# Escape all table names to avoid issues with reserved keywords like "user"
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

0 comments on commit 3cb65b8

Please sign in to comment.
You can’t perform that action at this time.