=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCacheImpl.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCacheImpl.java 2011-12-07 13:44:45 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCacheImpl.java 2011-12-13 14:16:32 +0000 @@ -1,20 +1,5 @@ package org.hisp.dhis.api.view; - -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.xml.transform.ErrorListener; -import javax.xml.transform.Source; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamSource; -import org.amplecode.staxwax.transformer.LoggingErrorListener; -import org.springframework.core.io.ClassPathResource; -import org.springframework.stereotype.Component; - /* * Copyright (c) 2004-2005, University of Oslo * All rights reserved. @@ -42,60 +27,75 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; +import org.amplecode.staxwax.transformer.LoggingErrorListener; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Component; + /** - * + * * @author bobj * @version created 02-Dec-2011 */ @Component -public class TransformCacheImpl implements TransformCache +public class TransformCacheImpl + implements TransformCache { - static final String MODEL2HTML = "model2html.xsl"; + static final String MODEL2HTML = "model2html.xsl"; - static final String MODEL2FOP = "model2fop.xsl"; + static final String MODEL2FOP = "model2fop.xsl"; static final String HTMLXSLT_RESOURCE = "/templates/html/"; static final String FOPXSLT_RESOURCE = "/templates/pdf/"; - + static private TransformCache instance; - + private Templates htmlCachedTransform; private Templates fopCachedTransform; - - private TransformCacheImpl() throws IOException, TransformerConfigurationException + + private TransformCacheImpl() + throws IOException, TransformerConfigurationException { ErrorListener errorListener = new LoggingErrorListener(); - + TransformerFactory factory = TransformerFactory.newInstance(); factory.setErrorListener( errorListener ); - Source model2html = - new StreamSource(new ClassPathResource( HTMLXSLT_RESOURCE + MODEL2HTML ).getInputStream()); - Source model2fop = - new StreamSource(new ClassPathResource( FOPXSLT_RESOURCE + MODEL2FOP ).getInputStream()); + Source model2html = new StreamSource( new ClassPathResource( HTMLXSLT_RESOURCE + MODEL2HTML ).getInputStream() ); + Source model2fop = new StreamSource( new ClassPathResource( FOPXSLT_RESOURCE + MODEL2FOP ).getInputStream() ); - factory.setURIResolver( new ClassPathUriResolver(HTMLXSLT_RESOURCE)); + factory.setURIResolver( new ClassPathUriResolver( HTMLXSLT_RESOURCE ) ); htmlCachedTransform = factory.newTemplates( model2html ); - factory.setURIResolver( new ClassPathUriResolver(FOPXSLT_RESOURCE)); - fopCachedTransform = factory.newTemplates( model2fop ); + factory.setURIResolver( new ClassPathUriResolver( FOPXSLT_RESOURCE ) ); + fopCachedTransform = factory.newTemplates( model2fop ); } - - static TransformCache instance() { - if (instance == null) { + + protected static TransformCache instance() + { + if ( instance == null ) + { try { instance = new TransformCacheImpl(); - } catch ( Exception ex ) + } + catch ( Exception ex ) { Logger.getLogger( TransformCacheImpl.class.getName() ).log( Level.SEVERE, null, ex ); } } return instance; } - - @Override public Transformer getHtmlTransformer() @@ -110,5 +110,4 @@ { return fopCachedTransform.newTransformer(); } - } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java 2011-12-13 14:04:12 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java 2011-12-13 14:16:32 +0000 @@ -53,6 +53,7 @@ } @Override + @SuppressWarnings("unchecked") protected void renderMergedOutputModel( Map model, HttpServletRequest request, HttpServletResponse response ) throws Exception { @@ -76,6 +77,7 @@ // pass on any parameters set in xslt-params Map params = (Map) model.get( "xslt-params" ); + if ( params != null ) { for ( Map.Entry entry : params.entrySet() ) === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java 2011-12-07 08:41:05 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java 2011-12-13 14:16:32 +0000 @@ -27,6 +27,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.api.adapter.MediaTypeCollectionJsonSerializer; @@ -38,11 +49,6 @@ import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMethod; -import javax.xml.bind.annotation.*; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.ArrayList; -import java.util.List; - /** * At some point this class will be extended to show all available options * for a current user for this resource. For now it is only used for index page. @@ -55,7 +61,7 @@ { private String name; - private Class clazz; + private Class clazz; private List methods = new ArrayList(); @@ -66,7 +72,7 @@ } - public Resource( String name, Class clazz, List methods, List mediaTypes ) + public Resource( String name, Class clazz, List methods, List mediaTypes ) { this.name = name; this.clazz = clazz; @@ -114,12 +120,12 @@ this.mediaTypes = mediaTypes; } - public Class getClazz() + public Class getClazz() { return clazz; } - public void setClazz( Class clazz ) + public void setClazz( Class clazz ) { this.clazz = clazz; } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl 2011-12-09 18:08:05 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl 2011-12-13 14:16:32 +0000 @@ -11,7 +11,7 @@ d:categoryOptions|d:categoryOptionCombos|d:dataElements|d:indicators| d:organisationUnits|d:dataElementGroups|d:dataElementGroupSets| d:indicatorGroups|d:indicatorGroupSets|d:organisationUnitGroups| - d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes"> + d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes|d:reports">

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl 2011-12-09 18:08:05 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl 2011-12-13 14:16:32 +0000 @@ -35,6 +35,7 @@ + === added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl 2011-12-13 14:16:32 +0000 @@ -0,0 +1,25 @@ + + + + +
+

+ +

+
+ + + + + + + + +
ID
Last Updated
+ + + +