← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5991: Changed DataSet.expiryDays form object to primitive

 

------------------------------------------------------------
revno: 5991
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-16 16:31:42 +0100
message:
  Changed DataSet.expiryDays form object to primitive
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml


--
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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-02-05 13:27:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-02-16 15:31:42 +0000
@@ -62,6 +62,8 @@
     public static final String TYPE_SECTION = "section";
     public static final String TYPE_CUSTOM = "custom";
 
+    public static final int NO_EXPIRY = 0; 
+    
     /**
      * Determines if a de-serialized file is compatible with this class.
      */
@@ -122,7 +124,7 @@
     /**
      * How many days after period is over will this dataSet auto-lock
      */
-    private Integer expiryDays;
+    private int expiryDays;
 
     /**
      * Locking exceptions
@@ -437,12 +439,12 @@
 
     @XmlElement
     @JsonProperty
-    public Integer getExpiryDays()
+    public int getExpiryDays()
     {
         return expiryDays;
     }
 
-    public void setExpiryDays( Integer expiryDays )
+    public void setExpiryDays( int expiryDays )
     {
         this.expiryDays = expiryDays;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-02-16 15:07:04 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-02-16 15:31:42 +0000
@@ -404,7 +404,7 @@
     public boolean isLocked( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
     {
         // if we don't have any expiryDays, then just return false
-        if ( dataSet.getExpiryDays() == null || dataSet.getExpiryDays() <= 0 )
+        if ( dataSet.getExpiryDays() == DataSet.NO_EXPIRY )
         {
             return false;
         }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-02-16 13:24:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-02-16 15:31:42 +0000
@@ -189,11 +189,7 @@
         executeSql( "ALTER TABLE categoryoptioncombos_categoryoptions ADD CONSTRAINT categoryoptioncombos_categoryoptions_pkey PRIMARY KEY (categoryoptioncomboid, sort_order)" );
 
         // dataelementcategoryoption
-        executeSql( "ALTER TABLE dataelementcategoryoption DROP CONSTRAINT fk_dataelement_categoryid" );
-        // executeSql(
-        // "ALTER TABLE dataelementcategoryoption DROP CONSTRAINT
-        // dataelementcategoryoption_name_key"
-        // ); will be maintained in transition period
+        executeSql( "ALTER TABLE dataelementcategoryoption DROP CONSTRAINT fk_dataelement_categoryid" );        
         executeSql( "ALTER TABLE dataelementcategoryoption DROP CONSTRAINT dataelementcategoryoption_shortname_key" );
 
         // minmaxdataelement query index
@@ -202,7 +198,8 @@
         // add mandatory boolean field to patientattribute
         executeSql( "ALTER TABLE patientattribute ADD mandatory bool" );
         
-        if ( executeSql( "ALTER TABLE patientattribute ADD groupby bool" ) >= 0){
+        if ( executeSql( "ALTER TABLE patientattribute ADD groupby bool" ) >= 0 )
+        {
             executeSql( "UPDATE patientattribute SET groupby=false" );
         }
         
@@ -376,6 +373,7 @@
         executeSql( "update dataset set mobile = false where mobile is null" );
         executeSql( "update dataelement set zeroissignificant = false where zeroissignificant is null" );
         executeSql( "update organisationunit set haspatients = false where haspatients is null" );
+        executeSql( "update dataset set expirydays = 0 where expirydays is null" );
 
         executeSql( "update reporttable set reportingmonth = false where reportingmonth is null" );
         executeSql( "update reporttable set reportingbimonth = false where reportingbimonth is null" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-02-14 02:58:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-02-16 15:31:42 +0000
@@ -888,7 +888,7 @@
       <aop:before pointcut="execution( * org.hisp.dhis.dataelement.DataElementService.delete*(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.dataelement.DataElementCategoryService.delete*(..) )"
         method="intercept" />
-      <aop:before pointcut="execution( * org.hisp.dhis.dataset.DataSetService.delete*(..) )" method="intercept" />
+      <aop:before pointcut="execution( * org.hisp.dhis.dataset.DataSetService.deleteDataSet(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.dataset.SectionService.delete*(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.indicator.IndicatorService.delete*(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.expression.ExpressionService.delete*(..) )" method="intercept" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2012-02-05 13:27:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2012-02-16 15:31:42 +0000
@@ -61,7 +61,7 @@
 
     <property name="version" />
 
-    <property name="expiryDays" not-null="false" />
+    <property name="expiryDays" />
 
     <set name="lockExceptions" table="datasetlockexceptions">
       <cache usage="read-write" />