← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17236: Cleanup

 

------------------------------------------------------------
revno: 17236
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-23 11:39:12 +0200
message:
  Cleanup
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalAggregator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalSelection.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.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/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalAggregator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalAggregator.java	2014-10-03 22:13:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalAggregator.java	2014-10-23 09:39:12 +0000
@@ -226,9 +226,10 @@
      * @param <T> type of items
      * @return the first non-null item
      */
-    private static <T> T firstNonNull( T... values ) 
+    @SafeVarargs
+    private static <T> T firstNonNull( final T... values ) 
     {
-        for ( T value : values )
+        for ( final T value : values )
         {
             if ( value != null )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalSelection.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalSelection.java	2014-10-23 08:30:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalSelection.java	2014-10-23 09:39:12 +0000
@@ -61,8 +61,6 @@
 {
     private final static Log log = LogFactory.getLog( DataApprovalSelection.class );
 
-    private final static int INDEX_NOT_FOUND = -1;
-
     // -------------------------------------------------------------------------
     // Data selection parameters
     // -------------------------------------------------------------------------
@@ -104,12 +102,6 @@
     private Map<DataElementCategoryOptionCombo, Set<CategoryOptionGroupSet>> optionComboGroupSetCache = new HashMap<>();
 
     // -------------------------------------------------------------------------
-    // Preconstructed Status object
-    // -------------------------------------------------------------------------
-
-    private static final DataApprovalStatus STATUS_UNAPPROVABLE = new DataApprovalStatus( UNAPPROVABLE, null, null);
-
-    // -------------------------------------------------------------------------
     // Constructor
     // -------------------------------------------------------------------------
 
@@ -236,10 +228,7 @@
 
     private void tracePrint( String s ) // Temporary, for development
     {
-        if ( false ) // Enable or disable.
-        {
-            System.out.println( s );
-        }
+        //System.out.println( s );
     }
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-10-23 08:30:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-10-23 09:39:12 +0000
@@ -567,10 +567,7 @@
 
     private void tracePrint( String s ) // Temporary, for development
     {
-        if ( false ) // Enable or disable.
-        {
-            System.out.println( s );
-        }
+        //System.out.println( s );
     }
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java	2014-10-23 08:30:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java	2014-10-23 09:39:12 +0000
@@ -28,7 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataapproval.exceptions.DataApprovalException;
@@ -56,6 +55,7 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.security.SecurityService;
+import org.hisp.dhis.system.util.CollectionUtils;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.springframework.transaction.annotation.Transactional;
@@ -429,10 +429,7 @@
 
     private void tracePrint( String s ) // Temporary, for development
     {
-        if ( false ) // Enable or disable.
-        {
-            System.out.println( s );
-        }
+        //System.out.println( s );
     }
 
     private DataApproval defensiveCopy( DataApproval  da )
@@ -861,7 +858,7 @@
 
         for ( DataElementCategoryOption option : optionCombo.getCategoryOptions() )
         {
-            if ( !CollectionUtils.isEmpty( option.getOrganisationUnits() ) )
+            if ( option.getOrganisationUnits() != null && !option.getOrganisationUnits().isEmpty() )
             {
                 if ( orgUnits == null )
                 {

=== 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	2014-10-19 20:07:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-10-23 09:39:12 +0000
@@ -80,8 +80,6 @@
     {
         int defaultCategoryComboId = getDefaultCategoryCombo();
 
-        int defaultOptionCombo = getDefaultOptionCombo();
-
         // ---------------------------------------------------------------------
         // Drop outdated tables
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java	2014-10-23 08:30:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java	2014-10-23 09:39:12 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static com.google.common.collect.Lists.newArrayList;
 import static org.hisp.dhis.system.util.CollectionUtils.asList;
 import static org.hisp.dhis.system.util.CollectionUtils.asSet;
 import static org.junit.Assert.assertEquals;
@@ -36,14 +37,19 @@
 import static org.junit.Assert.fail;
 
 import java.util.Date;
-import java.util.List;
 import java.util.Set;
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataapproval.exceptions.UserCannotAccessApprovalLevelException;
 import org.hisp.dhis.dataapproval.exceptions.UserMayNotApproveDataException;
-import org.hisp.dhis.dataelement.*;
+import org.hisp.dhis.dataelement.CategoryOptionGroup;
+import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
+import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.mock.MockCurrentUserService;
@@ -57,7 +63,6 @@
 import org.hisp.dhis.user.UserService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
-import static com.google.common.collect.Lists.newArrayList;
 
 /**
  * @author Jim Grace
@@ -363,8 +368,6 @@
         groupEF.setGroupSet( groupSetEFGH );
         groupGH.setGroupSet( groupSetEFGH );
 
-        System.out.println("groupA set is " + groupAB.getGroupSet().getName() );
-
         level1ABCD = new DataApprovalLevel( "level1ABCD", 1, groupSetABCD );
         level1EFGH = new DataApprovalLevel( "level1EFGH", 1, groupSetEFGH );
         level2ABCD = new DataApprovalLevel( "level2ABCD", 2, groupSetABCD );
@@ -1547,8 +1550,8 @@
         setDependency( dataApprovalLevelService, "currentUserService", currentUserService, CurrentUserService.class );
 
         DataApproval dataApprovalJan = new DataApproval( level2, dataSetA, periodA, organisationUnitB, defaultCombo, NOT_ACCEPTED, date, userA );
-        DataApproval dataApprovalFeb = new DataApproval( level2, dataSetA, periodB, organisationUnitB, defaultCombo, NOT_ACCEPTED, date, userA );
-        DataApproval dataApprovalMar = new DataApproval( level2, dataSetA, periodC, organisationUnitB, defaultCombo, NOT_ACCEPTED, date, userA );
+        new DataApproval( level2, dataSetA, periodB, organisationUnitB, defaultCombo, NOT_ACCEPTED, date, userA );
+        new DataApproval( level2, dataSetA, periodC, organisationUnitB, defaultCombo, NOT_ACCEPTED, date, userA );
 
         dataApprovalService.approveData( asList( dataApprovalJan ) );
         dataApprovalService.acceptData( asList( dataApprovalJan ) );