Rev 203 | Rev 205 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
203 | jmachado | 1 | package pt.estgp.estgweb.domain.views; |
2 | |||
3 | import org.apache.log4j.Logger; |
||
4 | import pt.estgp.estgweb.domain.*; |
||
5 | |||
6 | import java.io.Serializable; |
||
7 | import java.util.Set; |
||
204 | jmachado | 8 | import java.util.List; |
203 | jmachado | 9 | |
10 | /** |
||
11 | * @author Jorge Machado |
||
12 | * @date 2/Mar/2008 |
||
13 | * @time 19:34:49 |
||
14 | * @see pt.estgp.estgweb.domain.views |
||
15 | */ |
||
204 | jmachado | 16 | public class CourseUnitView extends DomainObjectView implements ICanManage |
203 | jmachado | 17 | { |
18 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(CourseUnitView.class); |
||
19 | |||
20 | private long id; |
||
21 | private 1.5.0/docs/api/java/lang/String.html">String name; |
||
22 | private 1.5.0/docs/api/java/lang/String.html">String code; |
||
23 | private 1.5.0/docs/api/java/lang/String.html">String courseCode; |
||
24 | private 1.5.0/docs/api/java/lang/String.html">String courseName; |
||
25 | private BlogView blog; |
||
26 | private Set<CourseUnitAnnouncement> announcements; |
||
27 | private CourseUnit courseUnit; |
||
28 | private Set<TeacherImpl> teachers; |
||
29 | private Set<StudentImpl> students; |
||
30 | private 1.5.0/docs/api/java/lang/String.html">String objectives; |
||
204 | jmachado | 31 | private 1.5.0/docs/api/java/lang/String.html">String programStreamId; |
32 | private int programSize; |
||
33 | private 1.5.0/docs/api/java/lang/String.html">String extension; |
||
203 | jmachado | 34 | |
35 | public 1.5.0/docs/api/java/lang/Class.html">Class getReferenceClass() |
||
36 | { |
||
37 | return CourseUnitImpl.class; |
||
38 | } |
||
39 | |||
40 | public 1.5.0/docs/api/java/io/Serializable.html">Serializable getSerializable() |
||
41 | { |
||
42 | return id; |
||
43 | } |
||
44 | |||
45 | public CourseUnitView() |
||
46 | { |
||
47 | } |
||
48 | |||
49 | public CourseUnitView(CourseUnit courseUnit) |
||
50 | { |
||
51 | super(courseUnit); |
||
52 | this.courseUnit = courseUnit; |
||
53 | this.courseName = courseUnit.getCourseName(); |
||
54 | this.name = courseUnit.getName(); |
||
55 | this.code = courseUnit.getCode(); |
||
56 | this.courseCode = courseUnit.getCourseCode(); |
||
57 | // if(courseUnit.getBlog() != null) |
||
58 | // this.blog = new BlogView(courseUnit.getBlog()); |
||
59 | this.id = courseUnit.getId(); |
||
60 | this.students = courseUnit.getStudents(); |
||
61 | this.teachers = courseUnit.getTeachers(); |
||
62 | this.announcements = courseUnit.getAnnouncements(); |
||
63 | this.objectives = courseUnit.getObjectives(); |
||
204 | jmachado | 64 | this.programStreamId = courseUnit.getProgramStreamId(); |
203 | jmachado | 65 | } |
66 | |||
204 | jmachado | 67 | public void setId(long id) |
203 | jmachado | 68 | { |
204 | jmachado | 69 | this.id = id; |
70 | } |
||
203 | jmachado | 71 | |
204 | jmachado | 72 | public void setName(1.5.0/docs/api/java/lang/String.html">String name) |
73 | { |
||
74 | this.name = name; |
||
203 | jmachado | 75 | } |
76 | |||
204 | jmachado | 77 | public void setCode(1.5.0/docs/api/java/lang/String.html">String code) |
78 | { |
||
79 | this.code = code; |
||
80 | } |
||
81 | |||
82 | public void setCourseCode(1.5.0/docs/api/java/lang/String.html">String courseCode) |
||
83 | { |
||
84 | this.courseCode = courseCode; |
||
85 | } |
||
86 | |||
87 | public void setCourseName(1.5.0/docs/api/java/lang/String.html">String courseName) |
||
88 | { |
||
89 | this.courseName = courseName; |
||
90 | } |
||
91 | |||
92 | public void persistViewInObject(CourseUnit c) |
||
93 | { |
||
94 | c.setObjectives(objectives); |
||
95 | } |
||
96 | |||
203 | jmachado | 97 | public 1.5.0/docs/api/java/lang/String.html">String getObjectives() |
98 | { |
||
99 | return objectives; |
||
100 | } |
||
101 | |||
102 | public void setObjectives(1.5.0/docs/api/java/lang/String.html">String objectives) |
||
103 | { |
||
104 | this.objectives = objectives; |
||
105 | } |
||
106 | |||
204 | jmachado | 107 | public 1.5.0/docs/api/java/lang/String.html">String getProgramStreamId() |
203 | jmachado | 108 | { |
204 | jmachado | 109 | return programStreamId; |
203 | jmachado | 110 | } |
111 | |||
204 | jmachado | 112 | public void setProgramStreamId(1.5.0/docs/api/java/lang/String.html">String programStreamId) |
203 | jmachado | 113 | { |
204 | jmachado | 114 | this.programStreamId = programStreamId; |
203 | jmachado | 115 | } |
116 | |||
117 | public long getId() |
||
118 | { |
||
119 | return id; |
||
120 | } |
||
121 | |||
122 | public 1.5.0/docs/api/java/lang/String.html">String getName() |
||
123 | { |
||
124 | return name; |
||
125 | } |
||
126 | |||
127 | public 1.5.0/docs/api/java/lang/String.html">String getCode() |
||
128 | { |
||
129 | return code; |
||
130 | } |
||
131 | |||
132 | public 1.5.0/docs/api/java/lang/String.html">String getCourseCode() |
||
133 | { |
||
134 | return courseCode; |
||
135 | } |
||
136 | |||
137 | public 1.5.0/docs/api/java/lang/String.html">String getCourseName() |
||
138 | { |
||
139 | return courseName; |
||
140 | } |
||
141 | |||
142 | public BlogView getBlog() |
||
143 | { |
||
144 | return blog; |
||
145 | } |
||
146 | |||
147 | |||
204 | jmachado | 148 | public int getProgramSize() |
149 | { |
||
150 | return programSize; |
||
151 | } |
||
152 | |||
153 | public void setProgramSize(int programSize) |
||
154 | { |
||
155 | this.programSize = programSize; |
||
156 | } |
||
157 | |||
158 | |||
159 | public 1.5.0/docs/api/java/lang/String.html">String getExtension() |
||
160 | { |
||
161 | return extension; |
||
162 | } |
||
163 | |||
164 | public void setExtension(1.5.0/docs/api/java/lang/String.html">String extension) |
||
165 | { |
||
166 | this.extension = extension; |
||
167 | } |
||
168 | |||
203 | jmachado | 169 | public Set<CourseUnitAnnouncement> getAnnouncements() |
170 | { |
||
171 | return announcements; |
||
172 | } |
||
173 | |||
174 | public Set<TeacherImpl> getTeachers() |
||
175 | { |
||
176 | return teachers; |
||
177 | } |
||
178 | |||
179 | public Set<StudentImpl> getStudents() |
||
180 | { |
||
181 | return students; |
||
182 | } |
||
204 | jmachado | 183 | |
184 | public boolean isOwnedBy(GenericUser u) |
||
185 | { |
||
186 | return u != null && u instanceof TeacherImpl && ((TeacherImpl)u).hasCourseUnit(getId()); |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * Not implemented can be variuous teachers |
||
191 | * @return null |
||
192 | * use isOwnedBy in this class |
||
193 | */ |
||
194 | public GenericUser getOwner() |
||
195 | { |
||
196 | return null; |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * Not implemented |
||
201 | * @return |
||
202 | */ |
||
203 | public List<String> getOwnerRoles() |
||
204 | { |
||
205 | return null; |
||
206 | } |
||
207 | |||
208 | /** |
||
209 | * Not implemented |
||
210 | * @return |
||
211 | */ |
||
212 | public 1.5.0/docs/api/java/lang/String.html">String getChoosedOwnerRole() |
||
213 | { |
||
214 | return null; |
||
215 | } |
||
216 | |||
217 | public boolean isInternal() |
||
218 | { |
||
219 | return true; |
||
220 | } |
||
221 | |||
222 | public boolean isValid() |
||
223 | { |
||
224 | return true; |
||
225 | } |
||
203 | jmachado | 226 | } |