KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > rolap > sql > TupleConstraint


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/rolap/sql/TupleConstraint.java#7 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2004-2005 TONBELLER AG
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.rolap.sql;
11
12 import mondrian.olap.Evaluator;
13 import mondrian.rolap.RolapLevel;
14 import mondrian.rolap.RolapMember;
15 import mondrian.rolap.RolapStar;
16 import mondrian.rolap.aggmatcher.AggStar;
17
18 import java.util.Map JavaDoc;
19
20 /**
21  * Restricts the SQL result of {@link mondrian.rolap.TupleReader}. This is also
22  * used by
23  * {@link mondrian.rolap.SqlMemberSource#getMembersInLevel(RolapLevel, int, int, TupleConstraint)}.
24  *
25  * @see mondrian.rolap.TupleReader
26  * @see mondrian.rolap.SqlMemberSource
27  *
28  * @author av
29  * @version $Id: //open/mondrian/src/main/mondrian/rolap/sql/TupleConstraint.java#7 $
30  */

31 public interface TupleConstraint extends SqlConstraint {
32     /**
33      * Modifies a Level.Members query.
34      *
35      * @param sqlQuery the query to modify
36      * @param levelToColumnMap maps a level to the column which holds its key
37      * in the current RolapStar
38      */

39     public void addConstraint(
40         SqlQuery sqlQuery,
41         Map JavaDoc<RolapLevel, RolapStar.Column> levelToColumnMap);
42
43     /**
44      * Will be called multiple times for every "group by" level in
45      * Level.Members query, i.e. the level that contains the members and all
46      * parent levels except All.
47      * If the condition requires so,
48      * it may join the levels table to the fact table.
49      *
50      * @param query the query to modify
51      * @param aggStar Aggregate table, or null if query is against fact table
52      * @param level the level which is accessed in the Level.Members query
53      * @param levelToColumnMap set in the case of a virtual cube; use this
54      */

55     public void addLevelConstraint(
56         SqlQuery query,
57         AggStar aggStar,
58         RolapLevel level,
59         Map JavaDoc<RolapLevel, RolapStar.Column> levelToColumnMap);
60
61     /**
62      * When the members of a level are fetched, the result is grouped
63      * by into parents and their children. These parent/children are
64      * stored in the parent/children cache, whose key consists of the parent
65      * and the MemberChildrenConstraint#hashKey(). So we need a matching
66      * MemberChildrenConstraint to store the parent with its children into
67      * the parent/children cache.
68      * <p>
69      * The returned MemberChildrenConstraint must be one that would have returned
70      * the same children for the given parent as the MemberLevel query has found
71      * for that parent.
72      * <p>
73      * If null is returned, the parent/children will not be cached (but
74      * the level/members still will be).
75      */

76     MemberChildrenConstraint getMemberChildrenConstraint(RolapMember parent);
77
78     /**
79      * @return the evaluator currently associated with the constraint; null
80      * if there is no associated evaluator
81      */

82     public Evaluator getEvaluator();
83 }
84
85 // End TupleConstraint.java
86
Popular Tags