1 10 package mondrian.rolap; 11 12 import java.util.Arrays ; 13 import java.util.Map ; 14 15 import mondrian.rolap.sql.SqlQuery; 16 import mondrian.rolap.aggmatcher.AggStar; 17 18 27 class ChildByNameConstraint extends DefaultMemberChildrenConstraint { 28 String childName; 29 Object cacheKey; 30 31 36 public ChildByNameConstraint(String childName) { 37 this.childName = childName; 38 this.cacheKey = Arrays.asList( 39 new Object [] { 40 super.getCacheKey(), 41 ChildByNameConstraint.class, childName}); 42 } 43 44 public void addLevelConstraint( 45 SqlQuery query, 46 AggStar aggStar, 47 RolapLevel level, 48 Map <RolapLevel, RolapStar.Column> levelToColumnMap) 49 { 50 super.addLevelConstraint(query, aggStar, level, levelToColumnMap); 51 query.addWhere( 52 SqlConstraintUtils.constrainLevel( 53 level, 54 query, 55 childName, 56 true)); 57 } 58 59 public String toString() { 60 return "ChildByNameConstraint(" + childName + ")"; 61 } 62 63 public Object getCacheKey() { 64 return cacheKey; 65 } 66 67 } 68 69 | Popular Tags |