Skip to content

Commit 6875ae4

Browse files
committed
Event API: Session
- added academic session information for each event, containing session id, academic term, year, and initiative
1 parent afdd1e6 commit 6875ae4

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

JavaSource/org/unitime/timetable/events/EventDetailBackend.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ public static EventInterface getEventDetail(Session session, Event e, EventConte
296296
event.addCourseName(courseOffering.getCourseName());
297297
event.addCourseTitle(courseOffering.getTitle() == null ? "" : courseOffering.getTitle());
298298
event.setDeptCode(courseOffering.getDepartment().getDeptCode());
299+
event.setSession(EventLookupBackend.toSessionInterface(courseOffering.getInstructionalOffering().getSession()));
299300
event.setInstruction(clazz.getSchedulingSubpart().getItype().getDesc().length() <= 20 ? clazz.getSchedulingSubpart().getItype().getDesc() : clazz.getSchedulingSubpart().getItype().getAbbv());
300301
if (clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod() != null)
301302
event.setInstruction(event.getInstruction() + " (" + clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod().getLabel() + ")");
@@ -321,6 +322,7 @@ public static EventInterface getEventDetail(Session session, Event e, EventConte
321322
ExamEvent xe = (e instanceof ExamEvent ? (ExamEvent)e : ExamEventDAO.getInstance().get(e.getUniqueId(), hibSession));
322323
event.setEnrollment(xe.getExam().countStudents());
323324
event.setMaxCapacity(xe.getExam().getSize());
325+
event.setSession(EventLookupBackend.toSessionInterface(xe.getExam().getSession()));
324326
Set<Long> addedInstructorIds = new HashSet<Long>();
325327
for (DepartmentalInstructor i: xe.getExam().getInstructors()) {
326328
ContactInterface instructor = new ContactInterface();
@@ -607,6 +609,8 @@ public static EventInterface getEventDetail(Session session, Event e, EventConte
607609
event.addCoordinator(coordinator);
608610
}
609611
}
612+
if (event.getSession() == null)
613+
event.setSession(EventLookupBackend.toSessionInterface(owner.getCourse().getInstructionalOffering().getSession()));
610614
}
611615
event.setEnrollment(enrl);
612616
event.setMaxCapacity(limit);
@@ -725,6 +729,8 @@ public static EventInterface getEventDetail(Session session, Event e, EventConte
725729
meeting.addConflict(conflict);
726730
}
727731
}
732+
if (event.getSession() == null)
733+
event.setSession(EventLookupBackend.toSessionInterface(m.getLocation().getSession()));
728734
}
729735
Set<Meeting> overlapsThisMeeting = overlaps.get(m.getUniqueId());
730736
if (overlapsThisMeeting != null && m.getLocation() != null && !m.getLocation().isIgnoreRoomCheck()) {
@@ -1029,6 +1035,7 @@ public static EventInterface getArrangeHoursClassDetail(Class_ clazz, EventConte
10291035
event.addCourseName(correctedOffering.getCourseName());
10301036
event.addCourseTitle(correctedOffering.getTitle() == null ? "" : correctedOffering.getTitle());
10311037
event.setDeptCode(correctedOffering.getDepartment().getDeptCode());
1038+
event.setSession(EventLookupBackend.toSessionInterface(correctedOffering.getInstructionalOffering().getSession()));
10321039
event.setInstruction(clazz.getSchedulingSubpart().getItype().getDesc().length() <= 20 ? clazz.getSchedulingSubpart().getItype().getDesc() : clazz.getSchedulingSubpart().getItype().getAbbv());
10331040
if (clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod() != null)
10341041
event.setInstruction(event.getInstruction() + " (" + clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod().getLabel() + ")");

JavaSource/org/unitime/timetable/events/EventLookupBackend.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.unitime.timetable.gwt.shared.EventInterface.NoteInterface;
5252
import org.unitime.timetable.gwt.shared.EventInterface.ResourceInterface;
5353
import org.unitime.timetable.gwt.shared.EventInterface.ResourceType;
54+
import org.unitime.timetable.gwt.shared.EventInterface.SessionInterface;
5455
import org.unitime.timetable.gwt.shared.EventInterface.SponsoringOrganizationInterface;
5556
import org.unitime.timetable.model.ClassEvent;
5657
import org.unitime.timetable.model.ClassInstructor;
@@ -1613,6 +1614,7 @@ else if (request.getResourceExternalId() != null)
16131614
}
16141615
CourseOffering correctedOffering = clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalOffering().getControllingCourseOffering();
16151616
event.setDeptCode(correctedOffering.getDepartment().getDeptCode());
1617+
event.setSession(toSessionInterface(correctedOffering.getInstructionalOffering().getSession()));
16161618
List<CourseOffering> courses = new ArrayList<CourseOffering>(clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalOffering().getCourseOfferings());
16171619
boolean instructing = false;
16181620
if (request.getResourceType() == ResourceType.PERSON && request.getResourceExternalId() != null) {
@@ -1708,6 +1710,7 @@ else if (request.getResourceExternalId() != null)
17081710
ExamEvent xe = ExamEventDAO.getInstance().get(m.getEvent().getUniqueId(), hibSession);
17091711
event.setEnrollment(xe.getExam().countStudents());
17101712
event.setMaxCapacity(xe.getExam().getSize());
1713+
event.setSession(toSessionInterface(xe.getExam().getSession()));
17111714
if (groupEnrollments) {
17121715
int enrl = 0;
17131716
Set<Long> studentIds = xe.getExam().getStudentIds();
@@ -1863,7 +1866,8 @@ else if (request.getResourceExternalId() != null)
18631866
break;
18641867
}
18651868
}
1866-
}
1869+
if (event.getSession() == null)
1870+
event.setSession(toSessionInterface(owner.getCourse().getInstructionalOffering().getSession())); }
18671871
event.setEnrollment(enrl);
18681872
event.setMaxCapacity(cap);
18691873
}
@@ -1932,6 +1936,8 @@ else if (request.getResourceExternalId() != null)
19321936
location.setPartitionParentId(m.getLocation().getPartitionParentId());
19331937
location.setEventEmail(m.getLocation().getEventEmail());
19341938
meeting.setLocation(location);
1939+
if (event.getSession() == null)
1940+
event.setSession(toSessionInterface(m.getLocation().getSession()));
19351941
}
19361942
if (request.getEventFilter().hasOptions("flag") && request.getEventFilter().getOptions("flag").contains("Conflicts")) {
19371943
if (m.getLocation() != null && m.getLocation().getEventAvailability() != null && m.getLocation().getEventAvailability().length() == Constants.SLOTS_PER_DAY * Constants.DAY_CODES.length) {
@@ -2761,6 +2767,7 @@ else if (request.getResourceExternalId() != null)
27612767
event.setClassId(clazz.getUniqueId());
27622768
event.setSessionId(clazz.getSessionId());
27632769
event.setDeptCode(correctedOffering.getDepartment().getDeptCode());
2770+
event.setSession(toSessionInterface(correctedOffering.getInstructionalOffering().getSession()));
27642771
List<CourseOffering> courses = new ArrayList<CourseOffering>(clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalOffering().getCourseOfferings());
27652772
switch (request.getResourceType()) {
27662773
case CURRICULUM:
@@ -2985,5 +2992,14 @@ public static TreeSet<MeetingInterface> generateUnavailabilityMeetings(Location
29852992
}
29862993
return ret;
29872994
}
2995+
2996+
protected static SessionInterface toSessionInterface(Session session) {
2997+
SessionInterface ret = new SessionInterface();
2998+
ret.setId(session.getUniqueId());
2999+
ret.setTerm(session.getAcademicTerm());
3000+
ret.setYear(session.getAcademicYear());
3001+
ret.setInitiative(session.getAcademicInitiative());
3002+
return ret;
3003+
}
29883004

29893005
}

JavaSource/org/unitime/timetable/gwt/shared/EventInterface.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public class EventInterface implements Comparable<EventInterface>, IsSerializabl
7676
private Set<EventServiceProviderInterface> iRequestedServices = null;
7777
private Long iClassId = null, iSessionId = null;
7878
private String iDeptCode = null;
79+
private SessionInterface iSession = null;
7980

8081
public static enum ResourceType implements IsSerializable {
8182
ROOM("Room Timetable","room", true),
@@ -397,6 +398,8 @@ public String getRequestedServices(String separator) {
397398

398399
public Long getSessionId() { return iSessionId; }
399400
public void setSessionId(Long sessionId) { iSessionId = sessionId; }
401+
public SessionInterface getSession() { return iSession; }
402+
public void setSession(SessionInterface session) { iSession = session; }
400403
public Long getClassId() { return iClassId; }
401404
public void setClassId(Long classId) { iClassId = classId; }
402405

@@ -452,6 +455,7 @@ public EventInterface createConflictingEvent(EventInterface event) {
452455
conflict.setInstructionType(event.getInstructionType());
453456
conflict.setSectionNumber(event.getSectionNumber());
454457
conflict.setDeptCode(event.getDeptCode());
458+
conflict.setSession(event.getSession());
455459
if (event.hasCourseIds())
456460
for (Long courseId: event.getCourseIds())
457461
conflict.addCourseId(courseId);
@@ -2844,4 +2848,28 @@ public SendStudentEmailsRpcRequest() {}
28442848
public Set<Long> getStudentIds() { return iStudentIds; }
28452849
public void setStudentIds(Set<Long> studentIds) { iStudentIds = studentIds; }
28462850
}
2851+
2852+
public static class SessionInterface implements IsSerializable {
2853+
private Long iSessionId = null;
2854+
private String iTerm;
2855+
private String iYear;
2856+
private String iInitiative;
2857+
2858+
public SessionInterface() {}
2859+
public SessionInterface(Long id, String term, String year, String initiative) {
2860+
iSessionId = id;
2861+
iTerm = term;
2862+
iYear = year;
2863+
iInitiative = initiative;
2864+
}
2865+
2866+
public Long getId() { return iSessionId; }
2867+
public void setId(Long id) { iSessionId = id; }
2868+
public String getTerm() { return iTerm; }
2869+
public void setTerm(String term) { iTerm = term; }
2870+
public String getYear() { return iYear; }
2871+
public void setYear(String year) { iYear = year; }
2872+
public String getInitiative() { return iInitiative; }
2873+
public void setInitiative(String initiative) { iInitiative = initiative; }
2874+
}
28472875
}

0 commit comments

Comments
 (0)