001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueriesAPI.java $
003: * $Id: PublishedAssessmentFacadeQueriesAPI.java 9273 2006-05-10 22:34:28Z daisyf@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.tool.assessment.facade;
021:
022: import java.util.ArrayList;
023: import java.util.HashMap;
024: import java.util.HashSet;
025: import java.util.List;
026: import java.util.Set;
027:
028: import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentAccessControl;
029: import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData;
030: import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentFeedback;
031: import org.sakaiproject.tool.assessment.data.dao.assessment.EvaluationModel;
032: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAccessControl;
033: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAnswer;
034: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedAssessmentData;
035: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedEvaluationModel;
036: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedFeedback;
037: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedItemData;
038: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedItemText;
039: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedMetaData;
040: import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedSectionData;
041: import org.sakaiproject.tool.assessment.osid.shared.impl.IdImpl;
042: import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc;
043:
044: public interface PublishedAssessmentFacadeQueriesAPI {
045:
046: public IdImpl getId(String id);
047:
048: public IdImpl getId(Long id);
049:
050: public IdImpl getId(long id);
051:
052: public IdImpl getAssessmentId(String id);
053:
054: public IdImpl getAssessmentId(Long id);
055:
056: public IdImpl getAssessmentId(long id);
057:
058: public IdImpl getAssessmentTemplateId(String id);
059:
060: public IdImpl getAssessmentTemplateId(Long id);
061:
062: public IdImpl getAssessmentTemplateId(long id);
063:
064: public PublishedAssessmentData preparePublishedAssessment(
065: AssessmentData a);
066:
067: public PublishedFeedback preparePublishedFeedback(
068: PublishedAssessmentData p, AssessmentFeedback a);
069:
070: public PublishedAccessControl preparePublishedAccessControl(
071: PublishedAssessmentData p, AssessmentAccessControl a);
072:
073: public PublishedEvaluationModel preparePublishedEvaluationModel(
074: PublishedAssessmentData p, EvaluationModel e);
075:
076: public Set preparePublishedMetaDataSet(PublishedAssessmentData p,
077: Set metaDataSet);
078:
079: public Set preparePublishedSecuredIPSet(PublishedAssessmentData p,
080: Set ipSet);
081:
082: public Set preparePublishedSectionSet(
083: PublishedAssessmentData publishedAssessment,
084: Set sectionSet, String protocol);
085:
086: public Set preparePublishedSectionMetaDataSet(
087: PublishedSectionData publishedSection, Set metaDataSet);
088:
089: public Set preparePublishedItemSet(
090: PublishedSectionData publishedSection, Set itemSet,
091: String protocol);
092:
093: public Set preparePublishedItemTextSet(
094: PublishedItemData publishedItem, Set itemTextSet);
095:
096: public Set preparePublishedItemMetaDataSet(
097: PublishedItemData publishedItem, Set itemMetaDataSet);
098:
099: public Set preparePublishedItemFeedbackSet(
100: PublishedItemData publishedItem, Set itemFeedbackSet);
101:
102: public Set preparePublishedAnswerSet(
103: PublishedItemText publishedItemText, Set answerSet);
104:
105: public Set preparePublishedAnswerFeedbackSet(
106: PublishedAnswer publishedAnswer, Set answerFeedbackSet);
107:
108: public PublishedAssessmentFacade getPublishedAssessment(
109: Long assessmentId);
110:
111: public Long getPublishedAssessmentId(Long assessmentId);
112:
113: public PublishedAssessmentFacade publishAssessment(
114: AssessmentFacade assessment) throws Exception;
115:
116: public PublishedAssessmentFacade publishPreviewAssessment(
117: AssessmentFacade assessment);
118:
119: public void createAuthorization(PublishedAssessmentData p);
120:
121: public AssessmentData loadAssessment(Long assessmentId);
122:
123: public PublishedAssessmentData loadPublishedAssessment(
124: Long assessmentId);
125:
126: public ArrayList getAllTakeableAssessments(String orderBy,
127: boolean ascending, Integer status);
128:
129: /**
130: public ArrayList getAllPublishedAssessmentId() {
131:
132: ArrayList list = getBasicInfoOfAllActivePublishedAssessments("title", true);
133: ArrayList publishedIds = new ArrayList();
134: for (int i = 0; i < list.size(); i++) {
135: PublishedAssessmentFacade f = (PublishedAssessmentFacade) list.get(i);
136: Long publishedId = f.getPublishedAssessmentId();
137: publishedIds.add(publishedId);
138: }
139: return publishedIds;
140:
141: }
142: */
143:
144: public Integer getNumberOfSubmissions(String publishedAssessmentId,
145: String agentId);
146:
147: public List getNumberOfSubmissionsOfAllAssessmentsByAgent(
148: String agentId);
149:
150: /**
151: public ArrayList getAllReviewableAssessments(String orderBy,
152: boolean ascending) {
153:
154: ArrayList publishedIds = getAllPublishedAssessmentId();
155: ArrayList newlist = new ArrayList();
156: for (int i = 0; i < publishedIds.size(); i++) {
157: String publishedId = ( (Long) publishedIds.get(i)).toString();
158: String query = "from AssessmentGradingData a where a.publishedAssessment.publishedAssessmentId=? order by agentId ASC," +
159: orderBy;
160: if (ascending) {
161: query += " asc,";
162: }
163: else {
164: query += " desc,";
165: }
166: query += "submittedDate DESC";
167: List list = getHibernateTemplate().find(query, new Long(publishedId),
168: Hibernate.LONG);
169: if (!list.isEmpty()) {
170: Iterator items = list.iterator();
171: String agentid = null;
172: AssessmentGradingData data = (AssessmentGradingData) items.next();
173: agentid = data.getAgentId();
174: newlist.add(data);
175: while (items.hasNext()) {
176: while (items.hasNext()) {
177: data = (AssessmentGradingData) items.next();
178: if (!data.getAgentId().equals(agentid)) {
179: agentid = data.getAgentId();
180: newlist.add(data);
181: break;
182: }
183: }
184: }
185: }
186: }
187: ArrayList assessmentList = new ArrayList();
188: for (int i = 0; i < newlist.size(); i++) {
189: AssessmentGradingData a = (AssessmentGradingData) newlist.get(i);
190: AssessmentGradingFacade f = new AssessmentGradingFacade(a);
191: assessmentList.add(f);
192: }
193: return assessmentList;
194: }
195: */
196: public ArrayList getAllPublishedAssessments(String sortString);
197:
198: public ArrayList getAllPublishedAssessments(String sortString,
199: Integer status);
200:
201: public ArrayList getAllPublishedAssessments(int pageSize,
202: int pageNumber, String sortString, Integer status);
203:
204: public void removeAssessment(Long assessmentId);
205:
206: public void saveOrUpdate(PublishedAssessmentIfc assessment)
207: throws Exception;
208:
209: public void delete(PublishedAssessmentIfc assessment);
210:
211: public ArrayList getBasicInfoOfAllActivePublishedAssessments(
212: String sortString, String siteAgentId, boolean ascending);
213:
214: /**
215: * According to Marc inactive means either the dueDate or the retractDate has
216: * passed for 1.5 release (IM on 12/17/04)
217: * @param sortString
218: * @return
219: */
220: public ArrayList getBasicInfoOfAllInActivePublishedAssessments(
221: String sortString, String siteAgentId, boolean ascending);
222:
223: /** return a set of PublishedSectionData
224: * IMPORTANT:
225: * 1. we have declared SectionData as lazy loading, so we need to
226: * initialize it using getHibernateTemplate().initialize(java.lang.Object).
227: * Unfortunately, we are using Spring 1.0.2 which does not support this
228: * Hibernate feature. I tried upgrading Spring to 1.1.3. Then it failed
229: * to load all the OR maps correctly. So for now, I am just going to
230: * initialize it myself. I will take a look at it again next year.
231: * - daisyf (12/13/04)
232: */
233: public HashSet getSectionSetForAssessment(
234: PublishedAssessmentIfc assessment);
235:
236: // IMPORTANT:
237: // 1. we do not want any Section info, so set loadSection to false
238: // 2. We have also declared SectionData as lazy loading. If loadSection is set
239: // to true, we will see null pointer
240: public PublishedAssessmentFacade getSettingsOfPublishedAssessment(
241: Long assessmentId);
242:
243: public PublishedItemData loadPublishedItem(Long itemId);
244:
245: public PublishedItemText loadPublishedItemText(Long itemTextId);
246:
247: // added by daisy - please check the logic - I based this on the getBasicInfoOfAllActiveAssessment
248: public ArrayList getBasicInfoOfAllPublishedAssessments(
249: String orderBy, boolean ascending, Integer status,
250: String siteId);
251:
252: /**
253: * return an array list of the last AssessmentGradingFacade per assessment that
254: * a user has submitted for grade.
255: * @param agentId
256: * @param orderBy
257: * @param ascending
258: * @return
259: */
260: public ArrayList getBasicInfoOfLastSubmittedAssessments(
261: String agentId, String orderBy, boolean ascending);
262:
263: /** total submitted for grade
264: * returns HashMap (Long publishedAssessmentId, Integer totalSubmittedForGrade);
265: */
266: public HashMap getTotalSubmissionPerAssessment(String agentId);
267:
268: public HashMap getTotalSubmissionPerAssessment(String agentId,
269: String siteId);
270:
271: public Integer getTotalSubmission(String agentId,
272: Long publishedAssessmentId);
273:
274: public PublishedAssessmentFacade getPublishedAssessmentIdByAlias(
275: String alias);
276:
277: public PublishedAssessmentFacade getPublishedAssessmentIdByMetaLabel(
278: String label, String entry);
279:
280: public void saveOrUpdateMetaData(PublishedMetaData meta);
281:
282: public HashMap getFeedbackHash();
283:
284: /** this return a HashMap containing
285: * (Long publishedAssessmentId, PublishedAssessmentFacade publishedAssessment)
286: * Note that the publishedAssessment is a partial object used for display only.
287: * do not use it for persisting. It only contains title, releaseTo, startDate, dueDate
288: * & retractDate
289: */
290: public HashMap getAllAssessmentsReleasedToAuthenticatedUsers();
291:
292: public String getPublishedAssessmentOwner(
293: String publishedAssessmentId);
294:
295: public boolean publishedAssessmentTitleIsUnique(
296: Long assessmentBaseId, String title);
297:
298: public boolean hasRandomPart(Long publishedAssessmentId);
299:
300: public PublishedItemData getFirstPublishedItem(
301: Long publishedAssessmentId);
302:
303: public List getPublishedItemIds(Long publishedAssessmentId);
304:
305: public HashSet getPublishedItemSet(Long publishedAssessmentId,
306: Long sectionId);
307:
308: public Long getItemType(Long publishedItemId);
309:
310: public HashSet getSectionSetForAssessment(Long publishedAssessmentId);
311:
312: public boolean isRandomDrawPart(Long publishedAssessmentId,
313: Long sectionId);
314:
315: /**
316: * return an array list of the AssessmentGradingFacade that
317: * a user has submitted for grade. one per published assessment.
318: * If an assessment allows multiple submissions and its grading option
319: * is to send highest, then return only the highest submission. If an assessment allows multiple submissions and its grading option
320: * is to send last, then return only the last submission.
321: * @param agentId
322: * @return
323: */
324: public ArrayList getBasicInfoOfLastOrHighestSubmittedAssessmentsByScoringOption(
325: String agentId, String siteId);
326:
327: public PublishedAssessmentData getBasicInfoOfPublishedAssessment(
328: Long publishedId);
329:
330: public String getPublishedAssessmentSiteId(
331: String publishedAssessmentId);
332:
333: }
|