001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2004-2005 TONBELLER AG
008// Copyright (C) 2006-2009 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.rolap.sql;
012
013import mondrian.rolap.*;
014import mondrian.rolap.aggmatcher.AggStar;
015
016import java.util.List;
017
018/**
019 * Restricts the SQL result of a MembersChildren query in SqlMemberSource.
020 *
021 * @see mondrian.rolap.SqlMemberSource
022 *
023 * @author av
024 * @since Nov 2, 2005
025 */
026public interface MemberChildrenConstraint extends SqlConstraint {
027
028    /**
029     * Modifies a <code>Member.Children</code> query so that only the children
030     * of <code>parent</code> will be returned in the result set.
031     *
032     * @param sqlQuery the query to modify
033     * @param baseCube base cube for virtual members
034     * @param aggStar Aggregate star, if we are reading from an aggregate table,
035     * @param parent the parent member that restricts the returned children
036     */
037    public void addMemberConstraint(
038        SqlQuery sqlQuery,
039        RolapCube baseCube,
040        AggStar aggStar,
041        RolapMember parent);
042
043    /**
044     * Modifies a <code>Member.Children</code> query so that (all or some)
045     * children of <em>all</em> parent members contained in <code>parents</code>
046     * will be returned in the result set.
047     *
048     * @param sqlQuery Query to modify
049     * @param baseCube Base cube for virtual members
050     * @param aggStar Aggregate table, or null if query is against fact table
051     * @param parents List of parent members that restrict the returned
052     *        children
053     */
054    public void addMemberConstraint(
055        SqlQuery sqlQuery,
056        RolapCube baseCube,
057        AggStar aggStar,
058        List<RolapMember> parents);
059
060    /**
061     * Will be called once for the level that contains the
062     * children of a Member.Children query. If the condition requires so,
063     * it may join the levels table to the fact table.
064     *
065     * @param query the query to modify
066     * @param baseCube base cube for virtual members
067     * @param aggStar Aggregate table, or null if query is against fact table
068     * @param level the level that contains the children
069     */
070    public void addLevelConstraint(
071        SqlQuery query,
072        RolapCube baseCube,
073        AggStar aggStar,
074        RolapLevel level);
075
076}
077
078// End MemberChildrenConstraint.java