class Mondrian::OLAP::Cube

Attributes

raw_cube[R]

Public Class Methods

get(connection, name) click to toggle source
# File lib/mondrian/olap/cube.rb, line 23
def self.get(connection, name)
  if raw_cube = connection.raw_schema.getCubes.get(name)
    Cube.new(connection, raw_cube)
  end
end
new(connection, raw_cube) click to toggle source
# File lib/mondrian/olap/cube.rb, line 29
def initialize(connection, raw_cube)
  @connection = connection
  @raw_cube = raw_cube
  @cache_control = CacheControl.new(@connection, self)
end

Public Instance Methods

annotations() click to toggle source
# File lib/mondrian/olap/cube.rb, line 50
def annotations
  annotations_for(@raw_cube)
end
caption() click to toggle source
# File lib/mondrian/olap/cube.rb, line 45
def caption
  @caption ||= @raw_cube.getCaption
end
description() click to toggle source
# File lib/mondrian/olap/cube.rb, line 41
def description
  @description ||= @raw_cube.getDescription
end
dimension(name) click to toggle source
# File lib/mondrian/olap/cube.rb, line 66
def dimension(name)
  if @dimensions
    @dimensions.detect { |d| d.name == name }
  elsif raw_dimension = @raw_cube.getDimensions.detect { |d| d.getName == name }
    dimension_from_raw(raw_dimension)
  end
end
dimension_names() click to toggle source
# File lib/mondrian/olap/cube.rb, line 62
def dimension_names
  dimensions.map(&:name)
end
dimensions() click to toggle source
# File lib/mondrian/olap/cube.rb, line 58
def dimensions
  @dimenstions ||= @raw_cube.getDimensions.map { |d| dimension_from_raw(d) }
end
hierarchies() click to toggle source
# File lib/mondrian/olap/cube.rb, line 74
def hierarchies
  @hierarchies ||= @raw_cube.getHierarchies.map { |h| hierarchy_from_raw(h) }
end
hierarchy(name) click to toggle source
# File lib/mondrian/olap/cube.rb, line 82
def hierarchy(name)
  if @hierarchies
    @hierarchies.detect { |h| h.name == name }
  elsif raw_hierarchy = @raw_cube.getHierarchies.detect { |h| h.getName == name }
    hierarchy_from_raw(raw_hierarchy)
  end
end
hierarchy_names() click to toggle source
# File lib/mondrian/olap/cube.rb, line 78
def hierarchy_names
  hierarchies.map(&:name)
end
member(full_name) click to toggle source
# File lib/mondrian/olap/cube.rb, line 94
def member(full_name)
  segment_list = Java::OrgOlap4jMdx::IdentifierNode.parseIdentifier(full_name).getSegmentList
  raw_member = @raw_cube.lookupMember(segment_list)
  raw_member && Member.new(raw_member)
end
member_by_segments(*segment_names) click to toggle source
# File lib/mondrian/olap/cube.rb, line 100
def member_by_segments(*segment_names)
  segment_list = Java::OrgOlap4jMdx::IdentifierNode.ofNames(*segment_names).getSegmentList
  raw_member = @raw_cube.lookupMember(segment_list)
  raw_member && Member.new(raw_member)
end
name() click to toggle source
# File lib/mondrian/olap/cube.rb, line 37
def name
  @name ||= @raw_cube.getName
end
query() click to toggle source
# File lib/mondrian/olap/cube.rb, line 90
def query
  Query.from(@connection, name)
end
visible?() click to toggle source
# File lib/mondrian/olap/cube.rb, line 54
def visible?
  @raw_cube.isVisible
end

Private Instance Methods

dimension_from_raw(raw_dimension) click to toggle source
# File lib/mondrian/olap/cube.rb, line 111
def dimension_from_raw(raw_dimension)
  Dimension.new(self, raw_dimension)
end
hierarchy_from_raw(raw_hierarchy) click to toggle source
# File lib/mondrian/olap/cube.rb, line 115
def hierarchy_from_raw(raw_hierarchy)
  Hierarchy.new(dimension_from_raw(raw_hierarchy.getDimension), raw_hierarchy)
end