org.olap4j.metadata.Member Java Examples
The following examples show how to use
org.olap4j.metadata.Member.
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: SpagoBICellWrapper.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public long visitMembers() throws OlapException, SpagoBIEngineException { List<String> dimensionNames = new ArrayList<String>(); long myLeafsNumeber = 1l; Member[] members = getMembers(); for (int i = 0; i < members.length; i++) { Member aMember = members[i]; String dimensionUniqueName = aMember.getDimension().getUniqueName(); if (dimensionNames.contains(dimensionUniqueName)) { throw new SpagoBIEngineException("You can not apply this algorithm with multi hierarchies"); } Long memberLeafs = CubeUtilities.getLeafs(aMember); myLeafsNumeber = myLeafsNumeber * memberLeafs; } return myLeafsNumeber; }
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 | 6 votes |
/** * @param member * @return */ public Member getBaseRaggedMember(Member member) { if (member == null) { throw new NullArgumentException("member"); } Member baseMember; if (member instanceof RaggedMemberWrapper) { baseMember = ((RaggedMemberWrapper) member).getBaseMember(); } else { baseMember = member; } return baseMember; }
Example #4
Source File: OlapUtils.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * @param member * @return */ public Member getTopLevelRaggedMember(Member member) { if (member == null) { throw new NullArgumentException("member"); } Member topMember; if (member instanceof RaggedMemberWrapper) { topMember = ((RaggedMemberWrapper) member).getTopMember(); } else { topMember = getParentMember(member); } return topMember; }
Example #5
Source File: HierarchyResource.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@POST @Path("/search") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Set<NodeFilter> searchMembersByName(SeachParameters seachParameter) { try { Hierarchy hierarchy = getHierarchy(seachParameter.getHierarchyUniqueName()); FilterTreeBuilder ftb = new FilterTreeBuilder(); Set<Member> treeLeaves = CubeUtilities.findMembersByName(hierarchy, seachParameter.getName(), false); Set<Member> visibleMembers = getVisibleMembers(seachParameter.getAxis(), seachParameter.getHierarchyUniqueName()); ftb.setHierarchy(getHierarchy(seachParameter.getHierarchyUniqueName())); ftb.setTreeLeaves(treeLeaves); ftb.setVisibleMembers(visibleMembers); ftb.setShowSiblings(seachParameter.isShowSiblings()); return ftb.build(); } catch (Exception e1) { logger.error("Error while searching members", e1); throw new SpagoBIRuntimeException("Error while searching members", e1); } }
Example #6
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 #7
Source File: DefaultWeightedAllocationAlgorithmDataManager.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Build the update statement for the measure * * @param buffer * the buffer of the query * @param measure * the measure to update * @param prop * the ratio */ @Override protected void buildUpdate(StringBuffer buffer, Member measure, Object... values) throws SpagoBIEngineException { String measureColumn = null; try { measureColumn = retriver.getMeasureColumn(measure); } catch (SpagoBIEngineException e) { logger.error("Error loading the column for the table measure " + measure.getName(), e); throw new SpagoBIEngineException("Error loading the column for the table measure " + measure.getName(), e); } buffer.append("update "); buffer.append(retriver.getEditCubeTableName()); buffer.append(" " + getCubeAlias()); buffer.append(" set " + measureColumn + " = " + measureColumn + "*" + values[0]); }
Example #8
Source File: BandedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
protected List<String> computeColumnNames( final List<CellSetAxis> axes, final List<Member> columnToMemberMapper ) { ArrayList<String> columnNames = new ArrayList<String>(); for ( final Member member : columnToMemberMapper ) { columnNames.add( member.getLevel().getUniqueName() ); } if ( axes.size() > 0 ) { // now create the column names for the column-axis final CellSetAxis axis = axes.get( 0 ); final List<Position> positions = axis.getPositions(); for ( int i = 0; i < positions.size(); i++ ) { final Position position = positions.get( i ); columnNames.add( ResultSetProcessingLib.computeUniqueColumnName( position ) ); } } else { columnNames.add( "Measure" ); } return Collections.unmodifiableList( columnNames ); }
Example #9
Source File: SpagoBICellWrapper.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public String getMeasureName() { Member[] members = this.getMembers(); try { for (int i = 0; i < members.length; i++) { Member member = members[i]; if (member.getDimension().getDimensionType().equals(Dimension.Type.MEASURE)) { return member.getName(); } } } catch (OlapException e) { throw new SpagoBIEngineRuntimeException("Error getting the measure for the cell ", e); } throw new SpagoBIEngineRuntimeException("No measure found for the cell"); }
Example #10
Source File: ResultSetProcessingLib.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public static int computeMemberCountForAxis( final CellSetAxis axis, final boolean membersOnAxisSorted ) { final List<Position> positions = axis.getPositions(); final MemberAddingStrategy strategy = membersOnAxisSorted ? new SortedMemberAddingStrategy( positions ) : new ResultSetOrderMemberAddingStrategy(); for ( int positionsIndex = 0; positionsIndex < positions.size(); positionsIndex++ ) { final List<Member> position = positions.get( positionsIndex ).getMembers(); for ( int positionIndex = 0; positionIndex < position.size(); positionIndex++ ) { Member m = position.get( positionIndex ); computeDeepColumnNames( m, strategy ); } } return strategy.values().size(); }
Example #11
Source File: BandedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private Member getCandidateMembers( final int columnIndex, final List<Integer> cellKey ) { final int axisIndex = columnToAxisPosition.get( columnIndex ); final List<CellSetAxis> axes = resultSet.getAxes(); final CellSetAxis axis = axes.get( axisIndex ); final List<Position> positionList = axis.getPositions(); if ( positionList.isEmpty() ) { return null; } final int posIndex = cellKey.get( axisIndex ); final Position position = positionList.get( posIndex ); final Member memberByName = findMemberByName( position.getMembers(), columnIndex ); if ( memberByName != null ) { return memberByName; } return findRootMember( position.getMembers(), columnIndex ); }
Example #12
Source File: VersionManager.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public static Integer getActualVersion(PivotModel model, ModelConfig config) { logger.debug("IN"); ChangeSlicer ph = model.getTransform(ChangeSlicer.class); Hierarchy hierarchy = CubeUtilities.getVersionHierarchy(model.getCube(), config); if (hierarchy != null) { List<Member> slicers = ph.getSlicer(hierarchy); if (slicers != null && slicers.size() > 0) { String name = slicers.get(0).getName(); try { Integer version = new Integer(name); logger.debug("OUT: version" + version); return version; } catch (Exception e) { logger.debug("Problems getting the actual version", e); } } else { logger.debug("No Versionslicer found"); } } else { logger.debug("No Version hierarchy found"); } logger.debug("OUT: no version"); return null; }
Example #13
Source File: OlapFunction.java From olaper with MIT License | 5 votes |
@Override public Collection<ServerMeasure> getAllMeasuresUsed() throws OlapException { if(node instanceof CallNode){ Set<ServerMeasure> result = new HashSet<ServerMeasure>(); for(IdentifierNode inode : ParseUtils.getAllIdentifiers((CallNode) node)){ Member m = cube.lookupMember(inode.getSegmentList()); if(m instanceof ServerMeasure) result.add((ServerMeasure) m); } return result; }else return Collections.emptyList(); }
Example #14
Source File: OlapUtils.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param member * @return */ public static boolean isVisible(Member member) { try { if (member.getDimension().getDimensionType() == Type.MEASURE) { return member.isVisible(); } } catch (OlapException e) { throw new PivotException(e); } return true; }
Example #15
Source File: SlicerManager.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
private List<Member> getMembers(String hierarchyUniqueName, List<String> memberUniqueNames) { List<Member> members = new ArrayList<>(); for (String memberUniqueName : memberUniqueNames) { members.add(getMember(hierarchyUniqueName, memberUniqueName)); } return members; }
Example #16
Source File: TableHeaderNode.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
protected List<Member> getMemberPath() { List<Member> path = new LinkedList<Member>(); TableHeaderNode node = (TableHeaderNode) getParent(); while (node != null) { path.add(0, node.getMember()); node = (TableHeaderNode) node.getParent(); } return path; }
Example #17
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 #18
Source File: Olap4jTuple.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
public Olap4jTuple(Position position, Olap4jFactory factory) { members = new Olap4jMember[position.getMembers().size()]; int idx = 0; for (Iterator<Member> it = position.getMembers().iterator(); it.hasNext(); ++idx) { Member member = it.next(); members[idx] = factory.createMember(member); } }
Example #19
Source File: OlapUtils.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param position * @param otherPosition * @param memberIndex * @return */ public static boolean equals(Position position, Position otherPosition, int memberIndex) { if (position == otherPosition) { return true; } if (position == null || otherPosition == null) { return false; } int size = position.getMembers().size(); if (memberIndex < 0) { memberIndex = size; if (size != otherPosition.getMembers().size()) { return false; } } for (int i = 0; i < memberIndex; i++) { Member member = position.getMembers().get(i); Member lastMember = otherPosition.getMembers().get(i); if (!equals(member, lastMember)) { return false; } } return true; }
Example #20
Source File: OlapUtils.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @see org.olap4j.metadata.Member#isChildOrEqualTo(org.olap4j.metadata.Member) */ public boolean isChildOrEqualTo(Member member) { if (isBaseMember()) { return baseMember.isChildOrEqualTo(member); } if (!(member instanceof RaggedMemberWrapper)) { return false; } RaggedMemberWrapper other = (RaggedMemberWrapper) member; return OlapUtils.equals(baseMember, other.baseMember) && level.getDepth() <= other.level.getDepth(); }
Example #21
Source File: SbiMember.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public SbiMember(Member member, boolean visible, String description) { this.uniqueName = member.getUniqueName(); this.id = member.getUniqueName(); this.name = member.getCaption(); this.text = calculateText(member.getName(), member.getCaption()); try { this.leaf = member.getChildMemberCount() == 0; } catch (OlapException e) { throw new SpagoBIEngineRuntimeException("Error getting the childs count for the member " + member.getUniqueName(), e); } this.visible = visible; this.qtip = description; }
Example #22
Source File: HierarchyResource.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param axis */ private Set<Member> getVisibleMembers(int axis, String hierarchyUniqueName) { Set<Member> visibleMembers = new HashSet<>(); if (axis >= 0) { PlaceMembersOnAxes pm = getPivotModel().getTransform(PlaceMembersOnAxes.class); visibleMembers.addAll(pm.findVisibleMembers(CubeUtilities.getAxis(axis))); } else { SlicerManager sm = new SlicerManager((SpagoBIPivotModel) getPivotModel()); visibleMembers.addAll(sm.getSlicers(hierarchyUniqueName)); } return visibleMembers; }
Example #23
Source File: WhatIfHTMLRendereCallback.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
private void initializeInternal(TableRenderContext context) { if (!this.initialized) { this.measureOnRows = true; this.initialized = true; this.positionMeasureMap = new HashMap<Integer, String>(); // check if the measures are in the rows or in the columns List<Member> columnMembers = null; Position p = context.getColumnPosition(); if (p != null) { columnMembers = p.getMembers(); } try { if (columnMembers != null) { for (int i = 0; i < columnMembers.size(); i++) { Member member = columnMembers.get(i); if (member.getDimension().getDimensionType().equals(Dimension.Type.MEASURE)) { this.measureOnRows = false; } } } } catch (OlapException e) { throw new SpagoBIEngineRuntimeException("Erro getting the measure of a rendered cell ", e); } } }
Example #24
Source File: BandedMDXTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Member findMemberByName( 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() ) ) { Member match = searchContextMemberOfParents( member, columnIndex ); if ( match != null ) { return match; } } } return null; }
Example #25
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 #26
Source File: AbstractSetFunction.java From olaper with MIT License | 5 votes |
private String getExpression(IdentifierNode inode, TableMapping mapping, boolean useAliases) throws OlapException { Member m = cube.lookupMember(inode.getSegmentList()); if(m instanceof ServerMeasure){ return mapping.getMeasureExpression((ServerMeasure) m, useAliases); }else throw new OlapException("Can not expression by "+inode.toString()); }
Example #27
Source File: BracesInjector.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param childMembers * @return */ private int getCFPosition(NamedList<? extends Member> childMembers) { for (int i = childMembers.size() - 1; i >= 0; i--) { Member member = childMembers.get(i); for (int j = rootNode.getArgList().size() - 1; j >= 0; j--) { if (rootNode.getArgList().get(j).toString().contains(member.getUniqueName())) { return j + 1; } } } return rootNode.getArgList().size(); }
Example #28
Source File: AbstractUpdatingAlgotithmsDataManager.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public String executeUpdate(Member[] members, double prop, Connection connection, Integer version) throws Exception { // list of the coordinates for the members List<IMemberCoordinates> memberCordinates = new ArrayList<IMemberCoordinates>(); // init the query with the update set statement StringBuffer query = new StringBuffer(); // gets the measures and the coordinates of the dimension members for (int i = 0; i < members.length; i++) { Member aMember = members[i]; try { if (!(aMember.getDimension().getDimensionType().equals(Type.MEASURE))) { memberCordinates.add(retriver.getMemberCordinates(aMember)); } else { buildUpdate(query, aMember, prop); } } catch (OlapException e) { logger.error("Error loading the type of the dimension of the member " + aMember.getUniqueName(), e); throw new SpagoBIEngineException("Error loading the type of the dimension of the member " + aMember.getUniqueName(), e); } } String whereClause = buildFromAndWhereClauseForCell(members, version, useInClause); query.append(whereClause); String queryString = query.toString(); SqlUpdateStatement updateStatement = new SqlUpdateStatement(queryString); updateStatement.executeStatement(connection); return queryString.toString(); }
Example #29
Source File: BracesInjector.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public void injectField(Member parentMember, IdentifierNode calculatedNode) { try { if (contains(rootNode, parentMember) && isMeasureOrHasAnyChildren(parentMember)) { rootNode.getArgList().add(getCFPosition(parentMember.getChildMembers()), getCFNode(calculatedNode)); } } catch (OlapException e) { logger.error("Error while injecting cf in braces", e); throw new SpagoBIEngineRuntimeException("Error while injecting cf in braces", e); } }
Example #30
Source File: SpagoBICellWrapper.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public Member getContextMember(Hierarchy hierarchy) { Member[] members = this.getMembers(); for (int i = 0; i < members.length; i++) { Member member = members[i]; Hierarchy aHierarchy = member.getHierarchy(); if (aHierarchy.getUniqueName().equals(hierarchy.getUniqueName())) { return member; } } throw new SpagoBIEngineRuntimeException("No member found on hierarchy " + hierarchy.getUniqueName()); }