Class: Mondrian::OLAP::Cube

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Annotated
Defined in:
lib/mondrian/olap/cube.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, raw_cube) ⇒ Cube

Returns a new instance of Cube.



27
28
29
30
31
# File 'lib/mondrian/olap/cube.rb', line 27

def initialize(connection, raw_cube)
  @connection = connection
  @raw_cube = raw_cube
  @cache_control = CacheControl.new(@connection, self)
end

Instance Attribute Details

#raw_cubeObject (readonly)

Returns the value of attribute raw_cube.



33
34
35
# File 'lib/mondrian/olap/cube.rb', line 33

def raw_cube
  @raw_cube
end

Class Method Details

.get(connection, name) ⇒ Object



21
22
23
24
25
# File 'lib/mondrian/olap/cube.rb', line 21

def self.get(connection, name)
  if raw_cube = connection.raw_schema.getCubes.get(name)
    Cube.new(connection, raw_cube)
  end
end

Instance Method Details

#annotationsObject



48
49
50
# File 'lib/mondrian/olap/cube.rb', line 48

def annotations
  annotations_for(@raw_cube)
end

#captionObject



43
44
45
# File 'lib/mondrian/olap/cube.rb', line 43

def caption
  @caption ||= @raw_cube.getCaption
end

#descriptionObject



39
40
41
# File 'lib/mondrian/olap/cube.rb', line 39

def description
  @description ||= @raw_cube.getDescription
end

#dimension(name) ⇒ Object



64
65
66
# File 'lib/mondrian/olap/cube.rb', line 64

def dimension(name)
  dimensions.detect{|d| d.name == name}
end

#dimension_namesObject



60
61
62
# File 'lib/mondrian/olap/cube.rb', line 60

def dimension_names
  dimensions.map{|d| d.name}
end

#dimensionsObject



56
57
58
# File 'lib/mondrian/olap/cube.rb', line 56

def dimensions
  @dimenstions ||= @raw_cube.getDimensions.map{|d| Dimension.new(self, d)}
end

#member(full_name) ⇒ Object



72
73
74
75
76
# File 'lib/mondrian/olap/cube.rb', line 72

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



78
79
80
81
82
# File 'lib/mondrian/olap/cube.rb', line 78

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

#nameObject



35
36
37
# File 'lib/mondrian/olap/cube.rb', line 35

def name
  @name ||= @raw_cube.getName
end

#queryObject



68
69
70
# File 'lib/mondrian/olap/cube.rb', line 68

def query
  Query.from(@connection, name)
end

#visible?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/mondrian/olap/cube.rb', line 52

def visible?
  @raw_cube.isVisible
end