birt-core 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/birt/core/rpt_design.rb +22 -0
- data/lib/birt/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a544bcc40ba2a57eed0d943ab9d06ac20b240dd6
|
4
|
+
data.tar.gz: 8cd5a6518a4e0f16f36e0625dfc90429664e9268
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2228a46334777181b79c6ec36ccb6a720d1ed80e3e3865e7b6035db692f993a7ad3a4d089332a1c8e1fe313707be718801c36dc940a7c06101082704e28509
|
7
|
+
data.tar.gz: 02296dda0057b373aeec3a9af7989ca7d273bdd68a11e6b42a67cb551edb84183f32ba73069d1b6b9ef37f4c8c7c324d5213c873c99576e25dc6b7d787d2a8a7
|
data/lib/birt/core/rpt_design.rb
CHANGED
@@ -2,20 +2,42 @@ class Birt::Core::RptDesign
|
|
2
2
|
|
3
3
|
#design文件路径
|
4
4
|
attr_accessor :rpt_design_path
|
5
|
+
|
6
|
+
#报表的名字
|
7
|
+
attr_accessor :display_name
|
8
|
+
|
9
|
+
#数据源
|
5
10
|
attr_accessor :data_sources
|
11
|
+
|
12
|
+
#数据集
|
6
13
|
attr_accessor :data_sets
|
14
|
+
|
15
|
+
#图表
|
7
16
|
attr_accessor :reports
|
8
17
|
|
18
|
+
|
9
19
|
def initialize(rpt_design_path)
|
10
20
|
self.rpt_design_path = rpt_design_path
|
11
21
|
@data_sources, @data_sets = {}, {}
|
12
22
|
@reports = {tables: {}}
|
13
23
|
end
|
14
24
|
|
25
|
+
def display_name(root=nil)
|
26
|
+
unless @display_name
|
27
|
+
_root = root|| REXML::Document.new(File.read(self.rpt_design_path)).root
|
28
|
+
names = _root.get_elements("/report/text-property[@name='displayName']")
|
29
|
+
@display_name = names[0].text if names
|
30
|
+
end
|
31
|
+
@display_name
|
32
|
+
end
|
33
|
+
|
15
34
|
#解析文件
|
16
35
|
def parse_rpt
|
17
36
|
_root = REXML::Document.new(File.read(self.rpt_design_path)).root
|
18
37
|
|
38
|
+
#报表名称
|
39
|
+
@display_name = self.display_name(_root)
|
40
|
+
|
19
41
|
#数据源
|
20
42
|
_root.each_element(xpath = '/report/data-sources/oda-data-source') do |item|
|
21
43
|
p @data_sources[item.attribute(:name).value] = Birt::Core::DataSource.new(item)
|
data/lib/birt/core/version.rb
CHANGED