Added a ton of entities.
This commit is contained in:
parent
7d6f10e3fc
commit
a22d759399
|
@ -0,0 +1,36 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The basic entity properties which any entity in this system should have: an id and a creation timestamp. Every entity
|
||||||
|
* in this system should extend from BasicEntity.
|
||||||
|
*/
|
||||||
|
@MappedSuperclass
|
||||||
|
public class BasicEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Temporal(
|
||||||
|
value = TemporalType.TIMESTAMP
|
||||||
|
)
|
||||||
|
@CreationTimestamp
|
||||||
|
@Column
|
||||||
|
private Date createdOn;
|
||||||
|
|
||||||
|
protected BasicEntity() {}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreatedOn() {
|
||||||
|
return this.createdOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a course, containing many students and teaching assistants, as well as a collection of assignments.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(
|
||||||
|
strategy = InheritanceType.JOINED
|
||||||
|
)
|
||||||
|
public class Course extends BasicEntity {
|
||||||
|
|
||||||
|
@Column(unique = true, nullable = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(unique = true, nullable = false)
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for JPA.
|
||||||
|
*/
|
||||||
|
protected Course() {}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.assignments;
|
||||||
|
|
||||||
|
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
|
||||||
|
import nl.andrewlalis.teaching_assistant_assistant.model.Course;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a single assignment for a course.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(
|
||||||
|
strategy = InheritanceType.JOINED
|
||||||
|
)
|
||||||
|
public class Assignment extends BasicEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The parent course to which this assignment belongs.
|
||||||
|
*/
|
||||||
|
@ManyToOne(
|
||||||
|
fetch = FetchType.LAZY,
|
||||||
|
optional = false
|
||||||
|
)
|
||||||
|
private Course course;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of sections which comprise this assignment.
|
||||||
|
*/
|
||||||
|
@OneToMany(
|
||||||
|
fetch = FetchType.EAGER,
|
||||||
|
orphanRemoval = true
|
||||||
|
)
|
||||||
|
private List<AssignmentSection> sections;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.assignments;
|
||||||
|
|
||||||
|
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Assignment is comprised of one or more sections, each of which has its own grade and feedback.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(
|
||||||
|
strategy = InheritanceType.JOINED
|
||||||
|
)
|
||||||
|
public class AssignmentSection extends BasicEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The parent assignment to which this section belongs.
|
||||||
|
*/
|
||||||
|
@ManyToOne(
|
||||||
|
fetch = FetchType.LAZY,
|
||||||
|
optional = false
|
||||||
|
)
|
||||||
|
private Assignment assignment;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.assignments;
|
||||||
|
|
||||||
|
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The feedback given by a teaching assistant to a student or group regarding a particular section of an assignment.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(
|
||||||
|
strategy = InheritanceType.JOINED
|
||||||
|
)
|
||||||
|
public abstract class Feedback extends BasicEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The section to which this feedback belongs.
|
||||||
|
*/
|
||||||
|
@ManyToOne(
|
||||||
|
fetch = FetchType.LAZY,
|
||||||
|
optional = false
|
||||||
|
)
|
||||||
|
private AssignmentSection assignmentSection;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.people;
|
||||||
|
|
||||||
|
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents any person (teaching assistant, student, or other) that exists in this application.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Inheritance(
|
||||||
|
strategy = InheritanceType.JOINED
|
||||||
|
)
|
||||||
|
public class Person extends BasicEntity {
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String firstName;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String lastName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private String emailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for JPA.
|
||||||
|
*/
|
||||||
|
protected Person () {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new Person.
|
||||||
|
* @param firstName The person's first name.
|
||||||
|
* @param lastName The person's last name.
|
||||||
|
* @param emailAddress The person's email address.
|
||||||
|
*/
|
||||||
|
public Person(String firstName, String lastName, String emailAddress) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
|
this.emailAddress = emailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.people;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a student, or someone enrolled and submitting assignments for a course.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public class Student extends Person {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package nl.andrewlalis.teaching_assistant_assistant.model.people;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a teaching assistant of a course, or in other words, a grader and administrator.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public class TeachingAssistant extends Person {
|
||||||
|
}
|
Loading…
Reference in New Issue