001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/common/tool-lib/src/java/org/theospi/portfolio/style/tool/AbstractStyleController.java $
003: * $Id:AbstractStyleController.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.style.tool;
021:
022: import java.util.Collection;
023:
024: import org.apache.commons.logging.Log;
025: import org.apache.commons.logging.LogFactory;
026: import org.sakaiproject.metaobj.security.AuthenticationManager;
027: import org.sakaiproject.metaobj.shared.mgt.AgentManager;
028: import org.sakaiproject.metaobj.shared.mgt.IdManager;
029: import org.sakaiproject.metaobj.shared.model.Id;
030: import org.sakaiproject.metaobj.utils.mvc.intf.Controller;
031: import org.sakaiproject.metaobj.worksite.mgt.WorksiteManager;
032: import org.sakaiproject.tool.cover.ToolManager;
033: import org.theospi.portfolio.security.AuthorizationFacade;
034: import org.theospi.portfolio.shared.model.Node;
035: import org.theospi.portfolio.style.mgt.StyleManager;
036: import org.theospi.utils.mvc.impl.servlet.AbstractFormController;
037:
038: abstract public class AbstractStyleController extends
039: AbstractFormController implements Controller {
040: private AgentManager agentManager;
041: private AuthenticationManager authManager;
042: protected final Log logger = LogFactory.getLog(getClass());
043: private IdManager idManager;
044: private Collection mimeTypes;
045: private AuthorizationFacade authzManager;
046: private WorksiteManager worksiteManager;
047: private StyleManager styleManager;
048:
049: /**
050: *
051: * @return true is current agent is a maintainer in the current site
052: */
053: protected Boolean isMaintainer() {
054: return new Boolean(getAuthzManager()
055: .isAuthorized(
056: WorksiteManager.WORKSITE_MAINTAIN,
057: getIdManager().getId(
058: ToolManager.getCurrentPlacement()
059: .getContext())));
060: }
061:
062: protected Node loadNode(Id nodeId) {
063: return getStyleManager().getNode(nodeId);
064: }
065:
066: public WorksiteManager getWorksiteManager() {
067: return worksiteManager;
068: }
069:
070: public void setWorksiteManager(WorksiteManager worksiteManager) {
071: this .worksiteManager = worksiteManager;
072: }
073:
074: public AuthenticationManager getAuthManager() {
075: return authManager;
076: }
077:
078: public void setAuthManager(AuthenticationManager authManager) {
079: this .authManager = authManager;
080: }
081:
082: public AgentManager getAgentManager() {
083: return agentManager;
084: }
085:
086: public void setAgentManager(AgentManager agentManager) {
087: this .agentManager = agentManager;
088: }
089:
090: public IdManager getIdManager() {
091: return idManager;
092: }
093:
094: public void setIdManager(IdManager idManager) {
095: this .idManager = idManager;
096: }
097:
098: public Collection getMimeTypes() {
099: return mimeTypes;
100: }
101:
102: public void setMimeTypes(Collection mimeTypes) {
103: this .mimeTypes = mimeTypes;
104: }
105:
106: public AuthorizationFacade getAuthzManager() {
107: return authzManager;
108: }
109:
110: public void setAuthzManager(AuthorizationFacade authzManager) {
111: this .authzManager = authzManager;
112: }
113:
114: public StyleManager getStyleManager() {
115: return styleManager;
116: }
117:
118: public void setStyleManager(StyleManager styleManager) {
119: this.styleManager = styleManager;
120: }
121: }
|