jasper-command-line 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -42,6 +42,7 @@ Options:
|
|
42
42
|
on the same location)
|
43
43
|
--data-file /path/to/file The .xml file to load the data from
|
44
44
|
--copies number The number of copies to generate
|
45
|
+
--locale locale The locale to use in the report (in the format xx-YY)
|
45
46
|
--param key=value Adds the parameter with name key with the value value
|
46
47
|
(can be defined multiple times)
|
47
48
|
|
@@ -16,6 +16,7 @@ module JasperCommandLine
|
|
16
16
|
puts " on the same location)"
|
17
17
|
puts "--data-file /path/to/file The .xml file to load the data from"
|
18
18
|
puts "--copies number The number of copies to generate"
|
19
|
+
puts "--locale locale The locale to use in the report (in the format xx-YY)"
|
19
20
|
puts "--param key=value Adds the parameter with name key with the value value"
|
20
21
|
puts " (can be defined multiple times)"
|
21
22
|
puts ""
|
@@ -95,6 +96,15 @@ module JasperCommandLine
|
|
95
96
|
raise ArgumentError.new("Ghostscript isn't available. Merging is not possible") if data[:copies] > 1 && !JasperCommandLine.ghostscript_available?
|
96
97
|
end
|
97
98
|
|
99
|
+
when 'locale'
|
100
|
+
i = get_option_data(arguments, i) do |argument_data|
|
101
|
+
raise ArgumentError.new("Invalid locale: #{argument_data}") unless argument_data =~ /^[a-z]{2}-[A-Za-z0-9]{2,3}$/
|
102
|
+
data[:locale] = {
|
103
|
+
:language => argument_data.strip.split('-').first,
|
104
|
+
:sub_language => argument_data.strip.split('-').last
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
98
108
|
when 'sign-key-file'
|
99
109
|
# Sign document with file
|
100
110
|
i = get_option_data(arguments, i) do |argument_data|
|
@@ -32,6 +32,7 @@ module JasperCommandLine
|
|
32
32
|
jrxml_file = jasper_file.sub(/\.jasper$/, ".jrxml")
|
33
33
|
|
34
34
|
sign_options = options.delete(:signature)
|
35
|
+
locale_options = options.delete(:locale)
|
35
36
|
|
36
37
|
# begin
|
37
38
|
# Convert the ruby parameters' hash to a java HashMap.
|
@@ -58,6 +59,8 @@ module JasperCommandLine
|
|
58
59
|
|
59
60
|
jasper_params.put(@jRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, data_document)
|
60
61
|
|
62
|
+
jasper_params.put(@jRParameter.REPORT_LOCALE, @locale.new(locale_options[:language], locale_options[:sub_language])) if locale_options
|
63
|
+
|
61
64
|
temp_file = Tempfile.new(['pdf-', '.pdf'])
|
62
65
|
file = temp_file.path
|
63
66
|
temp_file.close!
|
@@ -79,6 +82,7 @@ module JasperCommandLine
|
|
79
82
|
jasper_print = @jasperFillManager.fillReport(jasper_file, jasper_params)
|
80
83
|
|
81
84
|
File.open(copy_file, 'wb') { |f| f.write @jasperExportManager._invoke('exportReportToPdf', 'Lnet.sf.jasperreports.engine.JasperPrint;', jasper_print) }
|
85
|
+
# @jasperExportManager._invoke('exportReportToHtmlFile', 'Lnet.sf.jasperreports.engine.JasperPrint;Ljava.lang.String;', jasper_print, @javaString.new('./x.html'))
|
82
86
|
|
83
87
|
merge_pdf_command_line << " #{copy_file}"
|
84
88
|
|
@@ -151,11 +155,13 @@ module JasperCommandLine
|
|
151
155
|
@jasperFillManager = Rjb::import 'net.sf.jasperreports.engine.JasperFillManager'
|
152
156
|
@jasperPrint = Rjb::import 'net.sf.jasperreports.engine.JasperPrint'
|
153
157
|
@jRXmlUtils = Rjb::import 'net.sf.jasperreports.engine.util.JRXmlUtils'
|
158
|
+
@jRParameter = Rjb::import 'net.sf.jasperreports.engine.JRParameter'
|
154
159
|
# This is here to avoid the "already initialized constant QUERY_EXECUTER_FACTORY_PREFIX" warnings.
|
155
160
|
@jRXPathQueryExecuterFactory = silence_warnings{Rjb::import 'net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory'}
|
156
161
|
@inputSource = Rjb::import 'org.xml.sax.InputSource'
|
157
162
|
@stringReader = Rjb::import 'java.io.StringReader'
|
158
163
|
@hashMap = Rjb::import 'java.util.HashMap'
|
164
|
+
@locale = Rjb::import 'java.util.Locale'
|
159
165
|
@byteArrayInputStream = Rjb::import 'java.io.ByteArrayInputStream'
|
160
166
|
@javaString = Rjb::import 'java.lang.String'
|
161
167
|
@jFreeChart = Rjb::import 'org.jfree.chart.JFreeChart'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasper-command-line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rjb
|