01: /**********************************************************************************
02: *
03: * $Id: ContextManagementSakai2Impl.java 9271 2006-05-10 21:52:49Z ray@media.berkeley.edu $
04: *
05: ***********************************************************************************
06: *
07: * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: **********************************************************************************/package org.sakaiproject.tool.gradebook.facades.sakai2impl;
22:
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25: import org.sakaiproject.tool.api.Placement;
26: import org.sakaiproject.tool.cover.ToolManager;
27: import org.sakaiproject.tool.gradebook.facades.ContextManagement;
28:
29: /**
30: * Gets the current context for a gradebook inside sakai2.
31: *
32: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
33: */
34: public class ContextManagementSakai2Impl implements ContextManagement {
35: private static final Log log = LogFactory
36: .getLog(ContextManagementSakai2Impl.class);
37: private static final String DEFAULT_GRADEBOOK_NAME = "QA_6";
38:
39: /**
40: * @see org.sakaiproject.tool.gradebook.facades.ContextManagement#getGradebookUid(java.lang.Object)
41: */
42: public String getGradebookUid(Object notNeededInSakai) {
43: // get the Tool Placement, and return the tool's context if available
44: Placement placement = ToolManager.getCurrentPlacement();
45: if (placement == null) {
46: log.error("Placement is null");
47: return DEFAULT_GRADEBOOK_NAME;
48: }
49:
50: return placement.getContext();
51: }
52: }
|