001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/common/api/src/java/org/theospi/portfolio/shared/model/EvaluationContentWrapper.java $
003: * $Id: EvaluationContentWrapper.java 18220 2006-11-17 21:57:46Z chmaurer@iupui.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.theospi.portfolio.shared.model;
021:
022: import java.util.Date;
023: import java.util.HashSet;
024: import java.util.Set;
025:
026: import org.sakaiproject.exception.IdUnusedException;
027: import org.sakaiproject.metaobj.shared.model.Agent;
028: import org.sakaiproject.metaobj.shared.model.Id;
029: import org.sakaiproject.site.api.Site;
030: import org.sakaiproject.site.cover.SiteService;
031: import org.sakaiproject.user.api.User;
032: import org.sakaiproject.user.api.UserNotDefinedException;
033: import org.sakaiproject.user.cover.UserDirectoryService;
034:
035: public abstract class EvaluationContentWrapper {
036:
037: private Id id;
038: private String title;
039: private User owner;
040: private Date submittedDate;
041: private String evalType;
042: private String url;
043: private Set urlParams = new HashSet();
044: private String siteTitle;
045:
046: public EvaluationContentWrapper() {
047: ;
048: }
049:
050: public EvaluationContentWrapper(Id id, String title, Agent owner,
051: Date submittedDate, String siteId)
052: throws UserNotDefinedException {
053: this .id = id;
054: this .title = title;
055: this .submittedDate = submittedDate;
056:
057: this .owner = UserDirectoryService.getUser(owner.getId()
058: .getValue());
059: this .siteTitle = fetchSiteName(siteId);
060: }
061:
062: public EvaluationContentWrapper(Id id, String title, Agent owner,
063: Date submittedDate, String type, String siteType,
064: String siteId) throws UserNotDefinedException {
065:
066: this .id = id;
067: this .title = title;
068: this .submittedDate = submittedDate;
069:
070: this .owner = UserDirectoryService.getUser(owner.getId()
071: .getValue());
072: this .evalType = type;
073: this .siteTitle = fetchSiteName(siteId);
074:
075: }
076:
077: public EvaluationContentWrapper(Id id, String title, User owner,
078: Date submittedDate) {
079: this .id = id;
080: this .title = title;
081: this .owner = owner;
082: this .submittedDate = submittedDate;
083: }
084:
085: public class ParamBean {
086:
087: private String key;
088: private String value;
089:
090: public ParamBean(String key, String value) {
091: this .key = key;
092: this .value = value;
093: }
094:
095: /**
096: * @return Returns the key.
097: */
098: public String getKey() {
099: return key;
100: }
101:
102: /**
103: * @param key The key to set.
104: */
105: public void setKey(String key) {
106: this .key = key;
107: }
108:
109: /**
110: * @return Returns the value.
111: */
112: public String getValue() {
113: return value;
114: }
115:
116: /**
117: * @param value The value to set.
118: */
119: public void setValue(String value) {
120: this .value = value;
121: }
122:
123: }
124:
125: public String fetchSiteName(String siteId) {
126: String title = null;
127: try {
128: Site site = SiteService.getSite(siteId);
129: title = site.getTitle();
130: } catch (IdUnusedException e) {
131: // TODO Auto-generated catch block
132: e.printStackTrace();
133: }
134: return title;
135: }
136:
137: /**
138: * @return Returns the owner.
139: */
140: public User getOwner() {
141: return owner;
142: }
143:
144: /**
145: * @param owner The owner to set.
146: */
147: public void setOwner(User owner) {
148: this .owner = owner;
149: }
150:
151: /**
152: * @return Returns the submittedDate.
153: */
154: public Date getSubmittedDate() {
155: return submittedDate;
156: }
157:
158: /**
159: * @param submittedDate The submittedDate to set.
160: */
161: public void setSubmittedDate(Date submittedDate) {
162: this .submittedDate = submittedDate;
163: }
164:
165: /**
166: * @return Returns the title.
167: */
168: public String getTitle() {
169: return title;
170: }
171:
172: /**
173: * @param title The title to set.
174: */
175: public void setTitle(String title) {
176: this .title = title;
177: }
178:
179: /**
180: * @return Returns the id.
181: */
182: public Id getId() {
183: return id;
184: }
185:
186: /**
187: * @param id The id to set.
188: */
189: public void setId(Id id) {
190: this .id = id;
191: }
192:
193: /**
194: * @return Returns the evalType.
195: */
196: public String getEvalType() {
197: return evalType;
198: }
199:
200: /**
201: * @param evalType The evalType to set.
202: */
203: public void setEvalType(String evalType) {
204: this .evalType = evalType;
205: }
206:
207: /**
208: * @return Returns the url.
209: */
210: public String getUrl() {
211: return url;
212: }
213:
214: /**
215: * @param url The url to set.
216: */
217: public void setUrl(String url) {
218: this .url = url;
219: }
220:
221: /**
222: * returns the url parameters to be passed along
223: * @return Set of ParamBean.
224: */
225: public Set getUrlParams() {
226: return urlParams;
227: }
228:
229: /**
230: * @param urlParams The urlParams to set.
231: */
232: public void setUrlParams(Set urlParams) {
233: this .urlParams = urlParams;
234: }
235:
236: /**
237: * @return the siteTitle
238: */
239: public String getSiteTitle() {
240: return siteTitle;
241: }
242:
243: /**
244: * @param siteTitle the siteTitle to set
245: */
246: public void setSiteTitle(String siteTitle) {
247: this.siteTitle = siteTitle;
248: }
249: }
|