dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15207
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5400: added reporttable to webapi
------------------------------------------------------------
revno: 5400
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-14 11:03:38 +0100
message:
added reporttable to webapi
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/ReportTableXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTables.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportParams.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/attributeType.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/category.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryCombo.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOption.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOptionCombo.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataElement.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataSet.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicatorType.xsl
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/model2html.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl
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/sqlView.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/user.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRule.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRuleGroup.xsl
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/ReportTableXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/ReportTableXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/ReportTableXmlAdapter.java 2011-12-14 10:03:38 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.common.adapter;
+
+/*
+ * Copyright (c) 2004-2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.reporttable.ReportTable;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ReportTableXmlAdapter extends XmlAdapter<BaseIdentifiableObject, ReportTable>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public ReportTable unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ ReportTable reportTable = new ReportTable();
+
+ reportTable.setUid( identifiableObject.getUid() );
+ reportTable.setLastUpdated( identifiableObject.getLastUpdated() );
+ reportTable.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return reportTable;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( ReportTable reportTable ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( reportTable );
+ }
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java 2011-11-22 16:17:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java 2011-12-14 10:03:38 +0000
@@ -113,6 +113,8 @@
ReportGroup getReportGroup( int id );
+ ReportGroup getReportGroup( String uid );
+
ReportGroup getReportGroupByName( String name );
Collection<ReportGroup> getAllReportGroups();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportParams.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportParams.java 2011-09-14 15:17:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportParams.java 2011-12-14 10:03:38 +0000
@@ -27,6 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.hisp.dhis.common.Dxf2Namespace;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/**
@@ -37,6 +44,8 @@
* @author Lars Helge Overland
* @version $Id$
*/
+@XmlRootElement( name = "reportParams", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
public class ReportParams
implements Serializable
{
@@ -117,6 +126,8 @@
// Getters and setters
// -------------------------------------------------------------------------
+ @XmlElement
+ @JsonProperty
public Boolean getParamReportingMonth()
{
return paramReportingMonth;
@@ -127,6 +138,8 @@
this.paramReportingMonth = paramReportingMonth;
}
+ @XmlElement
+ @JsonProperty
public Boolean getParamLeafParentOrganisationUnit()
{
return paramLeafParentOrganisationUnit;
@@ -137,6 +150,8 @@
this.paramLeafParentOrganisationUnit = paramLeafParentOrganisationUnit;
}
+ @XmlElement
+ @JsonProperty
public Boolean getParamGrandParentOrganisationUnit()
{
return paramGrandParentOrganisationUnit;
@@ -147,6 +162,8 @@
this.paramGrandParentOrganisationUnit = paramGrandParentOrganisationUnit;
}
+ @XmlElement
+ @JsonProperty
public Boolean getParamParentOrganisationUnit()
{
return paramParentOrganisationUnit;
@@ -157,6 +174,8 @@
this.paramParentOrganisationUnit = paramParentOrganisationUnit;
}
+ @XmlElement
+ @JsonProperty
public Boolean getParamOrganisationUnit()
{
return paramOrganisationUnit;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-11-25 11:00:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-12-14 10:03:38 +0000
@@ -28,9 +28,13 @@
*/
import org.apache.commons.lang.StringUtils;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.CombinationGenerator;
+import org.hisp.dhis.common.Dxf2Namespace;
import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.common.adapter.*;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
@@ -44,6 +48,8 @@
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.*;
/**
@@ -54,6 +60,8 @@
* @author Lars Helge Overland
* @version $Id$
*/
+@XmlRootElement( name = "reportTable", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
public class ReportTable extends BaseIdentifiableObject
{
/**
@@ -823,6 +831,8 @@
// Get- and set-methods for persisted properties
// -------------------------------------------------------------------------
+ @XmlElement
+ @JsonProperty
public boolean isRegression()
{
return regression;
@@ -833,6 +843,11 @@
this.regression = regression;
}
+ @XmlElementWrapper( name = "dataElements" )
+ @XmlElement( name = "dataElement" )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElement> getDataElements()
{
return dataElements;
@@ -843,6 +858,11 @@
this.dataElements = dataElements;
}
+ @XmlElementWrapper( name = "categoryOptionCombos" )
+ @XmlElement( name = "categoryOptionCombo" )
+ @XmlJavaTypeAdapter( CategoryOptionComboXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
@@ -853,6 +873,11 @@
this.categoryOptionCombos = categoryOptionCombos;
}
+ @XmlElementWrapper( name = "indicators" )
+ @XmlElement( name = "indicator" )
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<Indicator> getIndicators()
{
return indicators;
@@ -868,6 +893,16 @@
return periods;
}
+ public void setPeriods( List<Period> periods )
+ {
+ this.periods = periods;
+ }
+
+ @XmlElementWrapper( name = "dataSets" )
+ @XmlElement( name = "dataSet" )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataSet> getDataSets()
{
return dataSets;
@@ -878,11 +913,11 @@
this.dataSets = dataSets;
}
- public void setPeriods( List<Period> periods )
- {
- this.periods = periods;
- }
-
+ @XmlElementWrapper( name = "organisationUnits" )
+ @XmlElement( name = "organisationUnit" )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<OrganisationUnit> getUnits()
{
return units;
@@ -893,16 +928,10 @@
this.units = units;
}
- public Set<ReportTableGroup> getGroups()
- {
- return groups;
- }
-
- public void setGroups( Set<ReportTableGroup> groups )
- {
- this.groups = groups;
- }
-
+ @XmlElement
+ @XmlJavaTypeAdapter( CategoryComboXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public DataElementCategoryCombo getCategoryCombo()
{
return categoryCombo;
@@ -913,6 +942,8 @@
this.categoryCombo = categoryCombo;
}
+ @XmlElement
+ @JsonProperty
public boolean isDoIndicators()
{
return doIndicators;
@@ -923,6 +954,8 @@
this.doIndicators = doIndicators;
}
+ @XmlElement
+ @JsonProperty
public boolean isDoPeriods()
{
return doPeriods;
@@ -933,6 +966,8 @@
this.doPeriods = doPeriods;
}
+ @XmlElement
+ @JsonProperty
public boolean isDoUnits()
{
return doUnits;
@@ -953,6 +988,8 @@
this.relatives = relatives;
}
+ @XmlElement
+ @JsonProperty
public ReportParams getReportParams()
{
return reportParams;
@@ -963,6 +1000,8 @@
this.reportParams = reportParams;
}
+ @XmlElement
+ @JsonProperty
public Integer getSortOrder()
{
return sortOrder;
@@ -973,6 +1012,8 @@
this.sortOrder = sortOrder;
}
+ @XmlElement
+ @JsonProperty
public Integer getTopLimit()
{
return topLimit;
@@ -983,6 +1024,16 @@
this.topLimit = topLimit;
}
+ public Set<ReportTableGroup> getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups( Set<ReportTableGroup> groups )
+ {
+ this.groups = groups;
+ }
+
// -------------------------------------------------------------------------
// Get- and set-methods for transient properties
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableGroup.java 2011-11-24 14:36:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableGroup.java 2011-12-14 10:03:38 +0000
@@ -30,12 +30,20 @@
import java.util.HashSet;
import java.util.Set;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.DataElementGroupXmlAdapter;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* @author Dang Duy Hieu
- * @version $Id$
*/
+@XmlRootElement( name = "reportTableGroup", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
public class ReportTableGroup
extends BaseIdentifiableObject
{
@@ -134,6 +142,11 @@
// Getters and setters
// -------------------------------------------------------------------------
+ @XmlElementWrapper( name = "reportTables" )
+ @XmlElement( name = "reportTable" )
+ @XmlJavaTypeAdapter( DataElementGroupXmlAdapter.class )
+ @JsonProperty( value = "reportTables" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<ReportTable> getMembers()
{
return members;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2011-11-22 16:17:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2011-12-14 10:03:38 +0000
@@ -161,6 +161,8 @@
ReportTableGroup getReportTableGroup( int id );
+ ReportTableGroup getReportTableGroup( String uid);
+
ReportTableGroup getReportTableGroupByName( String name );
Collection<ReportTableGroup> getAllReportTableGroups();
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTables.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTables.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTables.java 2011-12-14 10:03:38 +0000
@@ -0,0 +1,67 @@
+package org.hisp.dhis.reporttable;
+
+/*
+ * Copyright (c) 2004-2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.BaseLinkableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.ReportTableXmlAdapter;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlRootElement( name = "reportTables", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
+public class ReportTables extends BaseLinkableObject
+{
+ private List<ReportTable> reportTables = new ArrayList<ReportTable>();
+
+ @XmlElement( name = "reportTable" )
+ @XmlJavaTypeAdapter( ReportTableXmlAdapter.class )
+ @JsonProperty( value = "reportTables" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
+ public List<ReportTable> getReportTables()
+ {
+ return reportTables;
+ }
+
+ public void setReportTables( List<ReportTable> reportTables )
+ {
+ this.reportTables = reportTables;
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2011-11-22 16:17:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2011-12-14 10:03:38 +0000
@@ -27,19 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.OutputStream;
-import java.sql.Connection;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
-
import org.amplecode.quick.StatementManager;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.common.Grid;
@@ -57,6 +48,10 @@
import org.hisp.dhis.system.util.StreamUtils;
import org.springframework.transaction.annotation.Transactional;
+import java.io.OutputStream;
+import java.sql.Connection;
+import java.util.*;
+
/**
* @author Lars Helge Overland
* @version $Id$
@@ -84,14 +79,14 @@
}
private ReportTableService reportTableService;
-
+
public void setReportTableService( ReportTableService reportTableService )
{
this.reportTableService = reportTableService;
}
private ConstantService constantService;
-
+
public void setConstantService( ConstantService constantService )
{
this.constantService = constantService;
@@ -115,57 +110,55 @@
// ReportService implementation
// -------------------------------------------------------------------------
- public void renderReport( OutputStream out, Report report, Date reportingPeriod,
- Integer organisationUnitId, String type, I18nFormat format )
+ public void renderReport( OutputStream out, Report report, Date reportingPeriod,
+ Integer organisationUnitId, String type, I18nFormat format )
{
Map<String, Object> params = new HashMap<String, Object>();
-
+
params.putAll( constantService.getConstantParameterMap() );
-
+
try
{
JasperReport jasperReport = JasperCompileManager.compileReport( StreamUtils.getInputStream( report.getDesignContent() ) );
-
+
JasperPrint print = null;
-
+
if ( report.hasReportTable() ) // Use JR data source
{
ReportTable reportTable = report.getReportTable();
-
+
Grid grid = reportTableService.getReportTableGrid( reportTable.getId(), format, reportingPeriod, organisationUnitId );
-
+
if ( report.isUsingOrganisationUnitGroupSets() )
{
params.putAll( reportTable.getOrganisationUnitGroupMap( organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSets() ) );
}
-
+
print = JasperFillManager.fillReport( jasperReport, params, grid );
}
else // Assume SQL report and provide JDBC connection
{
Connection connection = statementManager.getHolder().getConnection();
-
+
try
{
print = JasperFillManager.fillReport( jasperReport, params, connection );
- }
- finally
- {
+ } finally
+ {
connection.close();
}
}
-
+
if ( print != null )
{
JRExportUtils.export( type, out, print );
}
- }
- catch ( Exception ex )
+ } catch ( Exception ex )
{
throw new RuntimeException( "Failed to render report", ex );
}
}
-
+
public int saveReport( Report report )
{
return reportStore.save( report );
@@ -233,6 +226,11 @@
return reportGroupStore.get( id );
}
+ public ReportGroup getReportGroup( String uid )
+ {
+ return reportGroupStore.getByUid( uid );
+ }
+
public ReportGroup getReportGroupByName( String name )
{
return reportGroupStore.getByName( name );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-12-13 14:04:12 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-12-14 10:03:38 +0000
@@ -177,7 +177,7 @@
}
public Grid getReportTableGrid( int id, I18nFormat format, Date reportingPeriod, Integer organisationUnitId )
- {
+ {
ReportTable reportTable = getReportTable( id );
reportTable = initDynamicMetaObjects( reportTable, reportingPeriod, organisationUnitId, format );
@@ -295,6 +295,11 @@
return reportTableGroupStore.get( id );
}
+ public ReportTableGroup getReportTableGroup( String uid)
+ {
+ return reportTableGroupStore.getByUid( uid );
+ }
+
public ReportTableGroup getReportTableGroupByName( String name )
{
return reportTableGroupStore.getByName( name );
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java 2011-12-14 10:03:38 +0000
@@ -0,0 +1,149 @@
+package org.hisp.dhis.api.controller;
+
+/*
+ * Copyright (c) 2004-2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.api.utils.IdentifiableObjectParams;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.reporttable.ReportTableService;
+import org.hisp.dhis.reporttable.ReportTables;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+@Controller
+@RequestMapping( value = ReportTableController.RESOURCE_PATH )
+public class ReportTableController
+{
+ public static final String RESOURCE_PATH = "/reportTables";
+
+ @Autowired
+ public ReportTableService reportTableService;
+
+ //-------------------------------------------------------------------------------------------------------
+ // GET
+ //-------------------------------------------------------------------------------------------------------
+
+ @RequestMapping( method = RequestMethod.GET )
+ public String getReportTables( IdentifiableObjectParams params, Model model, HttpServletRequest request )
+ {
+ ReportTables reportTables = new ReportTables();
+
+ if ( params.hasNoPaging() )
+ {
+ reportTables.setReportTables( new ArrayList<ReportTable>( reportTableService.getAllReportTables() ) );
+ }
+ else
+ {
+ reportTables.setReportTables( new ArrayList<ReportTable>( reportTableService.getAllReportTables() ) );
+ }
+
+ if ( params.hasLinks() )
+ {
+ WebLinkPopulator listener = new WebLinkPopulator( request );
+ listener.addLinks( reportTables );
+ }
+
+ model.addAttribute( "model", reportTables );
+
+ return "reportTables";
+ }
+
+ @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
+ public String getReportTable( @PathVariable( "uid" ) String uid, IdentifiableObjectParams params, Model model, HttpServletRequest request )
+ {
+ ReportTable reportTable = reportTableService.getReportTable( uid );
+
+ if ( params.hasLinks() )
+ {
+ WebLinkPopulator listener = new WebLinkPopulator( request );
+ listener.addLinks( reportTable );
+ }
+
+ model.addAttribute( "model", reportTable );
+
+ return "reportTable";
+ }
+ //-------------------------------------------------------------------------------------------------------
+ // POST
+ //-------------------------------------------------------------------------------------------------------
+
+ @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/xml, text/xml"} )
+ @ResponseStatus( value = HttpStatus.CREATED )
+ public void postReportTableXML( HttpServletResponse response, InputStream input ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
+ }
+
+ @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
+ @ResponseStatus( value = HttpStatus.CREATED )
+ public void postReportTableJSON( HttpServletResponse response, InputStream input ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // PUT
+ //-------------------------------------------------------------------------------------------------------
+
+ @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/xml, text/xml"} )
+ @ResponseStatus( value = HttpStatus.NO_CONTENT )
+ public void putReportTableXML( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
+ }
+
+ @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/json"} )
+ @ResponseStatus( value = HttpStatus.NO_CONTENT )
+ public void putReportTableJSON( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // DELETE
+ //-------------------------------------------------------------------------------------------------------
+
+ @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
+ @ResponseStatus( value = HttpStatus.NO_CONTENT )
+ public void deleteReportTable( @PathVariable( "uid" ) String uid ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() );
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-13 18:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-14 10:03:38 +0000
@@ -51,6 +51,10 @@
import org.hisp.dhis.organisationunit.*;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.report.Reports;
+import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.reporttable.ReportTableGroup;
+import org.hisp.dhis.reporttable.ReportTableGroups;
+import org.hisp.dhis.reporttable.ReportTables;
import org.hisp.dhis.sqlview.SqlView;
import org.hisp.dhis.sqlview.SqlViews;
import org.hisp.dhis.user.User;
@@ -309,6 +313,73 @@
{
populateUser( (User) source, true );
}
+ else if ( source instanceof ReportTables )
+ {
+ populateReportTables( (ReportTables) source, true );
+ }
+ else if ( source instanceof ReportTable )
+ {
+ populateReportTable( (ReportTable) source, true );
+ }
+ else if ( source instanceof ReportTableGroups )
+ {
+ populateReportTableGroups( (ReportTableGroups) source, true );
+ }
+ else if ( source instanceof ReportTableGroup )
+ {
+ populateReportTableGroup( (ReportTableGroup) source, true );
+ }
+ }
+
+ private void populateReportTables( ReportTables reportTables, boolean root )
+ {
+ reportTables.setLink( getBasePath( reportTables.getClass() ) );
+
+ if ( root )
+ {
+ for ( ReportTable reportTable : reportTables.getReportTables() )
+ {
+ populateReportTable( reportTable, false );
+ }
+ }
+ }
+
+ private void populateReportTable( ReportTable reportTable, boolean root )
+ {
+ populateIdentifiableObject( reportTable );
+
+ if ( root )
+ {
+ handleIdentifiableObjectCollection( reportTable.getPeriods() );
+ handleIdentifiableObjectCollection( reportTable.getCategoryOptionCombos() );
+ handleIdentifiableObjectCollection( reportTable.getDataElements() );
+ handleIdentifiableObjectCollection( reportTable.getIndicators() );
+ handleIdentifiableObjectCollection( reportTable.getGroups() );
+ handleIdentifiableObjectCollection( reportTable.getDataSets() );
+ }
+ }
+
+ private void populateReportTableGroups( ReportTableGroups reportTableGroups, boolean root )
+ {
+ reportTableGroups.setLink( getBasePath( reportTableGroups.getClass() ) );
+
+ if ( root )
+ {
+ for ( ReportTableGroup reportTableGroup : reportTableGroups.getReportTableGroups() )
+ {
+ populateReportTableGroup( reportTableGroup, false );
+ }
+ }
+ }
+
+ private void populateReportTableGroup( ReportTableGroup reportTableGroup, boolean root )
+ {
+ populateIdentifiableObject( reportTableGroup );
+
+ if ( root )
+ {
+ handleIdentifiableObjectCollection( reportTableGroup.getMembers() );
+ }
}
private void populateUsers( Users users, boolean root )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/attributeType.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/attributeType.xsl 2011-12-09 18:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/attributeType.xsl 2011-12-14 10:03:38 +0000
@@ -18,6 +18,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Mandatory</td>
<td> <xsl:value-of select="d:mandatory" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/category.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/category.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/category.xsl 2011-12-14 10:03:38 +0000
@@ -17,6 +17,10 @@
<td>Last Updated</td>
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
</table>
<xsl:apply-templates select="d:categoryOptions" mode="short"/>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryCombo.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryCombo.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryCombo.xsl 2011-12-14 10:03:38 +0000
@@ -17,6 +17,10 @@
<td>Last Updated</td>
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
</table>
<xsl:apply-templates select="d:optionCombos|d:categories" mode="short"/>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOption.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOption.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOption.xsl 2011-12-14 10:03:38 +0000
@@ -17,6 +17,10 @@
<td>Last Updated</td>
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
</table>
<xsl:apply-templates select="d:category|d:categoryOptionCombos" mode="short"/>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOptionCombo.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOptionCombo.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/categoryOptionCombo.xsl 2011-12-14 10:03:38 +0000
@@ -17,6 +17,10 @@
<td>Last Updated</td>
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
</table>
<xsl:apply-templates select="d:categoryCombo|d:categoryOptions" mode="short"/>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl 2011-12-14 10:03:38 +0000
@@ -21,6 +21,10 @@
<td> <xsl:value-of select="@lastUpdated"/> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Dimension</td>
<td> <xsl:value-of select="d:dimension"/> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataElement.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataElement.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataElement.xsl 2011-12-14 10:03:38 +0000
@@ -18,6 +18,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Short Name</td>
<td> <xsl:value-of select="@shortName" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataSet.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataSet.xsl 2011-12-13 17:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/dataSet.xsl 2011-12-14 10:03:38 +0000
@@ -19,6 +19,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Short Name</td>
<td> <xsl:value-of select="d:shortName" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl 2011-12-14 10:03:38 +0000
@@ -12,57 +12,43 @@
<table border="1">
<tr>
<td>ID</td>
- <td>
- <xsl:value-of select="@id" />
- </td>
+ <td> <xsl:value-of select="@id" /> </td>
</tr>
<tr>
<td>Last Updated</td>
- <td>
- <xsl:value-of select="@lastUpdated" />
- </td>
+ <td> <xsl:value-of select="@lastUpdated" /> </td>
+ </tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
</tr>
<tr>
<td>Short Name</td>
- <td>
- <xsl:value-of select="d:shortName" />
- </td>
+ <td> <xsl:value-of select="d:shortName" /> </td>
</tr>
<tr>
<td>Denominator</td>
- <td>
- <xsl:value-of select="d:denominator" />
- </td>
+ <td> <xsl:value-of select="d:denominator" /> </td>
</tr>
<tr>
<td>Denominator Description</td>
- <td>
- <xsl:value-of select="d:denominatorDescription" />
- </td>
+ <td> <xsl:value-of select="d:denominatorDescription" /> </td>
</tr>
<tr>
<td>Numerator</td>
- <td>
- <xsl:value-of select="d:numerator" />
- </td>
+ <td> <xsl:value-of select="d:numerator" /> </td>
</tr>
<tr>
<td>Numerator Description</td>
- <td>
- <xsl:value-of select="d:numeratorDescription" />
- </td>
+ <td> <xsl:value-of select="d:numeratorDescription" /> </td>
</tr>
<tr>
<td>Annualized</td>
- <td>
- <xsl:value-of select="d:annualized" />
- </td>
+ <td> <xsl:value-of select="d:annualized" /> </td>
</tr>
<tr>
<td>Sort Order</td>
- <td>
- <xsl:value-of select="d:sortOrder" />
- </td>
+ <td> <xsl:value-of select="d:sortOrder" /> </td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicatorType.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicatorType.xsl 2011-12-07 14:09:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicatorType.xsl 2011-12-14 10:03:38 +0000
@@ -12,27 +12,23 @@
<table border="1">
<tr>
<td>ID</td>
- <td>
- <xsl:value-of select="@id" />
- </td>
+ <td> <xsl:value-of select="@id" /> </td>
</tr>
<tr>
<td>Last Updated</td>
- <td>
- <xsl:value-of select="@lastUpdated" />
- </td>
+ <td> <xsl:value-of select="@lastUpdated" /> </td>
+ </tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
</tr>
<tr>
<td>Factor</td>
- <td>
- <xsl:value-of select="d:factor" />
- </td>
+ <td> <xsl:value-of select="d:factor" /> </td>
</tr>
<tr>
<td>Number</td>
- <td>
- <xsl:value-of select="d:number" />
- </td>
+ <td> <xsl:value-of select="d:number" /> </td>
</tr>
</table>
=== 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-13 18:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl 2011-12-14 10:03:38 +0000
@@ -12,7 +12,7 @@
d:organisationUnits|d:dataElementGroups|d:dataElementGroupSets|
d:indicatorGroups|d:indicatorGroupSets|d:organisationUnitGroups|
d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes|d:reports|
- d:sqlViews|d:validationRules|d:validationRuleGroups|d:users">
+ d:sqlViews|d:validationRules|d:validationRuleGroups|d:users|d:reportTables">
<h3> <xsl:value-of select="local-name()"/> </h3>
<table border="1">
=== 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-13 18:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/model2html.xsl 2011-12-14 10:03:38 +0000
@@ -36,6 +36,7 @@
<xsl:include href="dataSet.xsl"/>
<xsl:include href="attributeType.xsl"/>
<xsl:include href="report.xsl"/>
+ <xsl:include href="reportTable.xsl"/>
<xsl:include href="validationRule.xsl"/>
<xsl:include href="validationRuleGroup.xsl"/>
<xsl:include href="sqlView.xsl"/>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl 2011-12-07 16:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl 2011-12-14 10:03:38 +0000
@@ -18,6 +18,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Short Name</td>
<td> <xsl:value-of select="d:shortName" /> </td>
</tr>
=== modified 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 2011-12-13 14:16:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl 2011-12-14 10:03:38 +0000
@@ -18,6 +18,10 @@
<td>Last Updated</td>
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
</table>
</div>
</xsl:template>
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl 2011-12-14 10:03:38 +0000
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:d="http://dhis2.org/schema/dxf/2.0"
+ >
+
+ <xsl:template match="d:reportTable">
+ <div class="reportTable">
+ <h2>
+ <xsl:value-of select="@name" />
+ </h2>
+ <table border="1">
+ <tr>
+ <td>ID</td>
+ <td> <xsl:value-of select="@id" /> </td>
+ </tr>
+ <tr>
+ <td>Last Updated</td>
+ <td> <xsl:value-of select="@lastUpdated" /> </td>
+ </tr>
+ <tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
+ <td>DoIndicators</td>
+ <td> <xsl:value-of select="d:doIndicators" /> </td>
+ </tr>
+ <tr>
+ <td>DoPeriods</td>
+ <td> <xsl:value-of select="d:doPeriods" /> </td>
+ </tr>
+ <tr>
+ <td>DoUnits</td>
+ <td> <xsl:value-of select="d:doUnits" /> </td>
+ </tr>
+ <tr>
+ <td>Regression</td>
+ <td> <xsl:value-of select="d:regression" /> </td>
+ </tr>
+ <tr>
+ <td>SortOrder</td>
+ <td> <xsl:value-of select="d:sortOrder" /> </td>
+ </tr>
+ <tr>
+ <td>TopLimit</td>
+ <td> <xsl:value-of select="d:topLimit" /> </td>
+ </tr>
+ </table>
+
+ <xsl:apply-templates select="d:reportParams|d:indicators|d:dataElements|d:dataSets|d:categoryOptionCombos|d:organisationUnits" mode="short"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="d:reportParams" mode="short">
+ <h3>ReportParams</h3>
+ <table border="1" class="reportParams">
+ <tr>
+ <td>ParamGrandParentOrganisationUnit</td>
+ <td> <xsl:value-of select="d:paramGrandParentOrganisationUnit" /> </td>
+ </tr>
+ <tr>
+ <td>ParamOrganisationUnit</td>
+ <td> <xsl:value-of select="d:paramOrganisationUnit" /> </td>
+ </tr>
+ <tr>
+ <td>ParamParentOrganisationUnit</td>
+ <td> <xsl:value-of select="d:paramParentOrganisationUnit" /> </td>
+ </tr>
+ <tr>
+ <td>ParamReportingMonth</td>
+ <td> <xsl:value-of select="d:paramReportingMonth" /> </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="d:reportTables" mode="short">
+ <xsl:if test="count(child::*) > 0">
+ <h3>ReportTables</h3>
+ <table border="1" class="reportTables">
+ <xsl:apply-templates select="child::*" mode="row"/>
+ </table>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/sqlView.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/sqlView.xsl 2011-12-13 17:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/sqlView.xsl 2011-12-14 10:03:38 +0000
@@ -19,6 +19,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Description</td>
<td> <xsl:value-of select="d:description" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/user.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/user.xsl 2011-12-13 18:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/user.xsl 2011-12-14 10:03:38 +0000
@@ -18,6 +18,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>First Name</td>
<td> <xsl:value-of select="d:firstName" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRule.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRule.xsl 2011-12-13 17:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRule.xsl 2011-12-14 10:03:38 +0000
@@ -19,6 +19,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Description</td>
<td> <xsl:value-of select="d:description" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRuleGroup.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRuleGroup.xsl 2011-12-13 17:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/validationRuleGroup.xsl 2011-12-14 10:03:38 +0000
@@ -19,6 +19,10 @@
<td> <xsl:value-of select="@lastUpdated" /> </td>
</tr>
<tr>
+ <td>Code</td>
+ <td> <xsl:value-of select="@code" /> </td>
+ </tr>
+ <tr>
<td>Description</td>
<td> <xsl:value-of select="d:description" /> </td>
</tr>