本文整理汇总了Java中org.olap4j.metadata.Hierarchy类的典型用法代码示例。如果您正苦于以下问题:Java Hierarchy类的具体用法?Java Hierarchy怎么用?Java Hierarchy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hierarchy类属于org.olap4j.metadata包,在下文中一共展示了Hierarchy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupMember
import org.olap4j.metadata.Hierarchy; //导入依赖的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.Hierarchy; //导入依赖的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: Olap4jHierarchy
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
public Olap4jHierarchy(Hierarchy hierarchy)
{
this.hierarchy = hierarchy;
if (hierarchy == null)
{
levels = new Olap4jLevel[0];
}
else
{
NamedList<org.olap4j.metadata.Level> hierarchyLevels = hierarchy.getLevels();
levels = new Olap4jLevel[hierarchyLevels.size()];
for (int i = 0; i < hierarchyLevels.size(); i++)
{
levels[i] = new Olap4jLevel(hierarchyLevels.get(i));
}
}
}
示例4: Olap4jResultAxis
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
public Olap4jResultAxis(CellSetAxis axis,
List<Hierarchy> axisHierarchies,
Olap4jFactory factory)
{
List<Position> positions = axis.getPositions();
this.tuples = new ArrayList<Olap4jTuple>(positions.size());
for (Iterator<Position> it = positions.iterator(); it.hasNext(); )
{
tuples.add(new Olap4jTuple(it.next(), factory));
}
this.hierarchies = new ArrayList<Olap4jHierarchy>(axisHierarchies.size());
for (Iterator<Hierarchy> it = axisHierarchies.iterator(); it.hasNext(); )
{
hierarchies.add(new Olap4jHierarchy(it.next()));
}
}
示例5: HierarchyComponent
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
/**
* @param axis
* The {@link CellSetAxis} that this HierachyComponent is in.
* @param hierarchy
* The hierarchy that this Component represents. Must not be
* null.
* @param hierarchyOrdinal
* The index of <tt>hierarchy</tt> within <tt>axis</tt>.
* @param columnModel
* The columnModel that will be used to determine column
* positions in the table. If the axis type is not
* {@link Axis#COLUMNS}, then this can be null.
*/
public HierarchyComponent(CellSetAxis axis, Hierarchy hierarchy, final int hierarchyOrdinal, TableColumnModel columnModel) {
// HierarchyComponent may exceed the default maximum size of
// Short.MAX_VALUE x Short.MAX_VALUE, so we have to increase it or
// it won't display properly.
this.setMaximumSize(new java.awt.Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
this.axis = axis;
this.hierarchyOrdinal = hierarchyOrdinal;
this.columnModel = columnModel;
this.hierarchy = hierarchy;
if (hierarchy == null) {
throw new NullPointerException("Null hierarchy not allowed");
}
setOpaque(true);
addMouseListener(mouseHandler);
addMouseMotionListener(mouseHandler);
}
示例6: determineRowAxisColumns
import org.olap4j.metadata.Hierarchy; //导入依赖的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;
}
示例7: populateDimension
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
protected void populateDimension(
OlapConnection connection,
Catalog catalog,
Cube cube,
Dimension dimension,
int ordinal,
List<Row> rows)
throws XmlaException, SQLException
{
final NamedList<Hierarchy> hierarchies = dimension.getHierarchies();
for (Hierarchy hierarchy
: filter(hierarchies, hierarchyNameCond, hierarchyUnameCond))
{
populateHierarchy(
connection,
catalog,
cube,
dimension,
hierarchy,
ordinal + hierarchies.indexOf(hierarchy),
rows);
}
}
示例8: getHierarchies
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
public NamedList<Hierarchy> getHierarchies() {
NamedList<MondrianOlap4jHierarchy> list =
new NamedListImpl<MondrianOlap4jHierarchy>();
final MondrianOlap4jConnection olap4jConnection =
olap4jSchema.olap4jCatalog.olap4jDatabaseMetaData.olap4jConnection;
final mondrian.olap.SchemaReader schemaReader =
olap4jConnection.getMondrianConnection2().getSchemaReader()
.withLocus();
for (mondrian.olap.Dimension dimension
: schemaReader.getCubeDimensions(cube))
{
for (mondrian.olap.Hierarchy hierarchy
: schemaReader.getDimensionHierarchies(dimension))
{
list.add(
new MondrianOlap4jHierarchy(
olap4jSchema, hierarchy));
}
}
return Olap4jUtil.cast(list);
}
示例9: getHierarchiesNonFilter
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
/**
* Returns the hierarchies on a non-filter axis.
*
* @return List of hierarchies, never null
*/
private List<Hierarchy> getHierarchiesNonFilter() {
final Exp exp = queryAxis.getSet();
if (exp == null) {
return Collections.emptyList();
}
List<Hierarchy> hierarchyList = new ArrayList<Hierarchy>();
for (mondrian.olap.Hierarchy hierarchy
: TypeUtil.getHierarchies(exp.getType()))
{
hierarchyList.add(
cellSetMetaData.olap4jStatement.olap4jConnection.toOlap4j(
hierarchy));
}
return hierarchyList;
}
示例10: axisInfo
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
private List<Hierarchy> axisInfo(SaxWriter writer, CellSetAxis axis, String axisName) {
writer.startElement("AxisInfo", "name", axisName);
List<Hierarchy> hierarchies;
Iterator<org.olap4j.Position> it = axis.getPositions().iterator();
if (it.hasNext()) {
final org.olap4j.Position position = it.next();
hierarchies = new ArrayList<Hierarchy>();
for (Member member : position.getMembers()) {
hierarchies.add(member.getHierarchy());
}
} else {
hierarchies = axis.getAxisMetaData().getHierarchies();
}
List<Property> props = getProps(axis.getAxisMetaData());
writeHierarchyInfo(writer, hierarchies, props);
writer.endElement(); // AxisInfo
return hierarchies;
}
示例11: writeHierarchyInfo
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
private void writeHierarchyInfo(SaxWriter writer, List<Hierarchy> hierarchies, List<Property> props) {
writer.startSequence(null, "HierarchyInfo");
for (Hierarchy hierarchy : hierarchies) {
writer.startElement("HierarchyInfo", "name", "[" + hierarchy.getName() + "]");
// exclude props "PARENT_UNIQUE_NAME" and "HIERARCHY_UNIQUE_NAME" by
// exlcuding props[1]
for (final Property prop : props) {
if (!prop.getName().equals("PARENT_UNIQUE_NAME") && !prop.getName().equals("HIERARCHY_UNIQUE_NAME")) {
final String encodedProp = encoder.encode(prop.getName());
final Object[] attributes = getAttributes(prop, hierarchy);
writer.element(encodedProp, attributes);
}
}
writer.endElement(); // HierarchyInfo
}
writer.endSequence(); // "HierarchyInfo"
}
示例12: getHierarchies
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
@Override
protected List<Hierarchy> getHierarchies() {
List<Hierarchy> hierarchies = new ArrayList<Hierarchy>();
for(LevelMemberSet layer : layers){
Hierarchy h = layer.getLevel().getHierarchy();
if(!hierarchies.contains(h))
hierarchies.add(h);
}
return hierarchies;
}
示例13: equals
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
if(! (obj instanceof Hierarchy) )
return true;
Hierarchy h = (Hierarchy) obj;
return getUniqueName().equals(h.getUniqueName());
}
示例14: getHierarchies
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
@Override
public NamedList<Hierarchy> getHierarchies() {
if(hierarchies!=null)
return hierarchies;
hierarchies = MetadataUtils.metadataNamedList(new ArrayList<Hierarchy>());
return hierarchies;
}
示例15: readHierarchies
import org.olap4j.metadata.Hierarchy; //导入依赖的package包/类
private void readHierarchies() throws OlapException {
hierarchies = MetadataUtils.metadataNamedList(new ArrayList<Hierarchy>());
Map<String, AttributeDefinition> attributeMap = new HashMap<String, AttributeDefinition>();
if(definition.attributes!=null)
for(AttributeDefinition cdef: definition.attributes){
attributeMap.put(cdef.name, cdef);
if(cdef.auto_hierarchy){
hierarchies.add(new ServerHierarchy(this, cdef, Collections.singletonList((NamedElement)cdef)));
}
}
if(definition.hierarchies!=null)
for(HierarchyDefinition hdef : definition.hierarchies){
List<NamedElement> levelDefs = new ArrayList<NamedElement>();
for(String level : hdef.levels){
AttributeDefinition attr_def = attributeMap.get(level);
if(attr_def==null)
throw new OlapException("Fail to find attribute "+level+" used in dimension "+ getName());
levelDefs.add(attr_def);
}
hierarchies.add(new ServerHierarchy(this, hdef, levelDefs));
}
}