01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/matrix/tool/src/java/org/theospi/portfolio/matrix/control/RemoveLevCritConfirmationController.java $
03: * $Id: RemoveLevCritConfirmationController.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.mgt.IdManager;
28: import org.sakaiproject.metaobj.shared.model.Id;
29: import org.sakaiproject.metaobj.utils.mvc.intf.CustomCommandController;
30: import org.springframework.validation.Errors;
31: import org.springframework.web.servlet.ModelAndView;
32:
33: public class RemoveLevCritConfirmationController implements
34: CustomCommandController {
35:
36: protected final Log logger = LogFactory.getLog(getClass());
37: private IdManager idManager = null;
38:
39: public Object formBackingObject(Map request, Map session,
40: Map application) {
41: return new HashMap();
42: }
43:
44: public ModelAndView handleRequest(Object requestModel, Map request,
45: Map session, Map application, Errors errors) {
46: String viewName = "success";
47: Id id = idManager.getId((String) request.get("scaffolding_id"));
48:
49: Map model = new HashMap();
50:
51: String cancel = (String) request.get("cancel");
52: String next = (String) request.get("continue");
53: if (cancel != null) {
54: viewName = "cancel";
55: model.put("scaffolding_id", id);
56: } else if (next != null) {
57: viewName = (String) request.get("finalDest");
58: String params = (String) request.get("params");
59: if (!params.equals("")) {
60: String[] paramsList = params.split(":");
61: for (int i = 0; i < paramsList.length; i++) {
62: String[] pair = paramsList[i].split("=");
63: String val = null;
64: if (pair.length > 1)
65: val = pair[1];
66: model.put(pair[0], val);
67: }
68: }
69: }
70:
71: return new ModelAndView(viewName, model);
72: }
73:
74: public IdManager getIdManager() {
75: return idManager;
76: }
77:
78: public void setIdManager(IdManager idManager) {
79: this.idManager = idManager;
80: }
81: }
|