001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/course-management/tags/sakai_2-4-1/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/CourseOfferingCmImpl.java $
003: * $Id: CourseOfferingCmImpl.java 20400 2007-01-17 22:49:05Z jholtzman@berkeley.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.coursemanagement.impl;
021:
022: import java.io.Serializable;
023: import java.util.Date;
024: import java.util.HashSet;
025: import java.util.Iterator;
026: import java.util.Set;
027:
028: import org.sakaiproject.coursemanagement.api.AcademicSession;
029: import org.sakaiproject.coursemanagement.api.CanonicalCourse;
030: import org.sakaiproject.coursemanagement.api.CourseOffering;
031: import org.sakaiproject.coursemanagement.api.CourseSet;
032:
033: public class CourseOfferingCmImpl extends CrossListableCmImpl implements
034: CourseOffering, Serializable {
035:
036: private static final long serialVersionUID = 1L;
037:
038: private String status;
039: private CanonicalCourse canonicalCourse;
040: private String canonicalCourseEid;
041: private AcademicSession academicSession;
042: private CrossListingCmImpl crossListingCmImpl;
043: private Set courseSets;
044: private Date startDate;
045: private Date endDate;
046:
047: /** A cache of courseSetEids */
048: private Set courseSetEids;
049:
050: public CourseOfferingCmImpl() {
051: }
052:
053: public CourseOfferingCmImpl(String eid, String title,
054: String description, String status,
055: AcademicSession academicSession,
056: CanonicalCourse canonicalCourse, Date startDate,
057: Date endDate) {
058: this .eid = eid;
059: this .title = title;
060: this .description = description;
061: this .status = status;
062: this .academicSession = academicSession;
063: this .canonicalCourse = canonicalCourse;
064: if (canonicalCourse == null) {
065: this .canonicalCourseEid = null;
066: } else {
067: this .canonicalCourseEid = canonicalCourse.getEid();
068: }
069: this .startDate = startDate;
070: this .endDate = endDate;
071: }
072:
073: public Set getCourseSets() {
074: return courseSets;
075: }
076:
077: public void setCourseSets(Set courseSets) {
078: this .courseSets = courseSets;
079:
080: // Update our cache of courseSetEids
081: if (courseSets == null) {
082: courseSetEids = new HashSet();
083: } else {
084: courseSetEids = new HashSet(courseSets.size());
085: for (Iterator iter = courseSets.iterator(); iter.hasNext();) {
086: CourseSet courseSet = (CourseSet) iter.next();
087: courseSetEids.add(courseSet.getEid());
088: }
089: }
090: }
091:
092: public CrossListingCmImpl getCrossListing() {
093: return crossListingCmImpl;
094: }
095:
096: public void setCrossListing(CrossListingCmImpl crossListingCmImpl) {
097: this .crossListingCmImpl = crossListingCmImpl;
098: }
099:
100: public CanonicalCourse getCanonicalCourse() {
101: return canonicalCourse;
102: }
103:
104: public void setCanonicalCourse(CanonicalCourse canonicalCourse) {
105: this .canonicalCourse = canonicalCourse;
106: if (canonicalCourse == null) {
107: this .canonicalCourseEid = null;
108: } else {
109: this .canonicalCourseEid = canonicalCourse.getEid();
110: }
111: }
112:
113: public AcademicSession getAcademicSession() {
114: return academicSession;
115: }
116:
117: public void setAcademicSession(AcademicSession academicSession) {
118: this .academicSession = academicSession;
119: }
120:
121: public Date getEndDate() {
122: return endDate;
123: }
124:
125: public void setEndDate(Date endDate) {
126: this .endDate = endDate;
127: }
128:
129: public Date getStartDate() {
130: return startDate;
131: }
132:
133: public void setStartDate(Date startDate) {
134: this .startDate = startDate;
135: }
136:
137: public String getCanonicalCourseEid() {
138: return canonicalCourseEid;
139: }
140:
141: public Set getCourseSetEids() {
142: return courseSetEids;
143: }
144:
145: public String getStatus() {
146: return status;
147: }
148:
149: public void setStatus(String status) {
150: this.status = status;
151: }
152: }
|