01: /*
02: * *********************************************************************************
03: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-util/tool-lib/src/java/org/sakaiproject/metaobj/shared/control/DeleteStructuredArtifactDefinitionController.java $
04: * $Id: DeleteStructuredArtifactDefinitionController.java 14230 2006-09-05 18:02:51Z chmaurer@iupui.edu $
05: * **********************************************************************************
06: *
07: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: * *********************************************************************************
22: *
23: */
24:
25: package org.sakaiproject.metaobj.shared.control;
26:
27: import org.sakaiproject.metaobj.shared.SharedFunctionConstants;
28: import org.sakaiproject.metaobj.shared.model.PersistenceException;
29: import org.sakaiproject.metaobj.shared.model.StructuredArtifactDefinitionBean;
30: import org.sakaiproject.metaobj.utils.mvc.intf.LoadObjectController;
31: import org.springframework.validation.Errors;
32: import org.springframework.web.servlet.ModelAndView;
33:
34: import java.util.Map;
35:
36: /**
37: * Created by IntelliJ IDEA.
38: * User: John Ellis
39: * Date: Jun 6, 2006
40: * Time: 6:57:42 AM
41: * To change this template use File | Settings | File Templates.
42: */
43: public class DeleteStructuredArtifactDefinitionController extends
44: PublishStructuredArtifactDefinitionController implements
45: LoadObjectController {
46:
47: public ModelAndView handleRequest(Object requestModel, Map request,
48: Map session, Map application, Errors errors) {
49: StructuredArtifactDefinitionBean sad = (StructuredArtifactDefinitionBean) requestModel;
50: checkPermission(SharedFunctionConstants.DELETE_ARTIFACT_DEF);
51: try {
52: getStructuredArtifactDefinitionManager().delete(sad);
53: } catch (PersistenceException e) {
54: errors.rejectValue(e.getField(), e.getErrorCode(), e
55: .getErrorInfo(), e.getDefaultMessage());
56: }
57: return prepareListView(request, sad.getId().getValue());
58: }
59:
60: }
|