← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10155: Lock exception, replaced a hack with a slightly less nasty hack. Seems like hibernate has problem...

 

------------------------------------------------------------
revno: 10155
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-12 13:02:53 +0100
message:
  Lock exception, replaced a hack with a slightly less nasty hack. Seems like hibernate has problems downcasting proxied association objects.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.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-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	2013-03-09 14:35:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2013-03-12 12:02:53 +0000
@@ -125,8 +125,6 @@
     public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
     {
         ReportTable reportTable = JacksonUtils.fromJson( input, ReportTable.class );
-        System.out.println("rt " + reportTable.getName());
-        System.out.println(reportTable.getColumnDimensions());
         
         reportTable.readPresentationProps();
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java	2013-03-09 06:53:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java	2013-03-12 12:02:53 +0000
@@ -33,6 +33,7 @@
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.period.CalendarPeriodType;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
 import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
 import org.hisp.dhis.system.util.FilterUtils;
@@ -107,21 +108,12 @@
     {
         DataSet dataSet = dataSetService.getDataSet( id );
 
-        if ( dataSet == null )
+        if ( dataSet == null || dataSet.getPeriodType() == null )
         {
             return new ArrayList<Period>();
         }
 
-        CalendarPeriodType periodType;
-
-        if ( dataSet.getPeriodType().getName().equalsIgnoreCase( "Yearly" ) )
-        {
-            periodType = new YearlyPeriodType();
-        }
-        else
-        {
-            periodType = (CalendarPeriodType) dataSet.getPeriodType();
-        }
+        CalendarPeriodType periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( dataSet.getPeriodType().getName() );
 
         List<Period> periods = periodType.generateLast5Years( new Date() );
         FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );