001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 * $Id: ActionManager.java 28476 2008-01-04 09:52:52Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.actions.ejb; 021 022import java.io.Serializable; 023import java.util.List; 024 025import org.nuxeo.ecm.platform.actions.Action; 026import org.nuxeo.ecm.platform.actions.ActionContext; 027import org.nuxeo.ecm.platform.actions.ActionFilter; 028 029/** 030 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 031 */ 032public interface ActionManager extends Serializable { 033 034 boolean isEnabled(String actionId, ActionContext context); 035 036 boolean isRegistered(String actionId); 037 038 /** 039 * Gets actions for a category (filters are evaluated). 040 * <p> 041 * Only actions available in the given context are returned 042 */ 043 List<Action> getActions(String category, ActionContext context); 044 045 /** 046 * Gets actions for a category (filters are evaluated). 047 * <p> 048 * If hideUnavailableActions, all actions of the category are returned but actions are flagged with an available 049 * flag depending on filters evaluation. 050 */ 051 List<Action> getActions(String category, ActionContext context, boolean hideUnavailableActions); 052 053 Action getAction(String actionId); 054 055 /** 056 * Returns action with given id, evaluating its filters in given context, and returning null if filters evaluation 057 * denies access or if action is not found. 058 * <p> 059 * If hideUnavailableActions is false, the action is always returned but it is flagged with an available flag 060 * depending on filters evaluation. 061 * 062 * @since 5.6 063 */ 064 Action getAction(String actionId, ActionContext context, boolean hideUnavailableActions); 065 066 ActionFilter[] getFilters(String actionId); 067 068 /** 069 * Returns false if given filter evaluation is supposed to deny access when checking for this filter. 070 * 071 * @since 5.6 072 */ 073 boolean checkFilter(String filterId, ActionContext context); 074 075 /** 076 * Returns false if given filters evaluation is supposed to deny access when checking for this filter. 077 * 078 * @since 7.1 079 */ 080 boolean checkFilters(List<String> filterIds, ActionContext context); 081 082 /** 083 * Gets all actions in a category (filters are NOT evaluated). 084 */ 085 List<Action> getAllActions(String category); 086 087 /** 088 * Cleanup method. 089 */ 090 void remove(); 091 092}