Java Code Examples for org.olap4j.metadata.Member#getParentMember()
The following examples show how to use
org.olap4j.metadata.Member#getParentMember() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrossNavigationManager.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
private static String getLevelValue(Member member, String levelName) { logger.debug("IN: Member is " + member.getUniqueName() + ", levelName is " + levelName); String toReturn = null; Level level = member.getLevel(); logger.debug("Member level is " + level.getUniqueName()); if (level.getUniqueName().equals(levelName)) { level.getName(); logger.debug("Member level matches input level name " + levelName + "!!"); toReturn = member.getName(); } else { logger.debug("Member level does NOT match input level name " + levelName + "!!"); // look for parent member at parent level Member parent = member.getParentMember(); if (parent == null) { return null; } else { return getLevelValue(parent, levelName); } } logger.debug("OUT: returning " + toReturn); return toReturn; }
Example 2
Source File: DenormalizedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private static Member computeMeasureName( final CellSet resultSet ) { final List<Position> positionList = resultSet.getFilterAxis().getPositions(); for ( int i = 0; i < positionList.size(); i++ ) { final Position position = positionList.get( i ); final List<Member> members = position.getMembers(); for ( int positionIndex = 0; positionIndex < members.size(); positionIndex++ ) { Member m = members.get( positionIndex ); while ( m != null ) { if ( m.getMemberType() == Member.Type.MEASURE ) { return m; } m = m.getParentMember(); } } } return null; }
Example 3
Source File: OlapUtils.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param member * @return */ private Member getParentMember(Member member) { Member parent; if (memberHierarchyCache == null) { parent = member.getParentMember(); } else { parent = memberHierarchyCache.getParentMember(member); } return parent; }
Example 4
Source File: MondrianSchemaRetriver.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * For each level starting from the root to the Get the map between the * hierarchy of the member( root member, child, granchild, .... member) and * the level. We need this information because we want to know table and * column linked to the members * * @param member * @param mondrianHierarchy * @return the map Level-->Member of the level */ public Map<TableEntry, Member> getMemberColumnMap(Member member, MondrianDef.Hierarchy mondrianHierarchy) { logger.debug("IN"); Map<TableEntry, Member> mapTableEntryValue = new HashMap<TableEntry, Member>(); // int memberDepth = member.getDepth(); Level memberLevel = member.getLevel(); // get all the levels starting from the root to the one that contains // the passed member List<MondrianDef.Level> memberValues = getLevels(memberLevel, mondrianHierarchy); // Create a Map that links the member with the level that contains it Member aMember = member; for (int i = memberValues.size() - 1; i >= 0; i--) { MondrianDef.Level aLevel = memberValues.get(i); String table = aLevel.table; if (table == null) { table = getTableName(mondrianHierarchy); } mapTableEntryValue.put(new TableEntry(aLevel.column, table), aMember); aMember = aMember.getParentMember(); } logger.debug("OUT"); return mapTableEntryValue; }
Example 5
Source File: BandedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Member findRootMember( final List<Member> position, final int columnIndex ) { final Dimension dimension = columnToMemberMapping.get( columnIndex ).getDimension(); for ( int i = 0; i < position.size(); i++ ) { final Member member = position.get( i ); if ( dimension.equals( member.getDimension() ) ) { if ( member.getParentMember() == null ) { return member; } } } return null; }
Example 6
Source File: BandedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Member searchContextMemberOfParents( final Member member, final int columnIndex ) { String columnName = getColumnName( columnIndex ); Member candidate = member; while ( candidate != null ) { if ( candidate.getLevel().getUniqueName().equals( columnName ) ) { return candidate; } candidate = candidate.getParentMember(); } return null; }
Example 7
Source File: DenormalizedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Member findRootMember( final List<Member> position, final int columnIndex ) { final Dimension dimension = columnToMemberMapping.get( columnIndex ).getDimension(); for ( int i = 0; i < position.size(); i++ ) { final Member member = position.get( i ); if ( dimension.equals( member.getDimension() ) ) { if ( member.getParentMember() == null ) { return member; } } } return null; }
Example 8
Source File: DenormalizedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Member searchContextMemberOfParents( final Member member, final int columnIndex ) { String columnName = getColumnName( columnIndex ); Member candidate = member; while ( candidate != null ) { if ( candidate.getLevel().getUniqueName().equals( columnName ) ) { return candidate; } candidate = candidate.getParentMember(); } return null; }
Example 9
Source File: ResultSetProcessingLib.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Computes a set of column names starting with the deepest parent up to the member actually found on the axis. * * @param m */ public static void computeDeepColumnNames( Member m, final MemberAddingStrategy memberToNameMapping ) { final FastStack<Member> memberStack = new FastStack<Member>(); while ( m != null ) { memberStack.push( m ); m = m.getParentMember(); } while ( memberStack.isEmpty() == false ) { Member mx = memberStack.pop(); memberToNameMapping.add( mx ); } }
Example 10
Source File: Olap4jUtil.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static String getUniqueMemberName( Member member ) { String memberValue = quoteMdxIdentifier( member.getName() ); while ( member.getParentMember() != null ) { memberValue = quoteMdxIdentifier( member.getParentMember().getName() ) + "." + memberValue; member = member.getParentMember(); } final Hierarchy hierarchy = member.getHierarchy(); final Dimension dimension = hierarchy.getDimension(); if ( hierarchy.getName().equals( dimension.getName() ) ) { return quoteMdxIdentifier( hierarchy.getName() ) + "." + memberValue; } else { return quoteMdxIdentifier( dimension.getName() ) + "." + quoteMdxIdentifier( hierarchy.getName() ) + "." + memberValue; } }
Example 11
Source File: SpagoBICellWrapper.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
/** * See if member2 is ancestor of member1 */ private boolean isChildOrEqualTo(Member member1, Member member2) { if (member1.equals(member2)) { return true; } if(member1.getLevel().getDepth()<=member2.getDepth()) return false; Member aMember=member1.getParentMember(); while(aMember.getLevel().getDepth()>=member2.getDepth() && !aMember.equals(member2)){ aMember = aMember.getParentMember(); } return (aMember.equals(member2)); }