1 package com.germinus.merlin.model.assignment;
2
3
4
5 import java.util.Date;
6 import java.util.HashSet;
7 import java.util.Set;
8 import javax.persistence.CascadeType;
9 import javax.persistence.Column;
10 import javax.persistence.DiscriminatorColumn;
11 import javax.persistence.Entity;
12 import javax.persistence.FetchType;
13 import javax.persistence.GeneratedValue;
14 import javax.persistence.Id;
15 import javax.persistence.JoinColumn;
16 import javax.persistence.ManyToOne;
17 import javax.persistence.OneToMany;
18 import javax.persistence.Table;
19 import javax.persistence.Temporal;
20 import javax.persistence.TemporalType;
21
22 import org.hibernate.annotations.GenericGenerator;
23
24 import com.germinus.merlin.model.Course;
25 import com.germinus.merlin.model.Resource;
26 import com.germinus.merlin.model.ResourceContainer;
27
28
29
30
31 @Entity
32 @DiscriminatorColumn(name="type")
33 @Table(name = "Assignments")
34 public class Assignment extends Resource implements java.io.Serializable {
35
36
37
38
39
40 private static final long serialVersionUID = -8589865593443023420L;
41 private Set<AssignmentResult> assignmentResult = new HashSet<AssignmentResult>(0);
42 private Date begintime;
43 private Course course;
44 private String data;
45 private Date endtime;
46 private Boolean hideDescriptionBeforeAvailable = true;
47 private String type;
48 private Boolean visible = true;
49
50 public Assignment() {
51 }
52
53 public Assignment(long assignmentid, Course course,
54 ResourceContainer resourceContainer) {
55 this.id = assignmentid;
56 this.course = course;
57 this.resourceContainer = resourceContainer;
58 }
59
60 public Assignment(long assignmentid, Course course,
61 ResourceContainer resourceContainer, String name,
62 String description,String data, Date timeAvailable, Date timeEnd,
63 String type2, boolean visible,
64 Set<AssignmentResult> resultses) {
65 new Assignment (assignmentid,course,resourceContainer,name,description,
66 data,timeAvailable,timeEnd,type2,resultses);
67 this.visible=visible;
68 }
69 public Assignment(long assignmentid, Course course,
70 ResourceContainer resourceContainer, String name,
71 String description,String data, Date timeAvailable, Date timeEnd, String type2,
72 Set<AssignmentResult> resultses) {
73 new Assignment(assignmentid,course,resourceContainer);
74 this.name = name;
75 this.description = description;
76 this.data = data;
77 this.begintime = timeAvailable;
78 this.endtime = timeEnd;
79 this.type = type2;
80 this.assignmentResult = resultses;
81 this.visible=true;
82 }
83
84 @Id @GeneratedValue(generator="system-increment")
85 @GenericGenerator(name="system-increment", strategy = "increment")
86 @Column(name = "assignmentid", unique = true, nullable = false)
87 public long getAssignmentid() {
88 return this.id;
89 }
90
91 @Temporal(TemporalType.DATE)
92 @Column(name = "begin_time", length = 19)
93 public Date getBegintime() {
94 return this.begintime;
95 }
96
97 @ManyToOne(fetch = FetchType.LAZY)
98 @JoinColumn(name = "courseid", nullable = false)
99 public Course getCourse() {
100 return this.course;
101 }
102
103 @Column(name = "data", length = 6553)
104 public String getData() {
105 return this.data;
106 }
107
108 @Column(name = "description", length = 200)
109 public String getDescription() {
110 return this.description;
111 }
112
113 @Temporal(TemporalType.DATE)
114 @Column(name = "end_time", length = 19)
115 public Date getEndtime() {
116 return this.endtime;
117 }
118
119 public Boolean getHideDescriptionBeforeAvailable() {
120 return hideDescriptionBeforeAvailable;
121 }
122
123 @Column(name = "name", length = 75)
124 public String getName() {
125 return this.name;
126 }
127
128 @ManyToOne(fetch = FetchType.LAZY)
129 @JoinColumn(name = "idResourceContainer")
130 public ResourceContainer getResourceContainer() {
131 return this.resourceContainer;
132 }
133
134 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "assignments")
135 public Set<AssignmentResult> getResults() {
136 return this.assignmentResult;
137 }
138
139 @Column(name = "type", length = 75, nullable = true, insertable=false, updatable=false)
140 public String getType() {
141 return this.type;
142 }
143
144 @Column(name = "visible", nullable = true)
145 public Boolean getVisible() {
146 return visible;
147 }
148
149 public void setAssignmentid(long assignmentid) {
150 this.id = assignmentid;
151 }
152
153 public void setBegintime(Date timeAvailable) {
154 this.begintime = timeAvailable;
155 }
156
157 public void setCourse(Course course) {
158 this.course = course;
159 }
160
161 public void setData(String data) {
162 this.data = data;
163 }
164
165 public void setDescription(String description) {
166 this.description = description;
167 }
168
169 public void setEndtime(Date timeEnd) {
170 this.endtime = timeEnd;
171 }
172
173 public void setHideDescriptionBeforeAvailable(
174 Boolean hideDescriptionBeforeAvailable) {
175 this.hideDescriptionBeforeAvailable = hideDescriptionBeforeAvailable;
176 }
177
178 public void setName(String name) {
179 this.name = name;
180 }
181
182 public void setResourceContainer(ResourceContainer resourceContainer) {
183 this.resourceContainer = resourceContainer;
184 }
185
186 public void setResults(Set<AssignmentResult> resultses) {
187 this.assignmentResult = resultses;
188 }
189
190 public void setType(String type2) {
191 this.type = type2;
192 }
193
194 public void setVisible(Boolean visible) {
195 this.visible = visible;
196 }
197
198
199 }