bellakhalAmir / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Example on utilizing xdocreport with spring MVC and GAE #350

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.I am trying to use the xdocreport to generate PDF reports in my spring 
project which is used deployed in GAE. I am not sure where to start or do i 
have to do changes in the source code of xdocreport to make it work with 
spring. 
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by ad...@nexdynamics.com on 11 Jan 2014 at 11:10

GoogleCodeExporter commented 8 years ago
For GAE you need to use teh xdocreport GAE Jars (as you wish to convert to 
PDF). Please read https://code.google.com/p/xdocreport/wiki/XDocReportGAE

For Spring, XDocReport doesn't provide some Spring *FactoryBean, but is it 
interesting? 

Original comment by angelo.z...@gmail.com on 12 Jan 2014 at 10:21

GoogleCodeExporter commented 8 years ago
Hi,
Thanks for your Email. The problem that i have with the current
implementation of controllers and dispatcher is that it dose not follow the
standard spring MVC pattern. Instead of acquiring the parameters from
 HttpRequest, i would like to pass ModelView object. Instead of registering
all the controllers, I prefer to use Autoscan. Is there any documentation
that shows  how your web-based reporting engine works under the hook so I
can make it more compatible with Spring MVC. I appreciate your help.

Original comment by ad...@nexdynamics.com on 19 Jan 2014 at 10:47

GoogleCodeExporter commented 8 years ago
> The problem that i have with the current
> implementation of controllers and dispatcher is that it dose not follow the
> standard spring MVC pattern.
You can use XDocReport without HttpRequest. The web support 
(dispatcher/controller) uses the API like other support. See for instance how 
to use XDocReport with Jav amain at 
https://code.google.com/p/xdocreport/wiki/DocxReportingJavaMain

I don't know Spring MVC, but perhaps it should be interesting to provide it?

> Instead of registering all the controllers, I prefer to use Autoscan.
Ok if I understand, your wish to use the Spring bean capability.

> Is there any documentation
>that shows  how your web-based reporting engine works under the hook so I
>can make it more compatible with Spring MVC. I appreciate your help.
Which doc do you wish? The only doc available for web support is 
https://code.google.com/p/xdocreport/wiki/DocxReportingWEBApplication

Could you explain more what you wish to have as XDocReport support with Spring 
MVC (sample code, etc).

Original comment by angelo.z...@gmail.com on 19 Jan 2014 at 11:49

GoogleCodeExporter commented 8 years ago
Hi,
I  really appreciate your help. You can find an example which users Spring
MVC+ Google Appengine+ Datastore of Appengine below:

http://www.mkyong.com/google-app-engine/google-app-engine-spring-mvc-crud-exampl
e-with-datastore-low-level-api/

If you add the support for Spring framework and also database queries using
JPA for the Appengine, Xdocrport would be a best reporting engine option
available for Google Appengine.

Thanks and regards,

Original comment by ad...@nexdynamics.com on 20 Jan 2014 at 10:17

GoogleCodeExporter commented 8 years ago
Ok, I think the XDocReport support for Spring MVC should do the same thing than 
the JasperReport support for Spring MVC like explained at 
http://docs.spring.io/spring/docs/4.0.1.BUILD-SNAPSHOT/spring-framework-referenc
e/htmlsingle/#view-jasper-reports

I will try to see if it's easy to do teh same thing with XDocReport.

Regards Angelo

Original comment by angelo.z...@gmail.com on 21 Jan 2014 at 1:18

GoogleCodeExporter commented 8 years ago

Original comment by angelo.z...@gmail.com on 21 Jan 2014 at 4:54

GoogleCodeExporter commented 8 years ago
Hi,

I have developped quickly a support for Spring MVC in the project 
https://code.google.com/p/xdocreport/source/browse/#git%2Fthirdparties-extension
%2Forg.springframework.web.servlet.view.xdocreport

You can find a basic webapp with XDocReport & Spring MVC at 
https://code.google.com/p/xdocreport/source/browse?repo=samples#git%2Freporting-
webapp-springmvc

With this support you can write for instance a Spring controller like this : 

-----------------------------------------------
@RequestMapping( "/download/docx" )
public String docxReport( ModelMap model )
{
     Project project = new Project( "XDocReport" );
     model.addAttribute( "project", project );
     return "docxReport";
}
-----------------------------------------------

(see 
https://code.google.com/p/xdocreport/source/browse/reporting-webapp-springmvc/sr
c/main/java/fr/opensagres/xdocreport/samples/reporting/springmvc/controllers/Mai
nController.java?repo=samples)

this method controller call a Spring bean with id "docxReport" that you can 
define like this : 

-----------------------------------------------
<bean id="docxReport"
            class="org.springframework.web.servlet.view.xdocreport.XDocReportView"
                p:url="classpath:DocxProjectWithVelocityList.docx"
                p:templateEngineId="Velocity" />
-----------------------------------------------

(see 
https://code.google.com/p/xdocreport/source/browse/reporting-webapp-springmvc/sr
c/main/webapp/WEB-INF/xdocreport-views.xml?repo=samples)

Hope you will like it. 

It's a first step for this support, so tell me if you wish some improvment.

Regards Angelo

Original comment by angelo.z...@gmail.com on 21 Jan 2014 at 5:04

GoogleCodeExporter commented 8 years ago
Hi,
Well done for the great job, I appreciate that.
However in the sample code i can not resolve the following dependency.
 <!-- XDocSupport for Spring MVC -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.springframework.web.servlet.view.xdocreport</artifactId>
</dependency>

thanks for all your help.

Original comment by ad...@nexdynamics.com on 21 Jan 2014 at 11:24

GoogleCodeExporter commented 8 years ago
Hi,

Build was not done. I have started it and now 
org.springframework.web.servlet.view.xdocreport should be available (see 
http://oss.sonatype.org/content/repositories/snapshots/fr/opensagres/xdocreport/
org.springframework.web.servlet.view.xdocreport/)

Note that :

 * it's 1.0.4-SNAPSHOT (not release). Please read https://code.google.com/p/xdocreport/wiki/Download#Maven_repository_artifacts
to use snapshot version.
 * FieldsMetatada are not managed (you will see problem with loop for table).

Don't hesitate to send me feedback about this Spring MVC view (I didn't know 
Spring MVC).

Original comment by angelo.z...@gmail.com on 22 Jan 2014 at 9:44

GoogleCodeExporter commented 8 years ago
Spring MVC supports now FieldsMetadata. See doc at 
https://code.google.com/p/xdocreport/wiki/XDocReportSpringMVC

Original comment by angelo.z...@gmail.com on 23 Jan 2014 at 9:22

GoogleCodeExporter commented 8 years ago
Hi,
thanks for your Email. I am now using the Snapshot. However, the interface
 "IXDocReportConfiguration" can not yer be found. Here is my Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.opensagres.xdocreport.samples</groupId>
<artifactId>xdocreport-samples</artifactId>
<version>1.0.4-SNAPSHOT</version>
</parent>

<artifactId>reporting-webapp-springmvc</artifactId>

<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.29</version>
</dependency>

<!-- XDocSupport for Spring MVC -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.springframework.web.servlet.view.xdocreport</artifactId>
                        <version>1.0.4-SNAPSHOT</version>
 </dependency>
 <!-- Document ODT -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.odt</artifactId>
</dependency>

<!-- Converter ODT -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter.odt.odfdom</artifactId>
</dependency>

<!-- Document DOCX -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
</dependency>

<!-- Converter DOCX -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter.docx.xwpf</artifactId>
</dependency>

<!-- Velocity Template -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
</dependency>

<dependency>
<!-- under MPL license -->
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
<exclusions>
<exclusion>
<artifactId>bcmail-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
<exclusion>
<artifactId>bcprov-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
<exclusion>
<artifactId>bctsp-jdk14</artifactId>
<groupId>org.bouncycastle</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- Spring MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.6.RELEASE</version>
</dependency>

<!-- test dependencies (for EmbeddedServer) -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-embedded</artifactId>
<version>6.1.26</version>
<scope>test</scope>
</dependency>

    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jsp-2.1-glassfish</artifactId>
      <version>2.1.v20091210</version>
      <scope>test</scope>
    </dependency>

</dependencies>

<repositories>
                <repository>
                        <id>sonatype</id>
                        <snapshots>
                                <enabled>true</enabled>
                        </snapshots>
                        <url>
http://oss.sonatype.org/content/repositories/snapshots/</url>
                </repository>
        </repositories>
</project>

Original comment by ad...@nexdynamics.com on 23 Jan 2014 at 10:47

GoogleCodeExporter commented 8 years ago
Try to redresh your maven dependencies. If you see 
http://oss.sonatype.org/content/repositories/snapshots/fr/opensagres/xdocreport/
org.springframework.web.servlet.view.xdocreport/1.0.4-SNAPSHOT/ you will see 
that the last JAR contains this interface.

Original comment by angelo.z...@gmail.com on 24 Jan 2014 at 8:07

GoogleCodeExporter commented 8 years ago
Greetings,
I appreciate your help in making the Xdocreport compatible with Spring. I
have been trying to deploy the Spring sample on GAE, but so far had no
success. Would you please kindly do me a favor and create another sample of
Spring report which can be hosted in Google Appengine.
Sincerely yours,
Amir Vahid

Original comment by ad...@nexdynamics.com on 2 Feb 2014 at 10:54

GoogleCodeExporter commented 8 years ago
Pascal have the intentation to do that, but I don't know when he will have time 
to do it.

I suggest you to start with 
https://code.google.com/p/xdocreport/source/browse/reporting-webapp-gae?repo=sam
ples (which is GAE without Spring) and update it with 
https://code.google.com/p/xdocreport/source/browse/?repo=samples#git%2Freporting
-webapp-springmvc to have the Spring capability.

Original comment by angelo.z...@gmail.com on 3 Feb 2014 at 8:26

GoogleCodeExporter commented 8 years ago
Greetings,
Thanks for your Email and the consideration of my request. And a big thank
to Pascal. Please let me know about any update.
Keep up the great work,

Original comment by ad...@nexdynamics.com on 5 Feb 2014 at 12:14

GoogleCodeExporter commented 8 years ago
Here we go !

Demo app URL is here :
http://1.reporting-webapp-springmvc-gae.appspot.com/

source code example available here :
https://code.google.com/p/xdocreport/source/browse?repo=samples#git%2Freporting-
webapp-springmvc-gae

Have fun !

Original comment by angelo.z...@gmail.com on 5 Feb 2014 at 11:06

GoogleCodeExporter commented 8 years ago
Wow, very impressive! 

Many thank's Pascal!

Original comment by angelo.z...@gmail.com on 5 Feb 2014 at 11:07

GoogleCodeExporter commented 8 years ago
Great work,
Well done!!
Thanks guys.

Original comment by ad...@nexdynamics.com on 5 Feb 2014 at 11:17

GoogleCodeExporter commented 8 years ago
Ok I close this issue. Spring MVC support will be available for 1.0.4.

Original comment by angelo.z...@gmail.com on 17 Feb 2014 at 8:40