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 * <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 017 * <a href="mailto:rspivak@nuxeo.com">Ruslan Spivak</a> 018 * Anahide Tchertchian 019 * 020 * $Id: ActionContext.java 20218 2007-06-07 19:19:46Z sfermigier $ 021 */ 022 023package org.nuxeo.ecm.platform.actions; 024 025import java.io.Serializable; 026import java.util.Map; 027 028import javax.el.ELException; 029 030import org.nuxeo.ecm.core.api.CoreSession; 031import org.nuxeo.ecm.core.api.DocumentModel; 032import org.nuxeo.ecm.core.api.NuxeoPrincipal; 033 034/** 035 * Interface for action context evaluation 036 * 037 * @since 5.7.3 038 */ 039public interface ActionContext extends Serializable { 040 041 /** 042 * Sets the current document to use for filter evaluation 043 */ 044 void setCurrentDocument(DocumentModel doc); 045 046 /** 047 * Returns the current document to use for filter evaluation 048 */ 049 DocumentModel getCurrentDocument(); 050 051 /** 052 * Sets the core session to use for filter evaluation 053 */ 054 void setDocumentManager(CoreSession docMgr); 055 056 /** 057 * Returns the core session to use for filter evaluation 058 */ 059 CoreSession getDocumentManager(); 060 061 /** 062 * Sets the current principal to use for filter evaluation 063 */ 064 void setCurrentPrincipal(NuxeoPrincipal currentPrincipal); 065 066 /** 067 * Returns the current principal to use for filter evaluation 068 */ 069 NuxeoPrincipal getCurrentPrincipal(); 070 071 /** 072 * Sets a local variable, to put in the context so that expressions can reference it. 073 */ 074 Object putLocalVariable(String key, Object value); 075 076 /** 077 * Sets local variables, to put in the context so that expressions can reference them. 078 */ 079 void putAllLocalVariables(Map<String, Object> vars); 080 081 /** 082 * Returns a local variable put in the context 083 */ 084 Object getLocalVariable(String key); 085 086 /** 087 * Returns the number of local variables 088 */ 089 int size(); 090 091 /** 092 * Returns true if given expression resolves to true in this context. 093 * <p> 094 * Returns false if expression is blank (null or empty). 095 * 096 * @throws ELException 097 */ 098 boolean checkCondition(String expression) throws ELException; 099 100 /** 101 * Returns true if expressions evaluation should not be cached globally 102 */ 103 boolean disableGlobalCaching(); 104 105}