001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/common/api/src/java/org/theospi/portfolio/worksite/model/ToolConfigurationWrapper.java $
003: * $Id:ToolConfigurationWrapper.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.worksite.model;
021:
022: import java.io.Serializable;
023: import java.util.Properties;
024:
025: import org.apache.commons.logging.Log;
026: import org.apache.commons.logging.LogFactory;
027: import org.sakaiproject.exception.IdUnusedException;
028: import org.sakaiproject.site.api.Site;
029: import org.sakaiproject.site.api.SitePage;
030: import org.sakaiproject.site.api.ToolConfiguration;
031: import org.sakaiproject.site.cover.SiteService;
032: import org.sakaiproject.tool.api.Tool;
033: import org.theospi.portfolio.shared.model.OspException;
034:
035: public class ToolConfigurationWrapper implements Serializable,
036: ToolConfiguration {
037: protected final transient Log logger = LogFactory
038: .getLog(getClass());
039:
040: private ToolConfiguration toolConfig;
041:
042: public ToolConfigurationWrapper(ToolConfiguration toolConfig) {
043: this .toolConfig = toolConfig;
044: }
045:
046: public String getToolId() {
047: return toolConfig.getTool().getId();
048: }
049:
050: public String getTitle() {
051: return toolConfig.getTitle();
052: }
053:
054: public String getLayoutHints() {
055: return toolConfig.getLayoutHints();
056: }
057:
058: public int[] parseLayoutHints() {
059: return toolConfig.parseLayoutHints();
060: }
061:
062: public String getSkin() {
063: return toolConfig.getSkin();
064: }
065:
066: public String getPageId() {
067: return toolConfig.getPageId();
068: }
069:
070: public String getSiteId() {
071: return toolConfig.getSiteId();
072: }
073:
074: public SitePage getContainingPage() {
075: SitePage returned = toolConfig.getContainingPage();
076:
077: if (returned == null) {
078: Site site = null;
079: try {
080: site = SiteService.getSite(getSiteId());
081: } catch (IdUnusedException e) {
082: logger.error("", e);
083: throw new OspException(e);
084: }
085: returned = site.getPage(getPageId());
086: }
087: return returned;
088: }
089:
090: public String getId() {
091: if (toolConfig == null)
092: return null;
093: return toolConfig.getId();
094: }
095:
096: public void setLayoutHints(String layoutHints) {
097: toolConfig.setLayoutHints(layoutHints);
098: }
099:
100: public void moveUp() {
101: toolConfig.moveUp();
102: }
103:
104: public void moveDown() {
105: toolConfig.moveDown();
106: }
107:
108: public int getPageOrder() {
109: return toolConfig.getPageOrder();
110: }
111:
112: public Properties getConfig() {
113: return toolConfig.getConfig();
114: }
115:
116: public String getContext() {
117: return toolConfig.getContext();
118: }
119:
120: public Properties getPlacementConfig() {
121: return toolConfig.getPlacementConfig();
122: }
123:
124: public Tool getTool() {
125: return toolConfig.getTool();
126: }
127:
128: public void setTitle(String title) {
129: toolConfig.setTitle(title);
130: }
131:
132: public void setTool(String string, Tool tool) {
133: toolConfig.setTool(string, tool);
134: }
135:
136: public void save() {
137: toolConfig.save();
138: }
139: }
|