001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/portal/tool/src/java/org/theospi/portfolio/portal/tool/ToolCategoryTool.java $
003: * $Id:ToolCategoryTool.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.portal.tool;
021:
022: import java.io.InputStream;
023:
024: import javax.faces.context.ExternalContext;
025: import javax.faces.context.FacesContext;
026:
027: import org.theospi.jsf.intf.XmlTagFactory;
028: import org.theospi.portfolio.portal.intf.PortalManager;
029: import org.theospi.portfolio.portal.model.ToolCategory;
030: import org.theospi.portfolio.shared.tool.HelperToolBase;
031:
032: /**
033: * Created by IntelliJ IDEA.
034: * User: John Ellis
035: * Date: Feb 16, 2006
036: * Time: 4:48:40 PM
037: * To change this template use File | Settings | File Templates.
038: */
039: public class ToolCategoryTool extends HelperToolBase {
040:
041: private XmlTagFactory factory;
042: private PortalManager portalManager;
043: private String siteTypeKey;
044: private String toolCategoryKey;
045: private String siteId;
046: private String context;
047:
048: public InputStream getXmlFile() {
049: String context = (String) getAttribute(PortalManager.CONTEXT);
050: String siteType = (String) getAttribute(PortalManager.SITE_TYPE);
051: String siteId = (String) getAttribute(PortalManager.SITE_ID);
052: String toolCategoryKey = (String) getAttribute(PortalManager.TOOL_CATEGORY);
053: setSiteTypeKey(siteType);
054: setSiteId(siteId);
055: setToolCategoryKey(toolCategoryKey);
056: setContext(context);
057: ToolCategory toolCategory = getPortalManager().getToolCategory(
058: siteType, toolCategoryKey);
059:
060: ExternalContext exContext = FacesContext.getCurrentInstance()
061: .getExternalContext();
062: return exContext.getResourceAsStream(toolCategory
063: .getHomePagePath());
064: }
065:
066: public XmlTagFactory getFactory() {
067: return factory;
068: }
069:
070: public void setFactory(XmlTagFactory factory) {
071: this .factory = factory;
072: }
073:
074: public PortalManager getPortalManager() {
075: return portalManager;
076: }
077:
078: public void setPortalManager(PortalManager portalManager) {
079: this .portalManager = portalManager;
080: }
081:
082: public String getSiteTypeKey() {
083: return siteTypeKey;
084: }
085:
086: public void setSiteTypeKey(String siteTypeKey) {
087: this .siteTypeKey = siteTypeKey;
088: }
089:
090: public String getToolCategoryKey() {
091: return toolCategoryKey;
092: }
093:
094: public void setToolCategoryKey(String toolCategoryKey) {
095: this .toolCategoryKey = toolCategoryKey;
096: }
097:
098: public String getSiteId() {
099: return siteId;
100: }
101:
102: public void setSiteId(String siteId) {
103: this .siteId = siteId;
104: }
105:
106: public String getContext() {
107: return context;
108: }
109:
110: public void setContext(String context) {
111: this.context = context;
112: }
113: }
|