Class: Mondrian::OLAP::Cube
- Inherits:
-
Object
- Object
- Mondrian::OLAP::Cube
- Extended by:
- Forwardable
- Includes:
- Annotated
- Defined in:
- lib/mondrian/olap/cube.rb
Instance Attribute Summary collapse
-
#raw_cube ⇒ Object
readonly
Returns the value of attribute raw_cube.
Class Method Summary collapse
Instance Method Summary collapse
- #annotations ⇒ Object
- #caption ⇒ Object
- #description ⇒ Object
- #dimension(name) ⇒ Object
- #dimension_names ⇒ Object
- #dimensions ⇒ Object
- #hierarchies ⇒ Object
- #hierarchy(name) ⇒ Object
- #hierarchy_names ⇒ Object
-
#initialize(connection, raw_cube) ⇒ Cube
constructor
A new instance of Cube.
- #member(full_name) ⇒ Object
- #member_by_segments(*segment_names) ⇒ Object
- #name ⇒ Object
- #query ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(connection, raw_cube) ⇒ Cube
Returns a new instance of Cube.
29 30 31 32 33 |
# 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 |
Instance Attribute Details
#raw_cube ⇒ Object (readonly)
Returns the value of attribute raw_cube.
35 36 37 |
# File 'lib/mondrian/olap/cube.rb', line 35 def raw_cube @raw_cube end |
Class Method Details
Instance Method Details
#annotations ⇒ Object
50 51 52 |
# File 'lib/mondrian/olap/cube.rb', line 50 def annotations annotations_for(@raw_cube) end |
#caption ⇒ Object
45 46 47 |
# File 'lib/mondrian/olap/cube.rb', line 45 def @caption ||= @raw_cube.getCaption end |
#description ⇒ Object
41 42 43 |
# File 'lib/mondrian/olap/cube.rb', line 41 def description @description ||= @raw_cube.getDescription end |
#dimension(name) ⇒ Object
66 67 68 69 70 71 72 |
# 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 ⇒ Object
62 63 64 |
# File 'lib/mondrian/olap/cube.rb', line 62 def dimension_names dimensions.map(&:name) end |
#dimensions ⇒ Object
58 59 60 |
# File 'lib/mondrian/olap/cube.rb', line 58 def dimensions @dimenstions ||= @raw_cube.getDimensions.map { |d| dimension_from_raw(d) } end |
#hierarchies ⇒ Object
74 75 76 |
# File 'lib/mondrian/olap/cube.rb', line 74 def hierarchies @hierarchies ||= @raw_cube.getHierarchies.map { |h| hierarchy_from_raw(h) } end |
#hierarchy(name) ⇒ Object
82 83 84 85 86 87 88 |
# 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 ⇒ Object
78 79 80 |
# File 'lib/mondrian/olap/cube.rb', line 78 def hierarchy_names hierarchies.map(&:name) end |
#member(full_name) ⇒ Object
94 95 96 97 98 |
# 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) ⇒ Object
100 101 102 103 104 |
# 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 ⇒ Object
37 38 39 |
# File 'lib/mondrian/olap/cube.rb', line 37 def name @name ||= @raw_cube.getName end |
#query ⇒ Object
90 91 92 |
# File 'lib/mondrian/olap/cube.rb', line 90 def query Query.from(@connection, name) end |
#visible? ⇒ Boolean
54 55 56 |
# File 'lib/mondrian/olap/cube.rb', line 54 def visible? @raw_cube.isVisible end |