01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/presentation/api-impl/src/java/org/theospi/portfolio/presentation/mgt/impl/PresentationToolPermissionMgr.java $
03: * $Id:PresentationToolPermissionMgr.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 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.presentation.mgt.impl;
21:
22: import java.util.Iterator;
23:
24: import org.sakaiproject.metaobj.shared.mgt.IdManager;
25: import org.sakaiproject.metaobj.shared.model.Id;
26: import org.theospi.portfolio.presentation.PresentationManager;
27: import org.theospi.portfolio.presentation.model.Presentation;
28: import org.theospi.portfolio.security.AuthorizationFacade;
29: import org.theospi.portfolio.security.model.SimpleToolPermissionManager;
30: import org.theospi.portfolio.worksite.model.SiteTool;
31:
32: public class PresentationToolPermissionMgr extends
33: SimpleToolPermissionManager {
34:
35: private PresentationManager presentationManager;
36: private AuthorizationFacade authzManager;
37: private IdManager idManager;
38:
39: public void toolRemoved(SiteTool siteTool) {
40: Id toolId = getIdManager().getId(siteTool.getToolId());
41: try {
42: for (Iterator i = getPresentationManager()
43: .findPresentationsByTool(toolId).iterator(); i
44: .hasNext();) {
45: Presentation presentation = (Presentation) i.next();
46: getPresentationManager().deletePresentation(
47: presentation.getId());
48: }
49: getAuthzManager().deleteAuthorizations(toolId);
50: } catch (Exception e) {
51: e.printStackTrace();
52: }
53: }
54:
55: public PresentationManager getPresentationManager() {
56: return presentationManager;
57: }
58:
59: public void setPresentationManager(
60: PresentationManager presentationManager) {
61: this .presentationManager = presentationManager;
62: }
63:
64: public AuthorizationFacade getAuthzManager() {
65: return authzManager;
66: }
67:
68: public void setAuthzManager(AuthorizationFacade authzManager) {
69: this .authzManager = authzManager;
70: }
71:
72: public IdManager getIdManager() {
73: return idManager;
74: }
75:
76: public void setIdManager(IdManager idManager) {
77: this.idManager = idManager;
78: }
79: }
|