01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/matrix/tool/src/java/org/theospi/portfolio/matrix/control/EditScaffoldingConfirmationController.java $
03: * $Id:EditScaffoldingConfirmationController.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.matrix.control;
21:
22: import java.util.HashMap;
23: import java.util.Map;
24:
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27: import org.sakaiproject.metaobj.shared.model.Id;
28: import org.sakaiproject.metaobj.utils.mvc.intf.Controller;
29: import org.sakaiproject.metaobj.utils.mvc.intf.FormController;
30: import org.springframework.validation.Errors;
31: import org.springframework.web.servlet.ModelAndView;
32: import org.theospi.portfolio.matrix.model.Scaffolding;
33:
34: public class EditScaffoldingConfirmationController extends
35: BaseScaffoldingController implements Controller, FormController {
36:
37: protected final Log logger = LogFactory.getLog(getClass());
38:
39: public ModelAndView handleRequest(Object requestModel, Map request,
40: Map session, Map application, Errors errors) {
41: String viewName = "success";
42:
43: EditedScaffoldingStorage sessionBean = (EditedScaffoldingStorage) session
44: .get(EditedScaffoldingStorage.EDITED_SCAFFOLDING_STORAGE_SESSION_KEY);
45: Scaffolding scaffolding = sessionBean.getScaffolding();
46:
47: Id id = scaffolding.getId();
48:
49: Map model = new HashMap();
50: model.put("scaffolding_id", id);
51:
52: String cancel = (String) request.get("cancel");
53: String next = (String) request.get("continue");
54: if (cancel != null) {
55: viewName = "cancel";
56: } else if (next != null) {
57: saveScaffolding(scaffolding);
58: }
59:
60: session
61: .remove(EditedScaffoldingStorage.STORED_SCAFFOLDING_FLAG);
62: session
63: .remove(EditedScaffoldingStorage.EDITED_SCAFFOLDING_STORAGE_SESSION_KEY);
64:
65: return new ModelAndView(viewName, model);
66: }
67:
68: public Map referenceData(Map request, Object command, Errors errors) {
69: Map model = new HashMap();
70: model.put("label", "Scaffolding");
71: model.put("isInSession",
72: EditedScaffoldingStorage.STORED_SCAFFOLDING_FLAG);
73: return model;
74: }
75: }
|