Drop JasperReports support
Issue: SPR-13294
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public abstract class AbstractConfigurableJasperReportsViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void noConfiguredExporter() throws Exception {
|
||||
ConfigurableJasperReportsView view = new ConfigurableJasperReportsView();
|
||||
view.setUrl(COMPILED_REPORT);
|
||||
// Should not be able to set up view class without an exporter class.
|
||||
view.setApplicationContext(new StaticApplicationContext());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.ui.jasperreports.PersonBean;
|
||||
import org.springframework.ui.jasperreports.ProductBean;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public abstract class AbstractJasperReportsTests {
|
||||
|
||||
protected static final String COMPILED_REPORT = "/org/springframework/ui/jasperreports/DataSourceReport.jasper";
|
||||
|
||||
protected static final String UNCOMPILED_REPORT = "/org/springframework/ui/jasperreports/DataSourceReport.jrxml";
|
||||
|
||||
protected static final String SUB_REPORT_PARENT = "/org/springframework/ui/jasperreports/subReportParent.jrxml";
|
||||
|
||||
protected static final boolean canCompileReport = ClassUtils.isPresent(
|
||||
"org.eclipse.jdt.internal.compiler.Compiler", AbstractJasperReportsTests.class.getClassLoader());
|
||||
|
||||
|
||||
protected final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
protected final MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
{
|
||||
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
|
||||
request.addPreferredLocale(Locale.GERMAN);
|
||||
}
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void assumptions() {
|
||||
Assume.canLoadNativeDirFonts();
|
||||
}
|
||||
|
||||
|
||||
protected Map<String, Object> getModel() {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("ReportTitle", "Dear Lord!");
|
||||
model.put("dataSource", new JRBeanCollectionDataSource(getData()));
|
||||
extendModel(model);
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses can extend the model if they need to.
|
||||
*/
|
||||
protected void extendModel(Map<String, Object> model) {
|
||||
}
|
||||
|
||||
protected List<Object> getData() {
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (int x = 0; x < 10; x++) {
|
||||
PersonBean bean = new PersonBean();
|
||||
bean.setId(x);
|
||||
bean.setName("Rob Harrop");
|
||||
bean.setStreet("foo");
|
||||
list.add(bean);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<Object> getProductData() {
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (int x = 0; x < 10; x++) {
|
||||
ProductBean bean = new ProductBean();
|
||||
bean.setId(x);
|
||||
bean.setName("Foo Bar");
|
||||
bean.setPrice(1.9f);
|
||||
bean.setQuantity(1.0f);
|
||||
list.add(bean);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import net.sf.jasperreports.engine.JRDataSource;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
import net.sf.jasperreports.engine.JasperReport;
|
||||
import net.sf.jasperreports.engine.data.JRAbstractBeanDataSourceProvider;
|
||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.context.ApplicationContextException;
|
||||
import org.springframework.mock.web.test.MockServletContext;
|
||||
import org.springframework.ui.jasperreports.PersonBean;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractJasperReportsViewTests extends AbstractJasperReportsTests {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException exception = ExpectedException.none();
|
||||
|
||||
|
||||
/**
|
||||
* Simple test to see if compiled report succeeds.
|
||||
*/
|
||||
@Test
|
||||
public void compiledReport() throws Exception {
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(getModel(), request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
|
||||
assumeTrue(view instanceof AbstractJasperReportsSingleFormatView
|
||||
&& ((AbstractJasperReportsSingleFormatView) view).useWriter());
|
||||
|
||||
String output = response.getContentAsString();
|
||||
assertTrue("Output should contain 'MeineSeite'", output.contains("MeineSeite"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uncompiledReport() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
view.render(getModel(), request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInvalidPath() throws Exception {
|
||||
exception.expect(ApplicationContextException.class);
|
||||
getView("foo.jasper");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidExtension() throws Exception {
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
getView("foo.bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contentType() throws Exception {
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(getModel(), request, response);
|
||||
assertEquals("Response content type is incorrect", getDesiredContentType(), response.getContentType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutDatasource() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getStatus() == HttpServletResponse.SC_OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCollection() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData());
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void withMultipleCollections() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData());
|
||||
model.put("otherData", new LinkedList());
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
// no clear data source found
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withJRDataSourceProvider() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("dataSource", new MockDataSourceProvider(PersonBean.class));
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void withSpecificCollection() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData());
|
||||
model.put("otherData", new LinkedList());
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.setReportDataKey("reportData");
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withArray() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData().toArray());
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultipleArrays() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData().toArray());
|
||||
model.put("otherData", new String[0]);
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(model, request, response);
|
||||
// no clear data source found
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSpecificArray() throws Exception {
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("reportData", getData().toArray());
|
||||
model.put("otherData", new String[0]);
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.setReportDataKey("reportData");
|
||||
view.render(model, request, response);
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSubReport() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.put("SubReportData", getProductData());
|
||||
|
||||
Properties subReports = new Properties();
|
||||
subReports.put("ProductsSubReport", "/org/springframework/ui/jasperreports/subReportChild.jrxml");
|
||||
|
||||
AbstractJasperReportsView view = getView(SUB_REPORT_PARENT);
|
||||
view.setReportDataKey("dataSource");
|
||||
view.setSubReportUrls(subReports);
|
||||
view.setSubReportDataKeys(new String[]{"SubReportData"});
|
||||
view.initApplicationContext();
|
||||
view.render(model, request, response);
|
||||
|
||||
assertTrue(response.getContentAsByteArray().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNonExistentSubReport() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.put("SubReportData", getProductData());
|
||||
|
||||
Properties subReports = new Properties();
|
||||
subReports.put("ProductsSubReport", "org/springframework/ui/jasperreports/subReportChildFalse.jrxml");
|
||||
|
||||
AbstractJasperReportsView view = getView(SUB_REPORT_PARENT);
|
||||
view.setReportDataKey("dataSource");
|
||||
view.setSubReportUrls(subReports);
|
||||
view.setSubReportDataKeys(new String[]{"SubReportData"});
|
||||
|
||||
// Invalid report URL should throw ApplicationContextException
|
||||
exception.expect(ApplicationContextException.class);
|
||||
view.initApplicationContext();
|
||||
}
|
||||
|
||||
// TODO Determine why encoding does not get overridden.
|
||||
@Ignore("Disabled since encoding does not get overridden")
|
||||
@Test
|
||||
public void overrideExporterParameters() throws Exception {
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
|
||||
assumeTrue(view instanceof AbstractJasperReportsSingleFormatView
|
||||
&& ((AbstractJasperReportsSingleFormatView) view).useWriter());
|
||||
|
||||
String characterEncoding = "UTF-8";
|
||||
String overiddenCharacterEncoding = "ASCII";
|
||||
|
||||
Map<Object, Object> parameters = new HashMap<>();
|
||||
parameters.put(net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING, characterEncoding);
|
||||
|
||||
view.setExporterParameters(parameters);
|
||||
view.convertExporterParameters();
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.put(net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING.toString(),
|
||||
overiddenCharacterEncoding);
|
||||
|
||||
view.render(model, this.request, this.response);
|
||||
|
||||
assertEquals(overiddenCharacterEncoding, this.response.getCharacterEncoding());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subReportWithUnspecifiedParentDataSource() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.put("SubReportData", getProductData());
|
||||
|
||||
Properties subReports = new Properties();
|
||||
subReports.put("ProductsSubReport", "org/springframework/ui/jasperreports/subReportChildFalse.jrxml");
|
||||
|
||||
AbstractJasperReportsView view = getView(SUB_REPORT_PARENT);
|
||||
view.setSubReportUrls(subReports);
|
||||
view.setSubReportDataKeys(new String[]{"SubReportData"});
|
||||
|
||||
// Unspecified reportDataKey should throw exception when subReportDataSources is specified
|
||||
exception.expect(ApplicationContextException.class);
|
||||
view.initApplicationContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contentDisposition() throws Exception {
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.render(getModel(), request, response);
|
||||
assertEquals("Invalid content type", "inline", response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void overrideContentDisposition() throws Exception {
|
||||
Properties headers = new Properties();
|
||||
String cd = "attachment";
|
||||
headers.setProperty("Content-Disposition", cd);
|
||||
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.setHeaders(headers);
|
||||
view.render(getModel(), request, response);
|
||||
assertEquals("Invalid content type", cd, response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setCustomHeaders() throws Exception {
|
||||
Properties headers = new Properties();
|
||||
|
||||
String key = "foo";
|
||||
String value = "bar";
|
||||
|
||||
headers.setProperty(key, value);
|
||||
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
view.setHeaders(headers);
|
||||
view.render(getModel(), request, response);
|
||||
|
||||
assertNotNull("Header not present", response.getHeader(key));
|
||||
assertEquals("Invalid header value", value, response.getHeader(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withJdbcDataSource() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
view.setJdbcDataSource(getMockJdbcDataSource());
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
|
||||
// DataSource was not used as report DataSource
|
||||
exception.expect(SQLException.class);
|
||||
view.render(model, request, response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withJdbcDataSourceInModel() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
|
||||
Map<String, Object> model = getModel();
|
||||
model.remove("dataSource");
|
||||
model.put("someKey", getMockJdbcDataSource());
|
||||
|
||||
// DataSource was not used as report DataSource
|
||||
exception.expect(SQLException.class);
|
||||
view.render(model, request, response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jrDataSourceOverridesJdbcDataSource() throws Exception {
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
view.setJdbcDataSource(getMockJdbcDataSource());
|
||||
|
||||
view.render(getModel(), request, response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCharacterEncoding() throws Exception {
|
||||
AbstractJasperReportsView view = getView(COMPILED_REPORT);
|
||||
|
||||
assumeTrue(view instanceof AbstractJasperReportsSingleFormatView
|
||||
&& ((AbstractJasperReportsSingleFormatView) view).useWriter());
|
||||
|
||||
String characterEncoding = "UTF-8";
|
||||
|
||||
Map<Object, Object> parameters = new HashMap<>();
|
||||
parameters.put(net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING, characterEncoding);
|
||||
|
||||
view.setExporterParameters(parameters);
|
||||
view.convertExporterParameters();
|
||||
|
||||
view.render(getModel(), this.request, this.response);
|
||||
assertEquals(characterEncoding, this.response.getCharacterEncoding());
|
||||
}
|
||||
|
||||
protected AbstractJasperReportsView getView(String url) throws Exception {
|
||||
AbstractJasperReportsView view = getViewImplementation();
|
||||
view.setUrl(url);
|
||||
StaticWebApplicationContext ac = new StaticWebApplicationContext();
|
||||
ac.setServletContext(new MockServletContext());
|
||||
ac.addMessage("page", Locale.GERMAN, "MeineSeite");
|
||||
ac.refresh();
|
||||
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
|
||||
view.setApplicationContext(ac);
|
||||
return view;
|
||||
}
|
||||
|
||||
protected abstract AbstractJasperReportsView getViewImplementation();
|
||||
|
||||
protected abstract String getDesiredContentType();
|
||||
|
||||
private DataSource getMockJdbcDataSource() throws SQLException {
|
||||
DataSource ds = mock(DataSource.class);
|
||||
given(ds.getConnection()).willThrow(new SQLException());
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
private class MockDataSourceProvider extends JRAbstractBeanDataSourceProvider {
|
||||
|
||||
public MockDataSourceProvider(Class<?> clazz) {
|
||||
super(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JRDataSource create(JasperReport jasperReport) throws JRException {
|
||||
return new JRBeanCollectionDataSource(getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(JRDataSource jrDataSource) throws JRException {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class ConfigurableJasperReportsViewWithStreamTests extends AbstractConfigurableJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
ConfigurableJasperReportsView view = new ConfigurableJasperReportsView();
|
||||
view.setExporterClass(net.sf.jasperreports.engine.export.JRHtmlExporter.class);
|
||||
view.setUseWriter(true);
|
||||
view.setContentType("application/pdf");
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "application/pdf";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import net.sf.jasperreports.engine.export.JRPdfExporter;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class ConfigurableJasperReportsViewWithWriterTests extends AbstractConfigurableJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
ConfigurableJasperReportsView view = new ConfigurableJasperReportsView();
|
||||
view.setExporterClass(JRPdfExporter.class);
|
||||
view.setUseWriter(false);
|
||||
view.setContentType("text/html");
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "text/html";
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.jasperreports.engine.JasperPrint;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.mock.web.test.MockServletContext;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ExporterParameterTests extends AbstractJasperReportsTests {
|
||||
|
||||
@Test
|
||||
public void parameterParsing() throws Exception {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI", "/foo/bar");
|
||||
|
||||
AbstractJasperReportsView view = new AbstractJasperReportsView() {
|
||||
|
||||
@Override
|
||||
protected void renderReport(JasperPrint filledReport, Map<String, Object> model, HttpServletResponse response)
|
||||
throws Exception {
|
||||
|
||||
assertEquals("Invalid number of exporter parameters", 1, getConvertedExporterParameters().size());
|
||||
|
||||
net.sf.jasperreports.engine.JRExporterParameter key = net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI;
|
||||
Object value = getConvertedExporterParameters().get(key);
|
||||
|
||||
assertNotNull("Value not mapped to correct key", value);
|
||||
assertEquals("Incorrect value for parameter", "/foo/bar", value);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
view.setExporterParameters(params);
|
||||
setViewProperties(view);
|
||||
view.render(getModel(), request, response);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void invalidClass() throws Exception {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("foo.net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI", "/foo");
|
||||
|
||||
AbstractJasperReportsView view = new JasperReportsHtmlView();
|
||||
setViewProperties(view);
|
||||
|
||||
view.setExporterParameters(params);
|
||||
view.convertExporterParameters();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void invalidField() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI_FOO", "/foo");
|
||||
|
||||
AbstractJasperReportsView view = new JasperReportsHtmlView();
|
||||
setViewProperties(view);
|
||||
|
||||
view.setExporterParameters(params);
|
||||
view.convertExporterParameters();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void invalidType() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("java.lang.Boolean.TRUE", "/foo");
|
||||
|
||||
AbstractJasperReportsView view = new JasperReportsHtmlView();
|
||||
setViewProperties(view);
|
||||
|
||||
view.setExporterParameters(params);
|
||||
view.convertExporterParameters();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void typeConversion() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN", "true");
|
||||
|
||||
AbstractJasperReportsView view = new JasperReportsHtmlView();
|
||||
setViewProperties(view);
|
||||
|
||||
view.setExporterParameters(params);
|
||||
view.convertExporterParameters();
|
||||
Object value = view.getConvertedExporterParameters().get(
|
||||
net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN);
|
||||
assertEquals(Boolean.TRUE, value);
|
||||
}
|
||||
|
||||
private void setViewProperties(AbstractJasperReportsView view) {
|
||||
view.setUrl("/org/springframework/ui/jasperreports/DataSourceReport.jasper");
|
||||
StaticWebApplicationContext ac = new StaticWebApplicationContext();
|
||||
ac.setServletContext(new MockServletContext());
|
||||
ac.addMessage("page", Locale.GERMAN, "MeineSeite");
|
||||
ac.refresh();
|
||||
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
|
||||
view.setApplicationContext(ac);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class JasperReportViewResolverTests {
|
||||
|
||||
@Test
|
||||
public void resolveView() throws Exception {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
|
||||
String prefix = "org/springframework/ui/jasperreports/";
|
||||
String suffix = ".jasper";
|
||||
String viewName = "DataSourceReport";
|
||||
|
||||
JasperReportsViewResolver viewResolver = new JasperReportsViewResolver();
|
||||
viewResolver.setViewClass(JasperReportsHtmlView.class);
|
||||
viewResolver.setPrefix(prefix);
|
||||
viewResolver.setSuffix(suffix);
|
||||
viewResolver.setApplicationContext(ctx);
|
||||
|
||||
AbstractJasperReportsView view = (AbstractJasperReportsView) viewResolver.resolveViewName(viewName,
|
||||
Locale.ENGLISH);
|
||||
assertNotNull("View should not be null", view);
|
||||
assertEquals("Incorrect URL", prefix + viewName + suffix, view.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withViewNamesAndEndsWithPattern() throws Exception {
|
||||
doViewNamesTest("DataSource*");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withViewNamesAndStartsWithPattern() throws Exception {
|
||||
doViewNamesTest("*Report");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withViewNamesAndStatic() throws Exception {
|
||||
doViewNamesTest("DataSourceReport");
|
||||
}
|
||||
|
||||
private void doViewNamesTest(String... viewNames) throws Exception {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
|
||||
String prefix = "org/springframework/ui/jasperreports/";
|
||||
String suffix = ".jasper";
|
||||
String viewName = "DataSourceReport";
|
||||
|
||||
JasperReportsViewResolver viewResolver = new JasperReportsViewResolver();
|
||||
viewResolver.setViewClass(JasperReportsHtmlView.class);
|
||||
viewResolver.setPrefix(prefix);
|
||||
viewResolver.setSuffix(suffix);
|
||||
viewResolver.setViewNames(viewNames);
|
||||
viewResolver.setApplicationContext(ctx);
|
||||
|
||||
AbstractJasperReportsView view = (AbstractJasperReportsView) viewResolver.resolveViewName(viewName,
|
||||
Locale.ENGLISH);
|
||||
assertNotNull("View should not be null", view);
|
||||
assertEquals("Incorrect URL", prefix + viewName + suffix, view.getUrl());
|
||||
assertNull(viewResolver.resolveViewName("foo", Locale.ENGLISH));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class JasperReportsCsvViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsCsvView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "text/csv";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReader;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mock.web.test.MockServletContext;
|
||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class JasperReportsHtmlViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsHtmlView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "text/html";
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void configureExporterParametersWithEncodingFromPropertiesFile() throws Exception {
|
||||
GenericWebApplicationContext ac = new GenericWebApplicationContext();
|
||||
ac.setServletContext(new MockServletContext());
|
||||
BeanDefinitionReader reader = new PropertiesBeanDefinitionReader(ac);
|
||||
reader.loadBeanDefinitions(new ClassPathResource("view.properties", getClass()));
|
||||
ac.refresh();
|
||||
|
||||
AbstractJasperReportsView view = (AbstractJasperReportsView) ac.getBean("report");
|
||||
String encoding = (String) view.getConvertedExporterParameters().get(
|
||||
net.sf.jasperreports.engine.export.JRHtmlExporterParameter.CHARACTER_ENCODING);
|
||||
assertEquals("UTF-8", encoding);
|
||||
|
||||
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
|
||||
view.render(getModel(), request, response);
|
||||
assertEquals("Response content type is incorrect", "text/html;charset=UTF-8", response.getContentType());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.jasperreports.engine.JasperPrint;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class JasperReportsMultiFormatViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected void extendModel(Map<String, Object> model) {
|
||||
model.put(getDiscriminatorKey(), "csv");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleHtmlRender() throws Exception {
|
||||
Assume.group(TestGroup.CUSTOM_COMPILATION);
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
|
||||
Map<String, Object> model = getBaseModel();
|
||||
model.put(getDiscriminatorKey(), "html");
|
||||
|
||||
view.render(model, request, response);
|
||||
|
||||
assertEquals("Invalid content type", "text/html", response.getContentType());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void overrideContentDisposition() throws Exception {
|
||||
Assume.group(TestGroup.CUSTOM_COMPILATION);
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
AbstractJasperReportsView view = getView(UNCOMPILED_REPORT);
|
||||
|
||||
Map<String, Object> model = getBaseModel();
|
||||
model.put(getDiscriminatorKey(), "csv");
|
||||
|
||||
String headerValue = "inline; filename=foo.txt";
|
||||
|
||||
Properties mappings = new Properties();
|
||||
mappings.put("csv", headerValue);
|
||||
|
||||
((JasperReportsMultiFormatView) view).setContentDispositionMappings(mappings);
|
||||
|
||||
view.render(model, request, response);
|
||||
|
||||
assertEquals("Invalid Content-Disposition header value", headerValue,
|
||||
response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exporterParametersAreCarriedAcross() throws Exception {
|
||||
Assume.group(TestGroup.CUSTOM_COMPILATION);
|
||||
assumeTrue(canCompileReport);
|
||||
|
||||
JasperReportsMultiFormatView view = (JasperReportsMultiFormatView) getView(UNCOMPILED_REPORT);
|
||||
|
||||
Map<String, Class<? extends AbstractJasperReportsView>> mappings =
|
||||
new HashMap<>();
|
||||
mappings.put("test", ExporterParameterTestView.class);
|
||||
|
||||
Map<String, String> exporterParameters = new HashMap<>();
|
||||
|
||||
// test view class performs the assertions - robh
|
||||
exporterParameters.put(ExporterParameterTestView.TEST_PARAM, "foo");
|
||||
|
||||
view.setExporterParameters(exporterParameters);
|
||||
view.setFormatMappings(mappings);
|
||||
view.initApplicationContext();
|
||||
|
||||
Map<String, Object> model = getBaseModel();
|
||||
model.put(getDiscriminatorKey(), "test");
|
||||
|
||||
view.render(model, request, response);
|
||||
}
|
||||
|
||||
protected String getDiscriminatorKey() {
|
||||
return "format";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsMultiFormatView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "text/csv";
|
||||
}
|
||||
|
||||
private Map<String, Object> getBaseModel() {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("ReportTitle", "Foo");
|
||||
model.put("dataSource", getData());
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
public static class ExporterParameterTestView extends AbstractJasperReportsView {
|
||||
|
||||
public static final String TEST_PARAM = "net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI";
|
||||
|
||||
@Override
|
||||
protected void renderReport(JasperPrint filledReport, Map<String, Object> parameters, HttpServletResponse response) {
|
||||
assertNotNull("Exporter parameters are null", getExporterParameters());
|
||||
assertEquals("Incorrect number of exporter parameters", 1, getExporterParameters().size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class JasperReportsMultiFormatViewWithCustomMappingsTests extends JasperReportsMultiFormatViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
JasperReportsMultiFormatView view = new JasperReportsMultiFormatView();
|
||||
view.setFormatKey("fmt");
|
||||
Map<String, Class<? extends AbstractJasperReportsView>> mappings =
|
||||
new HashMap<>();
|
||||
mappings.put("csv", JasperReportsCsvView.class);
|
||||
mappings.put("comma-separated", JasperReportsCsvView.class);
|
||||
mappings.put("html", JasperReportsHtmlView.class);
|
||||
view.setFormatMappings(mappings);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDiscriminatorKey() {
|
||||
return "fmt";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void extendModel(Map<String, Object> model) {
|
||||
model.put(getDiscriminatorKey(), "comma-separated");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class JasperReportsPdfViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsPdfView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "application/pdf";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class JasperReportsXlsViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsXlsView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "application/vnd.ms-excel";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.view.jasperreports;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.2
|
||||
*/
|
||||
public class JasperReportsXlsxViewTests extends AbstractJasperReportsViewTests {
|
||||
|
||||
@Override
|
||||
protected AbstractJasperReportsView getViewImplementation() {
|
||||
return new JasperReportsXlsxView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDesiredContentType() {
|
||||
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
net.sf.jasperreports.awt.ignore.missing.font=true
|
||||
Binary file not shown.
@@ -1,185 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->
|
||||
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
|
||||
|
||||
<jasperReport name="DataSourceReport" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
|
||||
<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<parameter name="ReportTitle" class="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="DataFile" class="java.lang.String">
|
||||
</parameter>
|
||||
<field name="id" class="java.lang.Integer">
|
||||
</field>
|
||||
<field name="name" class="java.lang.String">
|
||||
</field>
|
||||
<field name="street" class="java.lang.String">
|
||||
</field>
|
||||
<field name="city" class="java.lang.String">
|
||||
</field>
|
||||
<variable name="CityNumber" class="java.lang.Integer" resetType="Group" resetGroup="CityGroup" calculation="System">
|
||||
<initialValueExpression><![CDATA[($V{CityNumber} != null)?(new Integer($V{CityNumber}.intValue() + 1)):(new Integer(1))]]></initialValueExpression>
|
||||
</variable>
|
||||
<group name="CityGroup" minHeightToStartNewPage="60">
|
||||
<groupExpression><![CDATA[$F{city}]]></groupExpression>
|
||||
<groupHeader>
|
||||
<band height="20">
|
||||
<rectangle>
|
||||
<reportElement x="0" y="4" width="515" height="15" forecolor="#c0c0c0" backcolor="#c0c0c0"/>
|
||||
<graphicElement/>
|
||||
</rectangle>
|
||||
<textField>
|
||||
<reportElement mode="Opaque" x="0" y="4" width="515" height="15" backcolor="#c0c0c0"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{CityNumber}) + ". " + String.valueOf($F{city})]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement x="0" y="19" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
</band>
|
||||
</groupHeader>
|
||||
<groupFooter>
|
||||
<band height="20">
|
||||
<line>
|
||||
<reportElement x="0" y="-1" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<staticText>
|
||||
<reportElement x="400" y="1" width="60" height="15"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Count :]]></text>
|
||||
</staticText>
|
||||
<textField>
|
||||
<reportElement x="460" y="1" width="30" height="15"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{CityGroup_COUNT}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</groupFooter>
|
||||
</group>
|
||||
<title>
|
||||
<band height="70">
|
||||
<line>
|
||||
<reportElement x="0" y="0" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="0" y="10" width="515" height="30"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Normal" size="22"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{ReportTitle}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="0" y="40" width="515" height="20"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Normal" size="14"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$P{DataFile}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</title>
|
||||
<pageHeader>
|
||||
<band height="20">
|
||||
<rectangle>
|
||||
<reportElement x="0" y="5" width="515" height="15" forecolor="#333333" backcolor="#333333"/>
|
||||
<graphicElement/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="0" y="5" width="55" height="15" forecolor="#ffffff" backcolor="#333333"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[ID]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="55" y="5" width="205" height="15" forecolor="#ffffff" backcolor="#333333"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Name]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="260" y="5" width="255" height="15" forecolor="#ffffff" backcolor="#333333"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Street]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</pageHeader>
|
||||
<detail>
|
||||
<band height="20">
|
||||
<textField>
|
||||
<reportElement x="0" y="4" width="50" height="15"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{id}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true">
|
||||
<reportElement positionType="Float" x="55" y="4" width="200" height="15"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true">
|
||||
<reportElement positionType="Float" x="260" y="4" width="255" height="15"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{street}]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement positionType="Float" x="0" y="19" width="515" height="1" forecolor="#808080"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
</band>
|
||||
</detail>
|
||||
<pageFooter>
|
||||
<band height="40">
|
||||
<line>
|
||||
<reportElement x="0" y="10" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<textField>
|
||||
<reportElement x="200" y="20" width="80" height="15"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$R{page} + " " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField evaluationTime="Report">
|
||||
<reportElement x="280" y="20" width="75" height="15"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</pageFooter>
|
||||
<lastPageFooter>
|
||||
<band height="60">
|
||||
<textField>
|
||||
<reportElement x="0" y="10" width="515" height="15"/>
|
||||
<textElement textAlignment="Center"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["There were " +
|
||||
String.valueOf($V{REPORT_COUNT}) +
|
||||
" address records on this report."]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement x="0" y="30" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<textField>
|
||||
<reportElement x="200" y="40" width="80" height="15"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$R{page} + " " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField evaluationTime="Report">
|
||||
<reportElement x="280" y="40" width="75" height="15"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</lastPageFooter>
|
||||
</jasperReport>
|
||||
@@ -1 +0,0 @@
|
||||
page=MeineSeite
|
||||
Binary file not shown.
@@ -1,227 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->
|
||||
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
|
||||
|
||||
<jasperReport name="ProductReport" columnCount="2" pageWidth="325" pageHeight="842" columnWidth="160" columnSpacing="5" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
|
||||
<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="8" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<parameter name="City" class="java.lang.String"/>
|
||||
<field name="id" class="java.lang.Integer">
|
||||
</field>
|
||||
<field name="name" class="java.lang.String">
|
||||
</field>
|
||||
<field name="quantity" class="java.lang.Float">
|
||||
</field>
|
||||
<field name="price" class="java.lang.Float">
|
||||
</field>
|
||||
<variable name="QuantityProductSum" class="java.lang.Float" resetType="Group" resetGroup="ProductGroup" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{quantity}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="PriceProductSum" class="java.lang.Float" resetType="Group" resetGroup="ProductGroup" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{price}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="QuantitySum" class="java.lang.Float" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{quantity}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="PriceSum" class="java.lang.Float" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{price}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="ProductCount" class="java.lang.Integer" resetType="Group" resetGroup="ProductGroup" calculation="System">
|
||||
<initialValueExpression><![CDATA[($V{ProductCount} != null)?(new Integer($V{ProductCount}.intValue() + 1)):(new Integer(1))]]></initialValueExpression>
|
||||
</variable>
|
||||
<group name="ProductGroup">
|
||||
<groupExpression><![CDATA[$F{id}]]></groupExpression>
|
||||
<groupHeader>
|
||||
<band height="14">
|
||||
<textField>
|
||||
<reportElement x="0" y="2" width="15" height="10"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{id}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true">
|
||||
<reportElement positionType="Float" x="20" y="2" width="80" height="10"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" evaluationTime="Group" evaluationGroup="ProductGroup" pattern="#0">
|
||||
<reportElement positionType="Float" x="105" y="2" width="20" height="10"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.Float"><![CDATA[$V{QuantityProductSum}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" evaluationTime="Group" evaluationGroup="ProductGroup" pattern="#0.00">
|
||||
<reportElement positionType="Float" x="130" y="2" width="30" height="10"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.Float"><![CDATA[$V{PriceProductSum}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</groupHeader>
|
||||
<groupFooter>
|
||||
<band>
|
||||
</band>
|
||||
</groupFooter>
|
||||
</group>
|
||||
<title>
|
||||
<band height="14">
|
||||
<staticText>
|
||||
<reportElement x="0" y="2" width="60" height="10"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Title]]></text>
|
||||
</staticText>
|
||||
<textField>
|
||||
<reportElement x="0" y="2" width="325" height="10"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["Products ordered by people in " + $P{City}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</title>
|
||||
<pageHeader>
|
||||
<band height="14">
|
||||
<rectangle>
|
||||
<reportElement mode="Transparent" x="0" y="2" width="325" height="10" forecolor="#808000"/>
|
||||
<graphicElement pen="Thin"/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement x="0" y="2" width="60" height="10" forecolor="#808000"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Page Header]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</pageHeader>
|
||||
<columnHeader>
|
||||
<band height="14">
|
||||
<rectangle>
|
||||
<reportElement x="0" y="2" width="160" height="10" forecolor="#ffff99" backcolor="#ffff99"/>
|
||||
<graphicElement/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="0" y="2" width="20" height="10" backcolor="#ffff99"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[ID]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="20" y="2" width="85" height="10" backcolor="#ffff99"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Name]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="105" y="2" width="20" height="10" backcolor="#ffff99"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Qty]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="125" y="2" width="35" height="10" backcolor="#ffff99"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Price]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</columnHeader>
|
||||
<columnFooter>
|
||||
<band height="14">
|
||||
<line>
|
||||
<reportElement x="0" y="1" width="160" height="1"/>
|
||||
<graphicElement pen="Thin"/>
|
||||
</line>
|
||||
<staticText>
|
||||
<reportElement x="0" y="2" width="60" height="10"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Column Footer]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="70" y="2" width="30" height="10"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Total :]]></text>
|
||||
</staticText>
|
||||
<textField pattern="#0">
|
||||
<reportElement x="105" y="2" width="20" height="10"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.Float"><![CDATA[$V{QuantitySum}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#0.00">
|
||||
<reportElement x="130" y="2" width="30" height="10"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.Float"><![CDATA[$V{PriceSum}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</columnFooter>
|
||||
<pageFooter>
|
||||
<band height="14">
|
||||
<rectangle>
|
||||
<reportElement mode="Transparent" x="0" y="2" width="325" height="10" forecolor="#808000"/>
|
||||
<graphicElement pen="Thin"/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement x="0" y="2" width="60" height="10" forecolor="#808000"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Page Footer]]></text>
|
||||
</staticText>
|
||||
<textField>
|
||||
<reportElement x="150" y="2" width="100" height="10" forecolor="#808000"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of "]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField evaluationTime="Report">
|
||||
<reportElement x="250" y="2" width="50" height="10" forecolor="#808000"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</pageFooter>
|
||||
<summary>
|
||||
<band height="14">
|
||||
<rectangle>
|
||||
<reportElement x="0" y="2" width="325" height="10" forecolor="#808000" backcolor="#808000"/>
|
||||
<graphicElement pen="Thin"/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="0" y="2" width="230" height="10" backcolor="#808000"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Italic"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Summary]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="230" y="2" width="55" height="10" backcolor="#808000"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Count :]]></text>
|
||||
</staticText>
|
||||
<textField pattern="#0">
|
||||
<reportElement mode="Opaque" x="285" y="2" width="40" height="10" backcolor="#808000"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ProductCount}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</summary>
|
||||
</jasperReport>
|
||||
Binary file not shown.
@@ -1,103 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->
|
||||
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
|
||||
|
||||
<jasperReport name="MasterReport" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
|
||||
<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
|
||||
<parameter name="ProductsSubReport" class="net.sf.jasperreports.engine.JasperReport"/>
|
||||
<parameter name="SubReportData" class="net.sf.jasperreports.engine.JRDataSource"/>
|
||||
<field name="city" class="java.lang.String">
|
||||
</field>
|
||||
<title>
|
||||
<band height="50">
|
||||
<line>
|
||||
<reportElement x="0" y="0" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<staticText>
|
||||
<reportElement x="0" y="10" width="515" height="30"/>
|
||||
<textElement textAlignment="Center">
|
||||
<font reportFont="Arial_Normal" size="22"/>
|
||||
</textElement>
|
||||
<text><![CDATA[Master Report]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</title>
|
||||
<pageHeader>
|
||||
<band height="21">
|
||||
<rectangle>
|
||||
<reportElement x="0" y="5" width="515" height="15" backcolor="#333333"/>
|
||||
<graphicElement pen="None"/>
|
||||
</rectangle>
|
||||
<staticText>
|
||||
<reportElement mode="Opaque" x="0" y="5" width="515" height="15" forecolor="#ffffff" backcolor="#333333"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[City List]]></text>
|
||||
</staticText>
|
||||
<line>
|
||||
<reportElement x="0" y="20" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
</band>
|
||||
</pageHeader>
|
||||
<detail>
|
||||
<band height="50">
|
||||
<textField>
|
||||
<reportElement x="5" y="5" width="100" height="15" isPrintWhenDetailOverflows="true"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{city}]]></textFieldExpression>
|
||||
</textField>
|
||||
<staticText>
|
||||
<reportElement isPrintRepeatedValues="false" x="110" y="5" width="100" height="15" isPrintWhenDetailOverflows="true"/>
|
||||
<textElement>
|
||||
<font reportFont="Arial_Bold"/>
|
||||
</textElement>
|
||||
<text><![CDATA[(continued)]]></text>
|
||||
</staticText>
|
||||
<line>
|
||||
<reportElement x="0" y="20" width="515" height="1" isPrintWhenDetailOverflows="true"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<subreport>
|
||||
<reportElement isPrintRepeatedValues="false" x="5" y="25" width="325" height="20" isRemoveLineWhenBlank="true" backcolor="#ffcc99"/>
|
||||
<subreportParameter name="City">
|
||||
<subreportParameterExpression><![CDATA[$F{city}]]></subreportParameterExpression>
|
||||
</subreportParameter>
|
||||
<dataSourceExpression><![CDATA[$P{SubReportData}]]></dataSourceExpression>
|
||||
<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{ProductsSubReport}]]></subreportExpression>
|
||||
</subreport>
|
||||
<!--<subreport>
|
||||
<reportElement positionType="Float" x="335" y="25" width="175" height="20" isRemoveLineWhenBlank="true" backcolor="#99ccff"/>
|
||||
<subreportParameter name="City">
|
||||
<subreportParameterExpression><![CDATA[$F{City}]]></subreportParameterExpression>
|
||||
</subreportParameter>
|
||||
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
|
||||
<subreportExpression class="java.lang.String"><![CDATA["AddressReport.jasper"]]></subreportExpression>
|
||||
</subreport> -->
|
||||
</band>
|
||||
</detail>
|
||||
<pageFooter>
|
||||
<band height="40">
|
||||
<line>
|
||||
<reportElement x="0" y="10" width="515" height="1"/>
|
||||
<graphicElement/>
|
||||
</line>
|
||||
<textField>
|
||||
<reportElement x="200" y="20" width="80" height="15"/>
|
||||
<textElement textAlignment="Right"/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField evaluationTime="Report">
|
||||
<reportElement x="280" y="20" width="75" height="15"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</pageFooter>
|
||||
</jasperReport>
|
||||
@@ -1,4 +0,0 @@
|
||||
report.(class)=org.springframework.web.servlet.view.jasperreports.JasperReportsHtmlView
|
||||
report.url=/org/springframework/ui/jasperreports/DataSourceReport.jasper
|
||||
report.exporterParameters[net.sf.jasperreports.engine.export.JRHtmlExporterParameter.CHARACTER_ENCODING]=UTF-8
|
||||
report.exporterParameters[net.sf.jasperreports.engine.JRExporterParameter.PAGE_INDEX]=0
|
||||
Reference in New Issue
Block a user