01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/presentation/tool/src/java/org/theospi/portfolio/presentation/control/CommentListController.java $
03: * $Id:CommentListController.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.theospi.portfolio.presentation.control;
21:
22: import java.util.Hashtable;
23: import java.util.List;
24: import java.util.Map;
25:
26: import org.sakaiproject.metaobj.shared.model.Agent;
27: import org.sakaiproject.metaobj.utils.mvc.intf.CustomCommandController;
28: import org.sakaiproject.tool.cover.ToolManager;
29: import org.springframework.validation.Errors;
30: import org.springframework.web.servlet.ModelAndView;
31: import org.theospi.portfolio.presentation.CommentSortBy;
32: import org.theospi.portfolio.presentation.PresentationManager;
33:
34: /**
35: * Created by IntelliJ IDEA.
36: * User: John Ellis
37: * Date: Jun 1, 2004
38: * Time: 4:36:32 PM
39: * To change this template use File | Settings | File Templates.
40: */
41: public class CommentListController extends
42: AbstractPresentationController implements
43: CustomCommandController {
44:
45: private String type = null;
46:
47: public ModelAndView handleRequest(Object requestModel, Map request,
48: Map session, Map application, Errors errors) {
49: List commentList;
50: Agent agent = getAuthManager().getAgent();
51: PresentationManager presentationManager = getPresentationManager();
52: CommentSortBy sortBy = (CommentSortBy) requestModel;
53: String toolId = ToolManager.getCurrentPlacement().getId();
54: if (type.equals("owner")) {
55: commentList = presentationManager.getOwnerComments(agent,
56: toolId, sortBy, false);
57: } else {
58: commentList = presentationManager.getCreatorComments(agent,
59: toolId, sortBy);
60: }
61:
62: Map model = new Hashtable();
63: model.put("comments", commentList);
64: model.put("sortBy", requestModel);
65: model.put("currentAgent", getAuthManager().getAgent());
66:
67: return new ModelAndView("success", model);
68: }
69:
70: public String getType() {
71: return type;
72: }
73:
74: public void setType(String type) {
75: this .type = type;
76: }
77:
78: public Object formBackingObject(Map request, Map session,
79: Map application) {
80: return new CommentSortBy();
81: }
82: }
|