Java Code Examples for org.olap4j.metadata.Member#getName()

The following examples show how to use org.olap4j.metadata.Member#getName() . 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 vote down vote up
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 2
Source File: CrossNavigationManager.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
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 3
Source File: DefaultWeightedAllocationAlgorithmDataManager.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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 4
Source File: EqualPartitioningOnLeafsAllocationAlgorithmDataManager.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Build the update statement for the measure
 *
 * @param buffer
 *            the buffer of the query
 * @param measure
 *            the measure to update
 * @param value
 *            the value to assign to the leafs
 */
@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 + " = " + values[0]);

}
 
Example 5
Source File: MondrianSchemaRetriver.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets the name of the column of the measure
 *
 * @param member
 * @return
 * @throws SpagoBIEngineException
 */
public String getMeasureColumn(Member member) throws SpagoBIEngineException {
	String measure = member.getName();
	try {
		if ((member.getDimension().getDimensionType().equals(Type.MEASURE))) {
			for (int i = 0; i < editCube.measures.length; i++) {
				if (editCube.measures[i].name.equals(measure)) {
					return editCube.measures[i].column;
				}
			}
		}
	} catch (OlapException e) {
		logger.error("Error loading the measure linked to the member " + member.getUniqueName(), e);
		throw new SpagoBIEngineException("Error loading the measure linked to the member " + member.getUniqueName(), e);
	}

	return null;
}