01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/matrix/tool/src/java/org/theospi/portfolio/matrix/control/ListScaffoldingController.java $
03: * $Id:ListScaffoldingController.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006, 2007 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.ArrayList;
23: import java.util.Hashtable;
24: import java.util.List;
25: import java.util.Map;
26:
27: import org.apache.commons.logging.Log;
28: import org.apache.commons.logging.LogFactory;
29: import org.sakaiproject.metaobj.shared.model.Agent;
30: import org.sakaiproject.metaobj.utils.mvc.intf.ListScrollIndexer;
31: import org.sakaiproject.tool.cover.ToolManager;
32: import org.springframework.validation.Errors;
33: import org.springframework.web.servlet.ModelAndView;
34:
35: public class ListScaffoldingController extends AbstractMatrixController {
36:
37: protected final Log logger = LogFactory.getLog(getClass());
38: private ListScrollIndexer listScrollIndexer;
39:
40: public ModelAndView handleRequest(Object requestModel, Map request,
41: Map session, Map application, Errors errors) {
42: Hashtable<String, Object> model = new Hashtable<String, Object>();
43: Agent currentAgent = getAuthManager().getAgent();
44: String currentToolId = ToolManager.getCurrentPlacement()
45: .getId();
46: String worksiteId = getWorksiteManager().getCurrentWorksiteId()
47: .getValue();
48:
49: List scaffolding = new ArrayList(getMatrixManager()
50: .findAvailableScaffolding(worksiteId, currentAgent));
51:
52: // When selecting a matrix the user should start with a fresh user
53: session.remove(ViewMatrixController.VIEW_USER);
54:
55: model.put("scaffolding", getListScrollIndexer().indexList(
56: request, model, scaffolding));
57:
58: model.put("worksite", getWorksiteManager().getSite(worksiteId));
59: model.put("tool", getWorksiteManager().getTool(currentToolId));
60: model.put("isMaintainer", isMaintainer());
61: model.put("osp_agent", currentAgent);
62:
63: model.put("useExperimentalMatrix", getMatrixManager()
64: .isUseExperimentalMatrix());
65:
66: return new ModelAndView("success", model);
67: }
68:
69: public ListScrollIndexer getListScrollIndexer() {
70: return listScrollIndexer;
71: }
72:
73: public void setListScrollIndexer(ListScrollIndexer listScrollIndexer) {
74: this.listScrollIndexer = listScrollIndexer;
75: }
76: }
|