dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03415
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1148: Changed the DataElementCategoryOption.categoryOptionCombos from List to Set. Hibernate does not a...
------------------------------------------------------------
revno: 1148
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-12-01 19:47:16 +0100
message:
Changed the DataElementCategoryOption.categoryOptionCombos from List to Set. Hibernate does not accept bidirectional associations where both ends are ordered collections. This lead to the association not working properly and causing problems in ReportTable.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java
--
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.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-12-01 18:47:16 +0000
@@ -235,7 +235,7 @@
return null; // DataElement is DimensionOption for the static DataElement dimension
}
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
return null; // DataElement is DimensionOption for the static DataElement dimension
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2009-12-01 18:47:16 +0000
@@ -27,8 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dimension.Dimension;
@@ -47,7 +47,7 @@
private DataElementCategory category;
- private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+ private Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<DataElementCategoryOptionCombo>();
// -------------------------------------------------------------------------
// Constructors
@@ -69,7 +69,7 @@
// Constructors
// -------------------------------------------------------------------------
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
return categoryOptionCombos;
}
@@ -147,12 +147,12 @@
this.category = category;
}
- public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
+ public Set<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
}
- public void setCategoryOptionCombos( List<DataElementCategoryOptionCombo> categoryOptionCombos )
+ public void setCategoryOptionCombos( Set<DataElementCategoryOptionCombo> categoryOptionCombos )
{
this.categoryOptionCombos = categoryOptionCombos;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2009-11-06 10:21:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2009-12-01 18:47:16 +0000
@@ -266,23 +266,7 @@
public String getShortName()
{
- StringBuffer name = new StringBuffer();
-
- if ( categoryOptions != null && categoryOptions.size() > 0 )
- {
- Iterator<DataElementCategoryOption> iterator = categoryOptions.iterator();
-
- name.append( "(" ).append( iterator.next().getShortName() );
-
- while ( iterator.hasNext() )
- {
- name.append( ", " ).append( iterator.next().getShortName() );
- }
-
- name.append( ")" );
- }
-
- return name.toString();
+ return getName();
}
public void setShortName( String shortName )
@@ -292,7 +276,7 @@
public String getCode()
{
- return getShortName();
+ return getName();
}
public void setCode( String code )
@@ -302,7 +286,7 @@
public String getAlternativeName()
{
- return getShortName();
+ return getName();
}
public void setAlternativeName( String alternativeName )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2009-12-01 18:47:16 +0000
@@ -27,9 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
@@ -71,9 +69,9 @@
return DimensionType.DATAELEMENTGROUPSET;
}
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
- return new ArrayList<DataElement>( members );
+ return members;
}
public Dimension getDimension()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java 2009-12-01 18:47:16 +0000
@@ -27,7 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.List;
+import java.util.Set;
/**
* @author Lars Helge Overland
@@ -38,7 +38,7 @@
DimensionType getDimensionType();
- List<? extends DimensionOptionElement> getDimensionOptionElements();
+ Set<? extends DimensionOptionElement> getDimensionOptionElements();
Dimension getDimension();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2009-12-01 18:47:16 +0000
@@ -27,9 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
@@ -71,9 +69,9 @@
return DimensionType.INDICATORGROUPSET;
}
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
- return new ArrayList<Indicator>( members );
+ return members;
}
public Dimension getDimension()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2009-12-01 18:47:16 +0000
@@ -30,6 +30,7 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.dimension.Dimension;
import org.hisp.dhis.dimension.DimensionOption;
@@ -142,7 +143,7 @@
return null;
}
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
return null;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2009-12-01 18:47:16 +0000
@@ -109,7 +109,7 @@
return null;
}
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
+ public Set<? extends DimensionOptionElement> getDimensionOptionElements()
{
return null;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml 2009-10-30 13:22:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml 2009-12-01 18:47:16 +0000
@@ -16,12 +16,11 @@
<column name="name" not-null="true" unique="true" length="160"/>
</property>
- <list name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
+ <set name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
<key column="categoryoptionid"/>
- <list-index column="sort_order" base="1"/>
<many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo"
column="categoryoptioncomboid" foreign-key="fk_categoryoption_categoryoptioncomboid"/>
- </list>
+ </set>
<join table="categories_categoryoptions" inverse="true">
<key column="categoryoptionid"/>
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java 2009-11-26 08:48:34 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java 2009-12-01 18:47:16 +0000
@@ -119,13 +119,13 @@
String ids = getCommaDelimitedString( getIdentifiers( DataElementCategoryOptionCombo.class, dimensionOption.getDimensionOptionElements() ) );
final String sql =
- "SELECT " + functionMap.get( dataElement.getAggregationOperator() ) + "(value)" +
+ "SELECT " + functionMap.get( dataElement.getAggregationOperator() ) + "(value) " +
"FROM aggregateddatavalue " +
"WHERE dataelementid = " + dataElement.getId() + " " +
"AND categoryoptioncomboid IN (" + ids + ") " +
"AND periodid = " + period.getId() + " " +
"AND organisationunitid = " + organisationUnit.getId();
-
+
return statementManager.getHolder().queryForDouble( sql );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 2009-11-24 07:55:36 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 2009-12-01 18:47:16 +0000
@@ -102,6 +102,8 @@
}
catch ( Exception ex )
{
+ log.info( "SQL: '" + statement.getStatement() + "'" );
+
throw new RuntimeException( "Failed to create table: " + reportTable.getTableName(), ex );
}
finally
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java 2009-12-01 18:47:16 +0000
@@ -55,7 +55,7 @@
public class GetReportParamsAction
implements Action
{
- private static final int AVAILABLE_REPORTING_MONTHS = 12;
+ private static final int AVAILABLE_REPORTING_MONTHS = 24;
private static final String MODE_REPORT = "report";
private static final String MODE_REPORT_TABLE = "table";