*/
public class ClassVEvent extends VEvent {
public ClassVEvent(ClassTimetable ct) {
super();
Course course = ct.getCourse();
PropertyList pl = getProperties();
DateTime[] timeStandard = ct.getDtStartEnd();
pl.add(new DtStart(timeStandard[0]));
if (timeStandard[1] != null) {
pl.add(new DtEnd(timeStandard[1]));
}
try {
UidGenerator ug = new UidGenerator("1");
pl.add(ug.generateUid());
} catch (SocketException ex) {
Logger.getLogger(ClassVEvent.class).error(
"Error when assigning UID to "
+ course.getCourseName() + " class timetable ", ex);
}
pl.add(new Description(course.getCourseName() + "("
+ course.getIndexNum() + ", " + ct.getGroup() + ")\n"
+ course.getCourseType()
+ (course.getCourseType().isPrescribed()
? " " + course.getGeneralPEType() : "")));
pl.add(new Location(ct.getVenue()));
pl.add(new Summary(course.getCourseName() + " " + ct.getClassType()
+ " " + ct.getRemark()));
String[] split = ct.getSemesterTimetable().getStartExam().split("-");
String str = split[0] + split[1] + split[2];
try {
pl.add(new RRule(new Recur(Recur.WEEKLY, new Date(str))));
} catch (ParseException ex) {
Logger.getLogger(ClassVEvent.class).error("Error when parsing "
+ "recurrence rule for " + course.getCourseName()
+ " class timetable", ex);
}
}