01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/matrix/tool/src/java/org/theospi/portfolio/matrix/control/ExposedScaffoldingController.java $
03: * $Id: ExposedScaffoldingController.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 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.Map;
23:
24: import org.sakaiproject.metaobj.shared.mgt.IdManager;
25: import org.sakaiproject.metaobj.shared.model.Id;
26: import org.sakaiproject.metaobj.utils.mvc.intf.FormController;
27: import org.springframework.validation.Errors;
28: import org.springframework.web.servlet.ModelAndView;
29: import org.theospi.portfolio.matrix.MatrixManager;
30: import org.theospi.portfolio.matrix.model.Scaffolding;
31:
32: public class ExposedScaffoldingController implements FormController {
33:
34: private MatrixManager matrixManager;
35: private IdManager idManager = null;
36:
37: public Map referenceData(Map request, Object command, Errors errors) {
38: // TODO Auto-generated method stub
39: return null;
40: }
41:
42: public ModelAndView handleRequest(Object requestModel, Map request,
43: Map session, Map application, Errors errors) {
44: Id scaffoldingId = getIdManager().getId(
45: (String) request.get("scaffolding_id"));
46: String expose = (String) request.get("expose");
47: Scaffolding scaffolding = getMatrixManager().getScaffolding(
48: scaffoldingId);
49: if (expose.equals("true")
50: && scaffolding.getExposedPageId() == null) {
51: getMatrixManager().exposeMatrixTool(scaffolding);
52: } else if (expose.equals("false")
53: && scaffolding.getExposedPageId() != null) {
54: getMatrixManager().removeExposedMatrixTool(scaffolding);
55: }
56: getMatrixManager().storeScaffolding(scaffolding);
57: return new ModelAndView("success");
58: }
59:
60: public IdManager getIdManager() {
61: return idManager;
62: }
63:
64: public void setIdManager(IdManager idManager) {
65: this .idManager = idManager;
66: }
67:
68: public MatrixManager getMatrixManager() {
69: return matrixManager;
70: }
71:
72: public void setMatrixManager(MatrixManager matrixManager) {
73: this.matrixManager = matrixManager;
74: }
75: }
|