本文整理汇总了Java中org.olap4j.metadata.Level类的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于org.olap4j.metadata包,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupMember
import org.olap4j.metadata.Level; //导入依赖的package包/类
@Override
public Member lookupMember(List<IdentifierSegment> nameParts)
throws OlapException {
Dimension dim = getDimensions().get(nameParts.get(0).getName());
if(dim instanceof ServerMeasureDimension){
String mp = nameParts.get(1).getName();
for(Measure m : getMeasures()){
if(m.getName()!=null && m.getName().equals(mp))
return m;
}
}else if(dim instanceof ServerDimension && nameParts.size()>2){
Hierarchy h = dim.getHierarchies().get(nameParts.get(1).getName());
if(h!=null){
Level level = h.getLevels().get(nameParts.get(2).getName());
if(level!=null){
if(level.getLevelType()==Type.ALL)
return h.getDefaultMember();
else if(nameParts.size()>3)
return new LevelMember(level, nameParts.get(3).getName(), 0);
}
}
}
return null;
}
示例2: lookupLevel
import org.olap4j.metadata.Level; //导入依赖的package包/类
public static Level lookupLevel(Cube cube, List<IdentifierSegment> segmentList) {
if(segmentList.size() < 2)
return null;
Dimension dim = cube.getDimensions().get(segmentList.get(0).getName());
if(dim instanceof ServerDimension){
Hierarchy h = dim.getHierarchies().get(segmentList.get(1).getName());
if(h!=null && segmentList.size()==3 && h.getLevels().size()==1){
return h.getLevels().get(0);
}else if(h!=null && segmentList.size()==4){
return h.getLevels().get(segmentList.get(2).getName());
}
}
return null;
}
示例3: determineRowAxisColumns
import org.olap4j.metadata.Level; //导入依赖的package包/类
/**
*
* @param axis
* @return
*/
private List<Level> determineRowAxisColumns(CellSetAxis axis) {
Set<Level> levelsEncountered = new HashSet<Level>();
for (Position p : axis.getPositions()) {
for (Member m : p.getMembers()) {
levelsEncountered.add(m.getLevel());
}
}
List<Level> columnAssignments = new ArrayList<Level>();
for (Hierarchy h : axis.getAxisMetaData().getHierarchies()) {
for (Level l : h.getLevels()) {
if (levelsEncountered.contains(l)) {
columnAssignments.add(l);
}
}
}
return columnAssignments;
}
示例4: populateLevel
import org.olap4j.metadata.Level; //导入依赖的package包/类
private void populateLevel(
Catalog catalog,
Cube cube,
Level level,
List<Row> rows)
throws SQLException
{
final XmlaHandler.XmlaExtra extra =
getExtra(catalog.getMetaData().getConnection());
for (Property property
: filter(extra.getLevelProperties(level), propertyNameCond))
{
if (extra.isPropertyInternal(property)) {
continue;
}
outputProperty(
property, catalog, cube, level, rows);
}
}
示例5: populateCube
import org.olap4j.metadata.Level; //导入依赖的package包/类
protected void populateCube(OlapConnection connection, Catalog catalog, Cube cube, List<Row> rows) throws XmlaException, SQLException {
if (isRestricted(LevelUniqueName)) {
// Note: If the LEVEL_UNIQUE_NAME has been specified, then
// the dimension and hierarchy are specified implicitly.
String levelUniqueName = getRestrictionValueAsString(LevelUniqueName);
if (levelUniqueName == null) {
// The query specified two or more unique names
// which means that nothing will match.
return;
}
Level level = lookupLevel(cube, levelUniqueName);
if (level != null) {
// Get members of this level, without access control, but
// including calculated members.
List<Member> members = level.getMembers();
outputMembers(connection, members, catalog, cube, rows);
}
} else {
for (Dimension dimension : filter(cube.getDimensions(), dimensionUnameCond)) {
populateDimension(connection, catalog, cube, dimension, rows);
}
}
}
示例6: LevelMember
import org.olap4j.metadata.Level; //导入依赖的package包/类
public LevelMember(Level level, String name, int ordinal){
String[] comps = name.split("///",2);
this.level = level;
this.name = clearControls( (comps.length>1 && !comps[0].isEmpty()) ? comps[1] : comps[0]);
this.key = clearControls(comps[0]);
this.ordinal = ordinal;
}
示例7: memberSet
import org.olap4j.metadata.Level; //导入依赖的package包/类
@Override
public List<LevelMemberSet> memberSet() throws OlapException {
Level level = MetadataUtils.lookupLevel(cube, node.getSegmentList());
if(level==null)
throw new OlapException("Level not found in cube: "+ParseUtils.toString(node));
return Collections.singletonList(new LevelMemberSet(level, node, this));
}
示例8: ServerHierarchy
import org.olap4j.metadata.Level; //导入依赖的package包/类
public ServerHierarchy(ServerDimension serverDimension, NamedElement cdef,
List<NamedElement> levelDefs) {
this.serverDimension = serverDimension;
this.definition = cdef;
this.levels = MetadataUtils.metadataNamedList(new ArrayList<Level>());
levels.add(allLevel);
int depth = 1;
for(NamedElement attr_def : levelDefs){
levels.add(new ServerLevel(this, attr_def, depth++));
}
}
示例9: lookupMember
import org.olap4j.metadata.Level; //导入依赖的package包/类
public static Member lookupMember(Cube cube, List<IdentifierSegment> segmentList) {
if(segmentList.size() < 3)
return null;
Dimension dim = cube.getDimensions().get(segmentList.get(0).getName());
if(dim instanceof ServerDimension){
Hierarchy h = dim.getHierarchies().get(segmentList.get(1).getName());
if(h!=null){
Level level = null;
String memberName = null;
if(segmentList.size()==3){
level = h.hasAll() ? h.getLevels().get(1) : h.getLevels().get(0);
memberName = segmentList.get(2).getName();
}else if(segmentList.size()==4){
level = h.getLevels().get(segmentList.get(2).getName());
memberName = segmentList.get(3).getName();
}
if(level!=null){
return new LevelMember(level, memberName, memberName, 0);
}
}
}
return null;
}
示例10: getLevelForColumn
import org.olap4j.metadata.Level; //导入依赖的package包/类
/**
* Provides the inverse mapping of {@link #findColumnForLevel(Level)}.
*
* @param colNum
* The result set column number (1-based; first column is 1).
* @return The Level associated with the given column, or null if the given
* column does not exist or is not a Level column.
* @throws SQLException
* if colNum is not a legal column index in this result set.
*/
private Level getLevelForColumn(int colNum) throws SQLException {
if (colNum > rsmd.getColumnCount() || colNum < 1) {
throw new SQLException(
"Column index out of bounds. You requested " + colNum +
"; legal range is 1.." + rsmd.getColumnCount());
} else if (colNum <= rowAxisColumns.size()) {
return rowAxisColumns.get(colNum - 1);
} else {
return null;
}
}
示例11: populateHierarchy
import org.olap4j.metadata.Level; //导入依赖的package包/类
protected void populateHierarchy(
OlapConnection connection,
Catalog catalog,
Cube cube,
Hierarchy hierarchy,
List<Row> rows)
throws XmlaException, SQLException
{
for (Level level
: filter(hierarchy.getLevels(), levelUnameCond, levelNameCond))
{
outputLevel(
connection, catalog, cube, hierarchy, level, rows);
}
}
示例12: populateCube
import org.olap4j.metadata.Level; //导入依赖的package包/类
protected void populateCube(
OlapConnection connection,
Catalog catalog,
Cube cube,
List<Row> rows)
throws XmlaException, SQLException
{
if (isRestricted(LevelUniqueName)) {
// Note: If the LEVEL_UNIQUE_NAME has been specified, then
// the dimension and hierarchy are specified implicitly.
String levelUniqueName =
getRestrictionValueAsString(LevelUniqueName);
if (levelUniqueName == null) {
// The query specified two or more unique names
// which means that nothing will match.
return;
}
Level level = lookupLevel(cube, levelUniqueName);
if (level != null) {
// Get members of this level, without access control, but
// including calculated members.
List<Member> members = level.getMembers();
outputMembers(connection, members, catalog, cube, rows);
}
} else {
for (Dimension dimension
: filter(cube.getDimensions(), dimensionUnameCond))
{
populateDimension(
connection, catalog, cube, dimension, rows);
}
}
}
示例13: lookupLevel
import org.olap4j.metadata.Level; //导入依赖的package包/类
private static Level lookupLevel(Cube cube, String levelUniqueName) {
for (Dimension dimension : cube.getDimensions()) {
for (Hierarchy hierarchy : dimension.getHierarchies()) {
for (Level level : hierarchy.getLevels()) {
if (level.getUniqueName().equals(levelUniqueName)) {
return level;
}
}
}
}
return null;
}
示例14: MondrianOlap4jLevel
import org.olap4j.metadata.Level; //导入依赖的package包/类
/**
* Creates a MondrianOlap4jLevel.
*
* @param olap4jSchema Schema
* @param level Mondrian level
*/
MondrianOlap4jLevel(
MondrianOlap4jSchema olap4jSchema,
mondrian.olap.Level level)
{
this.olap4jSchema = olap4jSchema;
this.level = level;
}
示例15: getLevelCardinality
import org.olap4j.metadata.Level; //导入依赖的package包/类
public int getLevelCardinality(Level level) throws OlapException {
if (level instanceof MondrianOlap4jLevel) {
// Improved implementation if the provider is mondrian.
final MondrianOlap4jLevel olap4jLevel = (MondrianOlap4jLevel) level;
final mondrian.olap.SchemaReader schemaReader =
olap4jLevel.olap4jSchema.olap4jCatalog.olap4jDatabaseMetaData
.olap4jConnection.getMondrianConnection().getSchemaReader()
.withLocus();
return schemaReader.getLevelCardinality(
olap4jLevel.level, true, true);
} else {
return level.getCardinality();
}
}