← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14564: Approval, using GenericStore

 

------------------------------------------------------------
revno: 14564
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-31 12:53:08 +0200
message:
  Approval, using GenericStore
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.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/hibernate/HibernateDataApprovalLevelStore.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/DataApprovalLevelStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java	2014-03-28 10:13:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java	2014-03-31 10:53:08 +0000
@@ -30,12 +30,15 @@
 
 import java.util.List;
 
+import org.hisp.dhis.common.GenericStore;
+
 /**
  * Defines the functionality for persisting DataApproval objects.
  *
  * @author Jim Grace
  */
 public interface DataApprovalLevelStore
+    extends GenericStore<DataApprovalLevel>
 {
     String ID = DataApprovalLevelStore.class.getName();
 
@@ -49,25 +52,4 @@
      * @return List of all data approval levels, ordered from 1 to n.
      */
     List<DataApprovalLevel> getAllDataApprovalLevels();
-
-    /**
-     * Adds a data approval level.
-     *
-     * @param dataApprovalLevel the DataApprovalLevel to add.
-     */
-    void addDataApproval( DataApprovalLevel dataApprovalLevel );
-
-    /**
-     * Updates a data approval level.
-     *
-     * @param dataApprovalLevel The DataApprovalLevel to update.
-     */
-    void updateDataApprovalLevel( DataApprovalLevel dataApprovalLevel );
-
-    /**
-     * Deletes a data approval level.
-     *
-     * @param dataApprovalLevel the DataApprovalLevel to delete.
-     */
-    void deleteDataApprovalLevel( DataApprovalLevel dataApprovalLevel );
 }

=== 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-03-30 04:37:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-03-31 10:53:08 +0000
@@ -210,11 +210,11 @@
         newLevel.setLevel( index + 1 );
         newLevel.setCreated( new Date() );
 
-        dataApprovalLevelStore.addDataApproval( newLevel );
+        dataApprovalLevelStore.save( newLevel );
 
         return true;
     }
-
+    
     public void deleteDataApprovalLevel( int level )
     {
         List<DataApprovalLevel> dataApprovalLevels = getAllDataApprovalLevels();
@@ -223,7 +223,7 @@
 
         if ( index >= 0 & index < dataApprovalLevels.size() )
         {
-            dataApprovalLevelStore.deleteDataApprovalLevel( dataApprovalLevels.get( index ) );
+            dataApprovalLevelStore.delete( dataApprovalLevels.get( index ) );
 
             dataApprovalLevels.remove( index );
 
@@ -300,7 +300,7 @@
 
         dataApprovalLevel.setCreated( new Date() );
 
-        dataApprovalLevelStore.updateDataApprovalLevel( dataApprovalLevel );
+        dataApprovalLevelStore.update( dataApprovalLevel );
     }
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalLevelStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalLevelStore.java	2014-03-30 04:37:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalLevelStore.java	2014-03-31 10:53:08 +0000
@@ -31,7 +31,6 @@
 import java.util.List;
 
 import org.hibernate.criterion.Order;
-import org.hibernate.proxy.HibernateProxy;
 import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelStore;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
@@ -52,19 +51,4 @@
     {
         return getCriteria().addOrder( Order.asc( "level" ) ).list();
     }
-
-    public void addDataApproval( DataApprovalLevel dataApprovalLevel )
-    {
-        save( dataApprovalLevel );
-    }
-
-    public void updateDataApprovalLevel( DataApprovalLevel dataApprovalLevel )
-    {
-        update( dataApprovalLevel );
-    }
-
-    public void deleteDataApprovalLevel( DataApprovalLevel dataApprovalLevel )
-    {
-        delete( dataApprovalLevel );
-    }
 }