001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/syllabus/tags/sakai_2-4-1/syllabus-hbm/src/java/org/sakaiproject/component/app/syllabus/SyllabusDataImpl.java $
003: * $Id: SyllabusDataImpl.java 8802 2006-05-03 15:06:26Z cwen@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 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.component.app.syllabus;
021:
022: import java.util.Set;
023: import java.util.TreeSet;
024:
025: import org.sakaiproject.api.app.syllabus.SyllabusData;
026: import org.sakaiproject.api.app.syllabus.SyllabusItem;
027:
028: /**
029: * A syllabus item contains information relating to a syllabus and an order
030: * within a particular context (site).
031: *
032: * @author Jarrod Lannan
033: * @version $Id:
034: *
035: */
036:
037: public class SyllabusDataImpl implements SyllabusData, Comparable {
038: private Long syllabusId;
039: private String asset;
040: private Integer position;
041: private Integer lockId; // optimistic lock
042: //private Date version;
043: private String title;
044: private String view;
045: private String status;
046: private String emailNotification;
047: private Set attachments = new TreeSet();
048:
049: /**
050: * @return Returns the emailNotification.
051: */
052: public String getEmailNotification() {
053: return emailNotification;
054: }
055:
056: /**
057: * @param emailNotification The emailNotification to set.
058: */
059: public void setEmailNotification(String emailNotification) {
060: this .emailNotification = emailNotification;
061: }
062:
063: /**
064: * @return Returns the status.
065: */
066: public String getStatus() {
067: return status;
068: }
069:
070: /**
071: * @param status The status to set.
072: */
073: public void setStatus(String status) {
074: this .status = status;
075: }
076:
077: /**
078: * @return Returns the title.
079: */
080: public String getTitle() {
081: return title;
082: }
083:
084: /**
085: * @param title The title to set.
086: */
087: public void setTitle(String title) {
088: this .title = title;
089: }
090:
091: /**
092: * @return Returns the view.
093: */
094: public String getView() {
095: return view;
096: }
097:
098: /**
099: * @param view The view to set.
100: */
101: public void setView(String view) {
102: this .view = view;
103: }
104:
105: private SyllabusItem syllabusItem;
106:
107: /**
108: * @return Returns the assetId.
109: */
110: public String getAsset() {
111: return asset;
112: }
113:
114: /**
115: * @param assetId The assetId to set.
116: */
117: public void setAsset(String asset) {
118: this .asset = asset;
119: }
120:
121: /**
122: * @return Returns the lockId.
123: */
124: public Integer getLockId() {
125: return lockId;
126: }
127:
128: /**
129: * @param lockId The lockId to set.
130: */
131: public void setLockId(Integer lockId) {
132: this .lockId = lockId;
133: }
134:
135: /**
136: * @return Returns the position.
137: */
138: public Integer getPosition() {
139: return position;
140: }
141:
142: /**
143: * @param position The position to set.
144: */
145: public void setPosition(Integer position) {
146: this .position = position;
147: }
148:
149: /**
150: * @return Returns the syllabusId.
151: */
152: public Long getSyllabusId() {
153: return syllabusId;
154: }
155:
156: /**
157: * @param syllabusId The syllabusId to set.
158: */
159: public void setSyllabusId(Long syllabusId) {
160: this .syllabusId = syllabusId;
161: }
162:
163: /**
164: * @return Returns the syllabusItem.
165: */
166: public SyllabusItem getSyllabusItem() {
167: return syllabusItem;
168: }
169:
170: /**
171: * @param syllabusItem The syllabusItem to set.
172: */
173: public void setSyllabusItem(SyllabusItem syllabusItem) {
174: this .syllabusItem = syllabusItem;
175: }
176:
177: public Set getAttachments() {
178: return attachments;
179: }
180:
181: public void setAttachments(Set attachments) {
182: this .attachments = attachments;
183: }
184:
185: /**
186: * @see java.lang.Object#toString()
187: */
188: public String toString() {
189: StringBuffer sb = new StringBuffer();
190: sb.append("{syllabusId=");
191: sb.append(syllabusId);
192: sb.append(", syllabusItem=");
193: sb.append(syllabusItem);
194: sb.append(", assetId=");
195: sb.append(asset);
196: sb.append(", position=");
197: sb.append(position);
198: sb.append(", title=");
199: sb.append(title);
200: sb.append(", view=");
201: sb.append(view);
202: sb.append(", status=");
203: sb.append(status);
204: sb.append(", emailNotification=");
205: sb.append(emailNotification);
206: sb.append(", lockId=");
207: sb.append(lockId);
208: sb.append("}");
209: return sb.toString();
210: }
211:
212: /**
213: * @see java.lang.Object#equals(java.lang.Object)
214: */
215: public boolean equals(Object obj) {
216: if (this == obj)
217: return true;
218: if (!(obj instanceof SyllabusDataImpl))
219: return false;
220: SyllabusDataImpl other = (SyllabusDataImpl) obj;
221:
222: if ((syllabusId == null ? other.syllabusId == null : syllabusId
223: .equals(other.syllabusId))) {
224: return true;
225: }
226: return false;
227: }
228:
229: /**
230: * @see java.lang.Object#hashCode()
231: */
232: public int hashCode() {
233: return syllabusId.hashCode();
234: }
235:
236: public int compareTo(Object obj) {
237: return this .position.compareTo(((SyllabusData) obj)
238: .getPosition());
239: }
240: }
|