1 /** 2 * MEDOR: Middleware Enabling Distributed Object Requests 3 * 4 * Copyright (C) 2001-2003 France Telecom R&D 5 * Contact: alexandre.lefebvre@rd.francetelecom.com 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 * Initial developers: M. Alia, A. Lefebvre 22 */ 23 24 package org.objectweb.medor.query.api; 25 26 import org.objectweb.medor.api.TupleStructure; 27 import org.objectweb.medor.api.MedorException; 28 import org.objectweb.medor.clone.api.Cloneable; 29 30 /** 31 * 32 * @author Sebastien Chassande-Barrioz 33 */ 34 public interface QueryTree extends Cloneable { 35 36 /** 37 * Returns the TupleStructure associated to the QueryTree. 38 * Note that the Fields cannot be added by manipulating the TupleStructure, 39 * but by using either constructors in the case of a QueryLeaf, or by 40 * using the addXXXFields methods in the case of QueryNodes. 41 */ 42 TupleStructure getTupleStructure(); 43 44 /** 45 * It returns the name of the query tree. 46 */ 47 String getName(); 48 49 /** 50 * Tests whether the results should be distinct or not. 51 * @return true if there results should be distinct, false otherwise. 52 */ 53 boolean getDistinct(); 54 55 /** 56 * Indicates whether evaluating the QueryTree should return unique results 57 * (duplicate elimination) or not. 58 * <p>The default should be that duplicates are not eliminated (distinct 59 * is false). 60 * @param distinct is true if duplicates should be eliminated, false 61 * otherwise. 62 * @throws MedorException if the distinct operation is not supported. 63 */ 64 void setDistinct(boolean distinct) throws MedorException; 65 66 /** 67 * Sets the OrderBy array of OrderFields. 68 * <p>This array indicates the fields by which the results should be 69 * ordered. 70 * <p>Like for filters assigned to QueryNodes, the Fields used for ordering 71 * must belong to children of the current QueryTree. 72 * <p>A noticeable exception is the case of RdbExpQueryLeaves, where 73 * ordering fields are fields of the QueryLeaf itself. 74 * @param orders the array of OrderFields indicating the ordering in which 75 * the result should be returned. 76 * @throws MedorException if ordering is not supported. 77 */ 78 void setOrderBy(OrderField[] orders) throws MedorException; 79 80 /** 81 * Returns the array of OrderFields indicating how the result should be 82 * ordered. 83 * @return the array of OrderFields. 84 */ 85 OrderField[] getOrderBy(); 86 } 87