01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-util/tool-lib/src/java/org/sakaiproject/metaobj/shared/control/FormViewController.java $
03: * $Id: FormViewController.java 19974 2006-12-22 17:36:45Z john.ellis@rsmart.com $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 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.sakaiproject.metaobj.shared.control;
21:
22: import java.util.Map;
23:
24: import org.jdom.Document;
25: import org.jdom.Element;
26: import org.sakaiproject.content.api.ResourceEditingHelper;
27: import org.sakaiproject.content.cover.ContentHostingService;
28: import org.sakaiproject.metaobj.shared.mgt.StructuredArtifactDefinitionManager;
29: import org.sakaiproject.metaobj.shared.mgt.IdManager;
30: import org.sakaiproject.metaobj.shared.model.StructuredArtifact;
31: import org.sakaiproject.metaobj.shared.ArtifactFinder;
32: import org.sakaiproject.metaobj.utils.mvc.intf.Controller;
33: import org.sakaiproject.tool.api.Tool;
34: import org.sakaiproject.tool.cover.ToolManager;
35: import org.springframework.validation.Errors;
36: import org.springframework.web.servlet.ModelAndView;
37:
38: /**
39: * Created by IntelliJ IDEA.
40: * User: John Ellis
41: * Date: Feb 7, 2006
42: * Time: 11:34:11 AM
43: * To change this template use File | Settings | File Templates.
44: */
45: public class FormViewController implements Controller {
46:
47: private ArtifactFinder artifactFinder;
48: private IdManager idManager;
49:
50: public ModelAndView handleRequest(Object requestModel, Map request,
51: Map session, Map application, Errors errors) {
52: String idString = ContentHostingService
53: .getUuid((String) session
54: .get(ResourceEditingHelper.ATTACHMENT_ID));
55:
56: StructuredArtifact bean = (StructuredArtifact) getArtifactFinder()
57: .load(getIdManager().getId(idString));
58:
59: return new ModelAndView("success", "bean", bean);
60: }
61:
62: public ArtifactFinder getArtifactFinder() {
63: return artifactFinder;
64: }
65:
66: public void setArtifactFinder(ArtifactFinder artifactFinder) {
67: this .artifactFinder = artifactFinder;
68: }
69:
70: public IdManager getIdManager() {
71: return idManager;
72: }
73:
74: public void setIdManager(IdManager idManager) {
75: this.idManager = idManager;
76: }
77:
78: }
|