=== renamed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListMap.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ListMap.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListMap.java 2013-01-14 17:31:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ListMap.java 2013-02-26 18:33:01 +0000 @@ -1,4 +1,4 @@ -package org.hisp.dhis.system.util; +package org.hisp.dhis.common; /* * Copyright (c) 2004-2012, University of Oslo === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2013-02-25 12:33:35 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2013-02-26 18:33:01 +0000 @@ -27,11 +27,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + /** * A Concept Name is a short name which is used as an attribute name * when representing a data value in xml which does not use === 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 2013-02-26 17:45:20 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2013-02-26 18:51:12 +0000 @@ -46,6 +46,7 @@ import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.indicator.Indicator; @@ -222,11 +223,17 @@ private List organisationUnits = new ArrayList(); /** + * The list of DataElementGroups the ReportTable contains. + */ + private List dataElementGroups = new ArrayList(); + + /** * The list of OrganisationUnitGroups the ReportTable contains. */ @Scanned private List organisationUnitGroups = new ArrayList(); + /** * The DataElementCategoryCombo for the ReportTable. */ @@ -264,10 +271,43 @@ private Integer sortOrder; /** - * Inidicates whether the table should be limited from top by this value. + * Indicates whether the table should be limited from top by this value. */ private Integer topLimit; + /** + * Indicates rendering of sub-totals for the table. + */ + private boolean subtotals; + + /** + * The display density of the text in the table. + */ + private String displayDensity; + + /** + * The font size of the text in the table. + */ + private String fontSize; + + /** + * Indicates use of the organisation unit of the current user. + */ + private boolean userOrganisationUnit; + + /** + * Indicates use of the organisation unit children of the current user. + */ + private boolean userOrganisationUnitChildren; + + // ------------------------------------------------------------------------- + // Presentation properties + // ------------------------------------------------------------------------- + + private Map> dataElementGroupSets = new HashMap>(); + + private Map> organisationUnitGroupSets = new HashMap>(); + // ------------------------------------------------------------------------- // Transient properties // ------------------------------------------------------------------------- @@ -491,7 +531,55 @@ // ------------------------------------------------------------------------- // Public methods // ------------------------------------------------------------------------- - + + /** + * Populates the presentation properties based on the persisted properties. + */ + public ReportTable populatePresentationProperties() + { + ListMap degs = new ListMap(); + + for ( DataElementGroup group : dataElementGroups ) + { + degs.putValue( group.getGroupSet().getUid(), group ); + } + + ListMap ougs = new ListMap(); + + for ( OrganisationUnitGroup group : organisationUnitGroups ) + { + ougs.putValue( group.getUid(), group ); + } + + dataElementGroupSets.clear(); + dataElementGroupSets.putAll( degs ); + organisationUnitGroupSets.clear(); + organisationUnitGroupSets.putAll( ougs ); + + return this; + } + + /** + * Sets the persisted properties based on the presentation properties. + */ + public ReportTable readPresentationProperties() + { + dataElementGroups.clear(); + organisationUnitGroups.clear(); + + for ( String groupSet : dataElementGroupSets.keySet() ) + { + dataElementGroups.addAll( dataElementGroupSets.get( groupSet ) ); + } + + for ( String groupSet : organisationUnitGroupSets.keySet() ) + { + organisationUnitGroups.addAll( organisationUnitGroupSets.get( groupSet ) ); + } + + return this; + } + /** * Creates a map which contains mappings between the organisation unit * identifier and the name of the group this organisation unit is a member @@ -1063,6 +1151,21 @@ @JsonProperty @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( localName = "dataElementGroup", namespace = DxfNamespaces.DXF_2_0) + public List getDataElementGroups() + { + return dataElementGroups; + } + + public void setDataElementGroups( List dataElementGroups ) + { + this.dataElementGroups = dataElementGroups; + } + + @JsonProperty + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0) @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0) public List getOrganisationUnitGroups() @@ -1154,6 +1257,9 @@ this.reportParams = reportParams; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) public Integer getSortOrder() { return sortOrder; @@ -1177,6 +1283,101 @@ this.topLimit = topLimit; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public boolean isSubtotals() + { + return subtotals; + } + + public void setSubtotals( boolean subtotals ) + { + this.subtotals = subtotals; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public String getDisplayDensity() + { + return displayDensity; + } + + public void setDisplayDensity( String displayDensity ) + { + this.displayDensity = displayDensity; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public String getFontSize() + { + return fontSize; + } + + public void setFontSize( String fontSize ) + { + this.fontSize = fontSize; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public boolean isUserOrganisationUnit() + { + return userOrganisationUnit; + } + + public void setUserOrganisationUnit( boolean userOrganisationUnit ) + { + this.userOrganisationUnit = userOrganisationUnit; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public boolean isUserOrganisationUnitChildren() + { + return userOrganisationUnitChildren; + } + + public void setUserOrganisationUnitChildren( boolean userOrganisationUnitChildren ) + { + this.userOrganisationUnitChildren = userOrganisationUnitChildren; + } + + // ------------------------------------------------------------------------- + // Get- and set-methods for presentation properties + // ------------------------------------------------------------------------- + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public Map> getDataElementGroupSets() + { + return dataElementGroupSets; + } + + public void setDataElementGroupSets( Map> dataElementGroupSets ) + { + this.dataElementGroupSets = dataElementGroupSets; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public Map> getOrganisationUnitGroupSets() + { + return organisationUnitGroupSets; + } + + public void setOrganisationUnitGroupSets( Map> organisationUnitGroupSets ) + { + this.organisationUnitGroupSets = organisationUnitGroupSets; + } + // ------------------------------------------------------------------------- // Get- and set-methods for transient properties // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2013-01-18 14:18:49 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2013-02-26 18:33:01 +0000 @@ -31,7 +31,7 @@ import java.util.concurrent.Future; import org.hisp.dhis.common.IdentifiableObject; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; public interface AnalyticsManager { === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-02-25 15:15:07 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-02-26 18:33:01 +0000 @@ -48,7 +48,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.system.util.CollectionUtils; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.hisp.dhis.system.util.ListUtils; import org.hisp.dhis.system.util.MapMap; import org.hisp.dhis.system.util.MathUtils; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-02-25 15:15:07 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-02-26 18:33:01 +0000 @@ -55,7 +55,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.hisp.dhis.system.util.MathUtils; import org.hisp.dhis.system.util.PaginatedList; import org.springframework.beans.factory.annotation.Autowired; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2013-02-25 15:15:07 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2013-02-26 18:33:01 +0000 @@ -54,7 +54,7 @@ import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.hisp.dhis.system.util.MathUtils; import org.hisp.dhis.system.util.SqlHelper; import org.hisp.dhis.system.util.TextUtils; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java 2013-01-25 10:33:17 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java 2013-02-26 18:33:01 +0000 @@ -38,7 +38,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.YearlyPeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; public class PartitionUtils { === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java' --- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java 2013-01-27 14:20:01 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java 2013-02-26 18:33:01 +0000 @@ -41,7 +41,7 @@ import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.YearlyPeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java' --- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2013-02-25 15:15:07 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2013-02-26 18:33:01 +0000 @@ -63,7 +63,7 @@ import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.QuarterlyPeriodType; import org.hisp.dhis.period.YearlyPeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java' --- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java 2013-01-17 17:49:13 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java 2013-02-26 18:33:01 +0000 @@ -40,7 +40,7 @@ import org.hisp.dhis.period.Cal; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.YearlyPeriodType; -import org.hisp.dhis.system.util.ListMap; +import org.hisp.dhis.common.ListMap; import org.junit.Test; public class PartitionUtilsTest === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2013-02-26 18:33:01 +0000 @@ -214,7 +214,7 @@ writer.closeElement(); writer.openElement( FIELD_ORGANISATION_UNITS ); - for ( OrganisationUnit unit : reportTable.getUnits() ) + for ( OrganisationUnit unit : reportTable.getOrganisationUnits() ) { writer.writeElement( FIELD_ID, String.valueOf( unit.getId() ) ); } @@ -301,7 +301,7 @@ while ( reader.moveToStartElement( FIELD_ID, FIELD_ORGANISATION_UNITS ) ) { int id = Integer.parseInt( reader.getElementValue() ); - reportTable.getUnits().add( organisationUnitService.getOrganisationUnit( organisationUnitMapping.get( id ) ) ); + reportTable.getOrganisationUnits().add( organisationUnitService.getOrganisationUnit( organisationUnitMapping.get( id ) ) ); } reader.moveToStartElement( FIELD_CATEGORY_COMBO ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2013-02-26 17:45:20 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2013-02-26 18:18:49 +0000 @@ -65,6 +65,14 @@ foreign-key="fk_reporttable_organisationunits_organisationunitid" /> + + + + + + + @@ -110,6 +118,12 @@ + + + + + +