Removing JasperReports related actions from showcase.

Showcase should now be cleaned up from LGPL deps.

git-svn-id: https://svn.apache.org/repos/asf/struts/action2/trunk@408476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Hermanns
2006-05-21 20:01:00 +00:00
parent 3135c71d71
commit 5629249595
7 changed files with 0 additions and 177 deletions
@@ -1,76 +0,0 @@
/*
* $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
* 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.apache.struts.action2.showcase.jasper;
import java.util.Set;
import java.io.File;
import net.sf.jasperreports.engine.JasperCompileManager;
import com.opensymphony.xwork.ActionSupport;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.showcase.person.PersonManager;
/**
*/
public class JasperAction extends ActionSupport {
private static final long serialVersionUID = 6320765173392624324L;
private PersonManager personManager;
public void setPersonManager(PersonManager personManager) {
this.personManager = personManager;
}
/*
* (non-Javadoc)
*
* @see com.opensymphony.xwork.ActionSupport#execute()
*/
public String execute() throws Exception {
/*
* Here we compile our xml jasper template to a jasper file.
* Note: this isn't exactly considered 'good practice'.
* You should either use precompiled jasper files (.jasper) or provide some kind of check
* to make sure you're not compiling the file on every request.
* If you don't have to compile the report, you just setup your data source (eg. a List), and skip this
*/
try {
String reportSource = ServletActionContext.getServletContext().getRealPath("/jasper/sample_report.jrxml");
File parent = new File(reportSource).getParentFile();
JasperCompileManager.compileReportToFile(
reportSource,
new File(parent, "sample_report.jasper").getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
//if all goes well ..
return SUCCESS;
}
/**
* @return Returns the people.
*/
public Set getPeople() {
return personManager.getPeople();
}
}
@@ -11,16 +11,6 @@
<result type="freemarker">listPeople.ftl</result>
</action>
<!-- our JasperReports example -->
<action name="jasperList" class="org.apache.struts.action2.showcase.jasper.JasperAction">
<result name="success" type="jasper">
<param name="location">/jasper/sample_report.jasper</param>
<param name="dataSource">people</param>
<param name="documentName">peoplereport</param>
</result>
</action>
<action name="newPerson" class="org.apache.struts.action2.showcase.person.CreatePerson">
<result type="redirect">listPeople.action</result>
<result name="input" type="freemarker">newPerson.ftl</result>
@@ -1,87 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE jasperReport
PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="sample_report">
<!-- our fields -->
<field name="name" class="java.lang.String"/>
<field name="lastName" class="java.lang.String"/>
<title>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="180" height="15"/>
<textElement/>
<text>
<![CDATA[Webwork JasperReports Sample]]>
</text>
</staticText>
</band>
</title>
<pageHeader>
<band></band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement x="180" y="0" width="180" height="20"/>
<textElement>
<font isUnderline="true"/>
</textElement>
<text>
<![CDATA[NAME]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20"/>
<textElement>
<font isUnderline="true"/>
</textElement>
<text>
<![CDATA[LASTNAME]]>
</text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20">
<textField>
<reportElement x="180" y="0" width="180" height="15"/>
<textElement/>
<textFieldExpression>
<![CDATA[$F{name}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="0" width="180" height="15"/>
<textElement/>
<textFieldExpression>
<![CDATA[$F{lastName}]]>
</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band></band>
</columnFooter>
<pageFooter>
<band height="15">
<staticText>
<reportElement x="0" y="0" width="40" height="15"/>
<textElement/>
<text>
<![CDATA[Page:]]>
</text>
</staticText>
<textField>
<reportElement x="40" y="0" width="100" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.Integer">
<![CDATA[$V{PAGE_NUMBER}]]>
</textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band></band>
</summary>
</jasperReport>
@@ -35,7 +35,6 @@
<ul>
<li><a href="newPerson!input.action">Create</a> a new person</li>
<li><a href="listPeople.action">List</a> all people</li>
<li><a href="jasperList.action">Jasper Report</a> all people as PDF export</li>
</ul>
</body>
@@ -7,7 +7,6 @@
<ul>
<li><a href="newPerson!input.action">Create</a> a new person</li>
<li><a href="listPeople.action">List</a> all people</li>
<li><a href="jasperList.action">Jasper Report</a> all people as PDF export</li>
</ul>
</body>
</html>
@@ -23,7 +23,6 @@ There are ${peopleCount} people...
<ul>
<li><a href="editPerson.action">Edit people</a></li>
<li><a href="newPerson!input.action">Create</a> a new person</li>
<li><a href="jasperList.action">Jasper Report</a> all people as PDF export</li>
</ul>
</body>
</html>
@@ -13,7 +13,6 @@
<ul>
<li><a href="editPerson.action">Edit people</a></li>
<li><a href="listPeople.action">List</a> all people</li>
<li><a href="jasperList.action">Jasper Report</a> all people as PDF export</li>
</ul>
</body>