← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5338: Minor simplification

 

------------------------------------------------------------
revno: 5338
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-09 14:40:07 +0100
message:
  Minor simplification
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.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/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2011-12-06 11:36:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2011-12-09 13:40:07 +0000
@@ -81,6 +81,10 @@
      */
     private Date lastUpdated;
 
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
     public BaseIdentifiableObject()
     {
     }
@@ -92,6 +96,10 @@
         this.name = name;
     }
 
+    // -------------------------------------------------------------------------
+    // Setters and getters
+    // -------------------------------------------------------------------------
+
     public int getId()
     {
         return id;
@@ -153,6 +161,10 @@
         this.lastUpdated = lastUpdated;
     }
 
+    // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
     /**
      * Set auto-generated fields on save or update
      */

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java	2011-11-24 14:36:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java	2011-12-09 13:40:07 +0000
@@ -35,29 +35,27 @@
  * @author bobj
  */
 public class HibernateIdentifiableObjectStore<T extends BaseIdentifiableObject>
-    extends HibernateGenericStore<T> implements GenericIdentifiableObjectStore<T>
+    extends HibernateGenericStore<T>
+    implements GenericIdentifiableObjectStore<T>
 {
     @Override
     public final int save( T object )
     {
         object.setAutoFields();
-
-        return (Integer) sessionFactory.getCurrentSession().save( object );
+        return super.save( object );
     }
 
     @Override
     public final void update( T object )
     {
         object.setAutoFields();
-
-        sessionFactory.getCurrentSession().update( object );
+        super.update( object );
     }
 
     @Override
     public final void saveOrUpdate( T object )
     {
         object.setAutoFields();
-
-        sessionFactory.getCurrentSession().saveOrUpdate( object );
+        super.saveOrUpdate( object );
     }
 }