001/* 002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nuxeo - initial API and implementation 018 * 019 * $Id: ActionManager.java 28476 2008-01-04 09:52:52Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.platform.actions.ejb; 023 024import java.io.Serializable; 025import java.util.List; 026 027import org.nuxeo.ecm.platform.actions.Action; 028import org.nuxeo.ecm.platform.actions.ActionContext; 029import org.nuxeo.ecm.platform.actions.ActionFilter; 030 031/** 032 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 033 */ 034public interface ActionManager extends Serializable { 035 036 boolean isEnabled(String actionId, ActionContext context); 037 038 boolean isRegistered(String actionId); 039 040 /** 041 * Gets actions for a category (filters are evaluated). 042 * <p> 043 * Only actions available in the given context are returned 044 */ 045 List<Action> getActions(String category, ActionContext context); 046 047 /** 048 * Gets actions for a category (filters are evaluated). 049 * <p> 050 * If hideUnavailableActions, all actions of the category are returned but actions are flagged with an available 051 * flag depending on filters evaluation. 052 */ 053 List<Action> getActions(String category, ActionContext context, boolean hideUnavailableActions); 054 055 Action getAction(String actionId); 056 057 /** 058 * Returns action with given id, evaluating its filters in given context, and returning null if filters evaluation 059 * denies access or if action is not found. 060 * <p> 061 * If hideUnavailableActions is false, the action is always returned but it is flagged with an available flag 062 * depending on filters evaluation. 063 * 064 * @since 5.6 065 */ 066 Action getAction(String actionId, ActionContext context, boolean hideUnavailableActions); 067 068 ActionFilter[] getFilters(String actionId); 069 070 /** 071 * Returns false if given filter evaluation is supposed to deny access when checking for this filter. 072 * 073 * @since 5.6 074 */ 075 boolean checkFilter(String filterId, ActionContext context); 076 077 /** 078 * Returns false if given filters evaluation is supposed to deny access when checking for this filter. 079 * 080 * @since 7.1 081 */ 082 boolean checkFilters(List<String> filterIds, ActionContext context); 083 084 /** 085 * @since 8.2 086 */ 087 boolean checkFilters(Action action, ActionContext context); 088 089 /** 090 * Gets all actions in a category (filters are NOT evaluated). 091 */ 092 List<Action> getAllActions(String category); 093 094 /** 095 * Cleanup method. 096 */ 097 void remove(); 098 099}