com.tonbeller.jpivot.xmla
Class XMLA_QuaxUti

java.lang.Object
  extended by com.tonbeller.jpivot.xmla.XMLA_QuaxUti
All Implemented Interfaces:
QuaxUti

public class XMLA_QuaxUti
extends java.lang.Object
implements QuaxUti

Utility Functions for Quax


Field Summary
 
Fields inherited from interface com.tonbeller.jpivot.olap.query.QuaxUti
FUNTYPE_BRACES, FUNTYPE_FUNCTION, FUNTYPE_INFIX, FUNTYPE_PROPERTY, FUNTYPE_TUPLE
 
Constructor Summary
XMLA_QuaxUti()
           
 
Method Summary
 void addLevelMembers(java.util.List list, Level lev, int[] maxLevel)
          check level and add a levels members to list
 void addMemberChildren(java.util.List list, Member m, int[] maxLevel)
          check level and add a member to list
 void addMemberDescendants(java.util.List list, Member m, Level lev, int[] maxLevel)
          check level and add a members descendatns to list
 void addMemberSiblings(java.util.List list, Member m, int[] maxLevel)
          check level and add a member's parents children to list
 void addMemberUncles(java.util.List list, Member m, int[] maxLevel)
          check level and add a member's uncles to list
 boolean canHandle(java.lang.Object oExp)
          check an expression whether we can handle it (expand, collapse) currently we can basically handle following FunCalls member.children, member.descendants, level.members
 boolean checkChild(Member cMember, java.lang.Object pMemObj)
          check, whether member is child of other member
 boolean checkDescendantM(Member aMember, Member dMember)
          check, whether member is descendant of other member
 boolean checkDescendantO(Member aMember, java.lang.Object oMember)
          check, whether member object is descendant of member
 boolean checkParent(Member pMember, java.lang.Object cMemObj)
          check, whether member is parent of other member
 java.lang.Object createFunCall(java.lang.String function, java.lang.Object[] args, int funType)
          create FunCall
 java.lang.Object createMemberSet(java.util.List mList)
          generate an object for a list of members
 Dimension dimForMember(Member member)
          return a members dimension
 boolean equalMember(java.lang.Object oExp, Member member)
           
 java.lang.Object funCallArg(java.lang.Object oExp, int index)
          return a FunCalls argument of given index
 int funCallArgCount(java.lang.Object oFun)
          get number of funCall arguments
 java.lang.Object funCallChildren(Member member)
          create Children FunCall
 java.lang.String funCallName(java.lang.Object oFun)
          get funcall name
 java.lang.StringBuffer funString(java.lang.Object oFun)
          create String representation for FunCall
 java.lang.Object[] getChildren(java.lang.Object oMember)
          determine the children of a member object
 java.lang.Object[] getLevelMembers(Level level)
          get the members of a level
 java.lang.String getMemberUniqueName(java.lang.Object oExp)
           
 Level getParentLevel(Level level)
           
 Member getParentMember(java.lang.Object oExp)
           
 Hierarchy hierForExp(java.lang.Object oExp)
          determine hierarchy for Exp
 Hierarchy hierForMember(Member member)
           
 boolean isChildOfMemberInFunCall(java.lang.Object oFun, Member m)
          check, whether a funcall set contains any child of a specific member
 boolean isDescendantOfMemberInFunCall(java.lang.Object oExp, Member member)
          check, whether funcall set contains descendant of a specific member
 boolean isFunCall(java.lang.Object oExp)
           
 boolean isFunCallNotTopLevel(java.lang.Object oExp)
          check whether a Funcall does NOT resolve to top level of hierarchy
 boolean isFunCallTo(java.lang.Object oExp, java.lang.String function)
           
 boolean isMember(java.lang.Object oExp)
           
 boolean isMemberInFunCall(java.lang.Object oExp, Member m)
          check, whether funcall set contains member
 boolean isMemberOnToplevel(java.lang.Object oMem)
          check, whether a member is on top level (has no parent);
 int levelDepthForMember(java.lang.Object oExp)
          level depth for member
 Level LevelForObj(java.lang.Object oLevel)
           
 Member memberForObj(java.lang.Object oExp)
          return member for exp object
 java.lang.String memberString(Member[] mPath)
          display member array for debugging purposes
 java.lang.Object objForDim(Dimension dim)
          Expression Object for Dimension
 java.lang.Object objForMember(Member member)
          Expression Object for member
 mondrian.olap.Exp toExp(java.lang.Object o)
          Converts an object to an expression.
 java.lang.Object topLevelMembers(Hierarchy hier, boolean expandAllMember)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLA_QuaxUti

public XMLA_QuaxUti()
Method Detail

isMemberInFunCall

public boolean isMemberInFunCall(java.lang.Object oExp,
                                 Member m)
                          throws Quax.CannotHandleException
Description copied from interface: QuaxUti
check, whether funcall set contains member

Specified by:
isMemberInFunCall in interface QuaxUti
Parameters:
f -
m -
Returns:
true if FunCall matches member
Throws:
Quax.CannotHandleException

isChildOfMemberInFunCall

public boolean isChildOfMemberInFunCall(java.lang.Object oFun,
                                        Member m)
                                 throws Quax.CannotHandleException
Description copied from interface: QuaxUti
check, whether a funcall set contains any child of a specific member

Specified by:
isChildOfMemberInFunCall in interface QuaxUti
Parameters:
f -
m -
Returns:
true if FunCall contains child of member
Throws:
Quax.CannotHandleException

isDescendantOfMemberInFunCall

public boolean isDescendantOfMemberInFunCall(java.lang.Object oExp,
                                             Member member)
                                      throws Quax.CannotHandleException
Description copied from interface: QuaxUti
check, whether funcall set contains descendant of a specific member

Specified by:
isDescendantOfMemberInFunCall in interface QuaxUti
Parameters:
f -
m -
Returns:
true if FunCall contains descendants of member
Throws:
Quax.CannotHandleException

addMemberUncles

public void addMemberUncles(java.util.List list,
                            Member m,
                            int[] maxLevel)
check level and add a member's uncles to list

Specified by:
addMemberUncles in interface QuaxUti
Parameters:
m -

addMemberSiblings

public void addMemberSiblings(java.util.List list,
                              Member m,
                              int[] maxLevel)
check level and add a member's parents children to list

Specified by:
addMemberSiblings in interface QuaxUti
Parameters:
m -

addMemberChildren

public void addMemberChildren(java.util.List list,
                              Member m,
                              int[] maxLevel)
check level and add a member to list

Specified by:
addMemberChildren in interface QuaxUti
Parameters:
m -

addMemberDescendants

public void addMemberDescendants(java.util.List list,
                                 Member m,
                                 Level lev,
                                 int[] maxLevel)
check level and add a members descendatns to list

Specified by:
addMemberDescendants in interface QuaxUti
Parameters:
m -

addLevelMembers

public void addLevelMembers(java.util.List list,
                            Level lev,
                            int[] maxLevel)
check level and add a levels members to list

Specified by:
addLevelMembers in interface QuaxUti
Parameters:
m -

funString

public java.lang.StringBuffer funString(java.lang.Object oFun)
create String representation for FunCall

Specified by:
funString in interface QuaxUti
Parameters:
f -
Returns:

hierForExp

public Hierarchy hierForExp(java.lang.Object oExp)
                     throws Quax.CannotHandleException
determine hierarchy for Exp

Specified by:
hierForExp in interface QuaxUti
Parameters:
exp -
Returns:
hierarchy
Throws:
Quax.CannotHandleException

isMember

public boolean isMember(java.lang.Object oExp)
Specified by:
isMember in interface QuaxUti
Parameters:
oExp - expression
Returns:
true, if exp is member
See Also:
QuaxUti.isMember(java.lang.Object)

isFunCall

public boolean isFunCall(java.lang.Object oExp)
Specified by:
isFunCall in interface QuaxUti
Returns:
true if oExp is a FunCall expression
See Also:
QuaxUti.isFunCall(java.lang.Object)

equalMember

public boolean equalMember(java.lang.Object oExp,
                           Member member)
Specified by:
equalMember in interface QuaxUti
Parameters:
oExp - expression
Returns:
true if expression equals member
See Also:
QuaxUti.equalMember(java.lang.Object, com.tonbeller.jpivot.olap.model.Member)

getParentMember

public Member getParentMember(java.lang.Object oExp)
Specified by:
getParentMember in interface QuaxUti
See Also:
QuaxUti.getParentMember(java.lang.Object)

funCallChildren

public java.lang.Object funCallChildren(Member member)
create Children FunCall

See Also:
QuaxUti#funChildren(com.tonbeller.jpivot.olap.model.Member)

hierForMember

public Hierarchy hierForMember(Member member)
Specified by:
hierForMember in interface QuaxUti
Returns:
a members hierarchy
See Also:
QuaxUti.hierForMember(com.tonbeller.jpivot.olap.model.Member)

dimForMember

public Dimension dimForMember(Member member)
return a members dimension

Specified by:
dimForMember in interface QuaxUti
See Also:
QuaxUti.dimForMember(com.tonbeller.jpivot.olap.model.Member)

getMemberUniqueName

public java.lang.String getMemberUniqueName(java.lang.Object oExp)
Specified by:
getMemberUniqueName in interface QuaxUti
Returns:
a members unique name
See Also:
QuaxUti.getMemberUniqueName(java.lang.Object)

isFunCallTo

public boolean isFunCallTo(java.lang.Object oExp,
                           java.lang.String function)
Specified by:
isFunCallTo in interface QuaxUti
Returns:
true, if an expression is a FunCall to e specific function
See Also:
QuaxUti#funCallTo(java.lang.Object, java.lang.String)

funCallArg

public java.lang.Object funCallArg(java.lang.Object oExp,
                                   int index)
return a FunCalls argument of given index

Specified by:
funCallArg in interface QuaxUti
Returns:
argument object
See Also:
QuaxUti.funCallArg(java.lang.Object, int)

funCallName

public java.lang.String funCallName(java.lang.Object oFun)
Description copied from interface: QuaxUti
get funcall name

Specified by:
funCallName in interface QuaxUti
Parameters:
oFun - funcall expression
Returns:
funcall name
See Also:
QuaxUti.funCallName(java.lang.Object)

checkParent

public boolean checkParent(Member pMember,
                           java.lang.Object cMemObj)
Description copied from interface: QuaxUti
check, whether member is parent of other member

Specified by:
checkParent in interface QuaxUti
Parameters:
pMember - (parent)
Returns:
true if member (2.arg) is child of Member (1.arg)
See Also:
QuaxUti.checkParent(com.tonbeller.jpivot.olap.model.Member, java.lang.Object)

checkChild

public boolean checkChild(Member cMember,
                          java.lang.Object pMemObj)
Description copied from interface: QuaxUti
check, whether member is child of other member

Specified by:
checkChild in interface QuaxUti
Parameters:
cMember - (parent)
Returns:
true if member (1.arg) is child of Member (2.arg)
See Also:
QuaxUti.checkParent(com.tonbeller.jpivot.olap.model.Member, java.lang.Object)

checkDescendantM

public boolean checkDescendantM(Member aMember,
                                Member dMember)
Description copied from interface: QuaxUti
check, whether member is descendant of other member

Specified by:
checkDescendantM in interface QuaxUti
Parameters:
aMember - (ancestor)
dMember - (descendant)
Returns:
true if member (2.arg) is descendant of Member (1.arg)
See Also:
QuaxUti.checkDescendant

checkDescendantO

public boolean checkDescendantO(Member aMember,
                                java.lang.Object oMember)
Description copied from interface: QuaxUti
check, whether member object is descendant of member

Specified by:
checkDescendantO in interface QuaxUti
Parameters:
aMember - (ancestor)
oMember - (descendant member object)
Returns:
true if member object (2.arg) is descendant of Member (1.arg)
See Also:
QuaxUti.checkDescendantO

objForMember

public java.lang.Object objForMember(Member member)
Description copied from interface: QuaxUti
Expression Object for member

Specified by:
objForMember in interface QuaxUti
Returns:
exp object for member
See Also:
QuaxUti.objForMember(com.tonbeller.jpivot.olap.model.Member)

objForDim

public java.lang.Object objForDim(Dimension dim)
Description copied from interface: QuaxUti
Expression Object for Dimension

Specified by:
objForDim in interface QuaxUti
Returns:
exp object for dimension
See Also:
QuaxUti.objForDim(com.tonbeller.jpivot.olap.model.Dimension)

memberForObj

public Member memberForObj(java.lang.Object oExp)
return member for exp object

Specified by:
memberForObj in interface QuaxUti
See Also:
QuaxUti.memberForObj(java.lang.Object)

memberString

public java.lang.String memberString(Member[] mPath)
display member array for debugging purposes

Specified by:
memberString in interface QuaxUti
Parameters:
member -
Returns:

createMemberSet

public java.lang.Object createMemberSet(java.util.List mList)
generate an object for a list of members

Specified by:
createMemberSet in interface QuaxUti
Parameters:
mList - list of members
Returns:
null for empty lis, single member or set function otherwise
See Also:
QuaxUti.createMemberSet(java.util.List)

isFunCallNotTopLevel

public boolean isFunCallNotTopLevel(java.lang.Object oExp)
                             throws Quax.CannotHandleException
check whether a Funcall does NOT resolve to top level of hierarchy

Specified by:
isFunCallNotTopLevel in interface QuaxUti
Parameters:
f -
Returns:
Throws:
Quax.CannotHandleException

isMemberOnToplevel

public boolean isMemberOnToplevel(java.lang.Object oMem)
Description copied from interface: QuaxUti
check, whether a member is on top level (has no parent);

Specified by:
isMemberOnToplevel in interface QuaxUti
Returns:
true if member is on top level (has no parent)
See Also:
QuaxUti.isMemberOnToplevel(java.lang.Object)

levelDepthForMember

public int levelDepthForMember(java.lang.Object oExp)
Description copied from interface: QuaxUti
level depth for member

Specified by:
levelDepthForMember in interface QuaxUti
Parameters:
oExp - - member
Returns:
the depth of a member's level
See Also:
QuaxUti.levelDepthForMember(java.lang.Object)

topLevelMembers

public java.lang.Object topLevelMembers(Hierarchy hier,
                                        boolean expandAllMember)
Specified by:
topLevelMembers in interface QuaxUti
Parameters:
hier - - the Hierarchy
expandAllMember - - if true, an "All" member will be expanded
Returns:
an Expression Object for the top level members of an hierarchy
See Also:
QuaxUti#topLevelMembers(com.tonbeller.jpivot.olap.model.Hierarchy)

funCallArgCount

public int funCallArgCount(java.lang.Object oFun)
Description copied from interface: QuaxUti
get number of funCall arguments

Specified by:
funCallArgCount in interface QuaxUti
Parameters:
oFun - funcall expression
Returns:
count of a FunCall's arguments
See Also:
QuaxUti.funCallArgCount(java.lang.Object)

LevelForObj

public Level LevelForObj(java.lang.Object oLevel)
Specified by:
LevelForObj in interface QuaxUti
Parameters:
oLevel - expression object representing level
Returns:
Level for given Expression Object
See Also:
QuaxUti.LevelForObj(java.lang.Object)

getParentLevel

public Level getParentLevel(Level level)
Specified by:
getParentLevel in interface QuaxUti
Returns:
the parent level of a given level
See Also:
QuaxUti.getParentLevel(com.tonbeller.jpivot.olap.model.Level)

toExp

public mondrian.olap.Exp toExp(java.lang.Object o)
Description copied from interface: QuaxUti
Converts an object to an expression. In particular, adds expression wrappers (MemberExpr, etc.) to olap elements (Member, etc.).

Specified by:
toExp in interface QuaxUti
Parameters:
o - Object, which may or may not be an expression
Returns:
An expression

createFunCall

public java.lang.Object createFunCall(java.lang.String function,
                                      java.lang.Object[] args,
                                      int funType)
create FunCall

Specified by:
createFunCall in interface QuaxUti
Parameters:
function - name
args - arguments
funType - FUNTYPE
Returns:
function object
See Also:
QuaxUti.createFunCall(java.lang.String, java.lang.Object[], int)

canHandle

public boolean canHandle(java.lang.Object oExp)
check an expression whether we can handle it (expand, collapse) currently we can basically handle following FunCalls member.children, member.descendants, level.members

Specified by:
canHandle in interface QuaxUti
See Also:
QuaxUti.canHandle(java.lang.Object)

getChildren

public java.lang.Object[] getChildren(java.lang.Object oMember)
Description copied from interface: QuaxUti
determine the children of a member object

Specified by:
getChildren in interface QuaxUti
Returns:
member children
See Also:
QuaxUti.getChildren(java.lang.Object)

getLevelMembers

public java.lang.Object[] getLevelMembers(Level level)
get the members of a level

Specified by:
getLevelMembers in interface QuaxUti