001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.util;
020
021import lucee.runtime.PageContext;
022import lucee.runtime.type.Collection;
023import lucee.runtime.type.Query;
024import lucee.runtime.type.QueryColumn;
025
026/**
027 * Query Stack
028 */
029public interface QueryStack {
030
031    /**
032     * adds a Query to the Stack
033     * @param query 
034     */
035    public abstract void addQuery(Query query);
036
037    /**
038     * removes a Query from Stack
039     */
040    public abstract void removeQuery();
041
042    /**
043     * @return returns if stack is empty or not
044     */
045    public abstract boolean isEmpty();
046
047    /**
048     * loop over all Queries and return value at first ocurrence
049     * @param key column name of the value to get
050     * @return value
051     * @deprecated use instead <code>{@link #getDataFromACollection(PageContext,String)}</code>
052     */
053    public abstract Object getDataFromACollection(String key);
054    
055    /**
056     * loop over all Queries and return value at first ocurrence
057     * @param key column name of the value to get
058     * @return value
059     */
060    public abstract Object getDataFromACollection(PageContext pc,String key);
061
062    /**
063     * loop over all Queries and return value at first ocurrence
064     * @param key column name of the value to get
065     * @return value
066     * @deprecated use instead <code>{@link #getDataFromACollection(PageContext,Collection.Key)}</code>
067     */
068    public abstract Object getDataFromACollection(Collection.Key key);
069    
070    /**
071     * loop over all Queries and return value at first ocurrence
072     * @param key column name of the value to get
073     * @return value
074     */
075    public abstract Object getDataFromACollection(PageContext pc,Collection.Key key);
076
077    /**
078     * loop over all Queries and return value as QueryColumn at first ocurrence
079     * @param key column name of the value to get
080     * @return value
081     */
082    public abstract QueryColumn getColumnFromACollection(String key);
083
084    /**
085     * loop over all Queries and return value as QueryColumn at first ocurrence
086     * @param key column name of the value to get
087     * @return value
088     */
089    public abstract QueryColumn getColumnFromACollection(Collection.Key key);
090
091    /**
092     * clear the collection stack
093     */
094    public abstract void clear();
095    
096    /**
097     * @return returns all queries in the stack
098     */
099    public Query[] getQueries();
100    
101    public QueryStack duplicate(boolean deepCopy);
102
103}