01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/presentation/tool/src/java/org/theospi/portfolio/presentation/control/DeleteCommentController.java $
03: * $Id:DeleteCommentController.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.Map;
23:
24: import org.sakaiproject.metaobj.utils.mvc.intf.Controller;
25: import org.springframework.validation.Errors;
26: import org.springframework.web.servlet.ModelAndView;
27: import org.theospi.portfolio.presentation.model.PresentationComment;
28: import org.theospi.portfolio.security.AuthorizationFailedException;
29:
30: /**
31: * Created by IntelliJ IDEA.
32: * User: John Ellis
33: * Date: Jun 1, 2004
34: * Time: 1:46:07 PM
35: * To change this template use File | Settings | File Templates.
36: */
37: public class DeleteCommentController extends
38: AbstractPresentationController implements Controller {
39:
40: public ModelAndView handleRequest(Object requestModel, Map request,
41: Map session, Map application, Errors errors) {
42: PresentationComment comment = (PresentationComment) requestModel;
43:
44: comment = getPresentationManager().getPresentationComment(
45: comment.getId());
46:
47: if (!comment.getCreator().equals(getAuthManager().getAgent())) {
48: throw new AuthorizationFailedException();
49: }
50:
51: getPresentationManager().deletePresentationComment(comment);
52:
53: return new ModelAndView("success", "id", comment
54: .getPresentation().getId());
55: }
56:
57: }
|