← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14717: Changed returned type of addDataApprovalLevel from bool to int

 

------------------------------------------------------------
revno: 14717
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-07 11:34:43 +0200
message:
  Changed returned type of addDataApprovalLevel from bool to int
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.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/dataapproval/DataApprovalLevelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2014-04-07 09:21:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2014-04-07 09:34:43 +0000
@@ -111,9 +111,9 @@
      * approval levels from low to high.)
      *
      * @param newLevel the new level to add.
-     * @return true if level was added, false if not well formed or duplicate.
+     * @return the identifier of the added level, or -1 if not well formed or duplicate.
      */
-    boolean addDataApprovalLevel( DataApprovalLevel newLevel );
+    int addDataApprovalLevel( DataApprovalLevel newLevel );
 
     /**
      * Removes a data approval level.

=== 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-04-07 09:21:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-04-07 09:34:43 +0000
@@ -267,20 +267,20 @@
         return false;
     }
 
-    public boolean addDataApprovalLevel( DataApprovalLevel newLevel )
+    public int addDataApprovalLevel( DataApprovalLevel newLevel )
     {
         List<DataApprovalLevel> dataApprovalLevels = getAllDataApprovalLevels();
 
         if ( newLevel.getOrgUnitLevel() <= 0 )
         {
-            return false;
+            return -1;
         }
 
         int index = getInsertIndex( dataApprovalLevels, newLevel );
 
         if ( index < 0 )
         {
-            return false;
+            return -1;
         }
 
         dataApprovalLevels.add( index, newLevel );
@@ -295,9 +295,7 @@
         newLevel.setLevel( index + 1 );
         newLevel.setCreated( new Date() );
 
-        dataApprovalLevelStore.save( newLevel );
-
-        return true;
+        return dataApprovalLevelStore.save( newLevel );
     }
     
     public void deleteDataApprovalLevel( int level )