Class: Mondrian::OLAP::Cube

Inherits:
Object
  • Object
show all
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.



25
26
27
28
# File 'lib/mondrian/olap/cube.rb', line 25

def initialize(connection, raw_cube)
  @connection = connection
  @raw_cube = raw_cube
end

Instance Attribute Details

#raw_cubeObject (readonly)

Returns the value of attribute raw_cube.



30
31
32
# File 'lib/mondrian/olap/cube.rb', line 30

def raw_cube
  @raw_cube
end

Class Method Details

.get(connection, name) ⇒ Object



19
20
21
22
23
# File 'lib/mondrian/olap/cube.rb', line 19

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



45
46
47
# File 'lib/mondrian/olap/cube.rb', line 45

def annotations
  annotations_for(@raw_cube)
end

#captionObject



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

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

#descriptionObject



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

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

#dimension(name) ⇒ Object



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

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

#dimension_namesObject



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

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

#dimensionsObject



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

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

#member(full_name) ⇒ Object



65
66
67
68
69
# File 'lib/mondrian/olap/cube.rb', line 65

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



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

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



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

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

#queryObject



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

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