← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6947: Changed EquipmentDetails to Equipment - CCEM

 

------------------------------------------------------------
revno: 6947
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-05-15 17:49:04 +0530
message:
  Changed EquipmentDetails to Equipment - CCEM
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/Equipment.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.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 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/Equipment.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/Equipment.java	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/Equipment.java	2012-05-15 12:19:04 +0000
@@ -1,8 +1,8 @@
 package org.hisp.dhis.coldchain.inventory;
 
-import org.hisp.dhis.common.BaseIdentifiableObject;
+import java.io.Serializable;
 
-public class Equipment extends BaseIdentifiableObject
+public class Equipment implements Serializable
 {
     /**
      * Determines if a de-serialized file is compatible with this class.

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java	2012-05-15 12:19:04 +0000
@@ -6,8 +6,6 @@
 {
     String ID = EquipmentService.class.getName();
     
-    //void addEquipmentDetails( Equipment equipment );
-    
     void addEquipment( Equipment equipment );
 
     void updateEquipment( Equipment equipment );
@@ -16,7 +14,7 @@
 
     Collection<Equipment> getAllEquipments();
 
-    Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance);
+    Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance );
     
     Equipment getEquipment( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute );
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStore.java	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStore.java	2012-05-15 12:19:04 +0000
@@ -2,24 +2,19 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericNameableObjectStore;
-
-public interface EquipmentStore extends GenericNameableObjectStore<Equipment>
+public interface EquipmentStore
 {
     String ID = EquipmentStore.class.getName();
     
-    /*
-    void addEquipmentDetails( Equipment equipmentDetails );
+    void addEquipment( Equipment equipment );
+
+    void updateEquipment( Equipment equipment );
+
+    void deleteEquipment( Equipment equipment );
     
-    int addEquipmentDetails( Equipment equipment );
-
-    void updateEquipmentDetails( Equipment equipmentDetails );
-
-    void deleteEquipmentDetails( Equipment equipmentDetails );
-    */
     Collection<Equipment> getAllEquipments();
 
-    Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance);
+    Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance );
     
     Equipment getEquipment( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute );
     

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java	2012-05-15 12:19:04 +0000
@@ -17,66 +17,30 @@
         this.equipmentStore = equipmentStore;
     }
 
-    
-
     // -------------------------------------------------------------------------
     // EquipmentDetails
     // -------------------------------------------------------------------------
-
- /*   
-    @Override
-    public void addEquipmentDetails( Equipment equipmentDetails )
-    {
-        equipmentStore.addEquipmentDetails( equipmentDetails );
-    }
-    @Override
-    public void deleteEquipmentDetails( Equipment equipmentDetails )
-    {
-        equipmentStore.deleteEquipmentDetails( equipmentDetails );
-    }
-    @Override
-    public Collection<Equipment> getAllEquipmentDetails()
-    {
-        return equipmentStore.getAllEquipmentDetails();
-    }
-    @Override
-    public void updateEquipmentDetails( Equipment equipmentDetails )
-    {
-        equipmentStore.updateEquipmentDetails( equipmentDetails );
-    }
     
-    public Collection<Equipment> getEquipmentDetails( EquipmentInstance equipmentInstance)
-    {
-        return equipmentStore.getEquipmentDetails( equipmentInstance );
-    }
-
-    public Equipment getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
-    {
-        return equipmentStore.getEquipmentDetails( equipmentInstance, inventoryTypeAttribute );
-    }
-    */
     @Override
     public void addEquipment( Equipment equipment )
     {
-         equipmentStore.save( equipment );
+        equipmentStore.addEquipment( equipment );
     }
     @Override
     public void deleteEquipment( Equipment equipment )
     {
-        equipmentStore.delete( equipment );
-    }
-
-    @Override
-    public void updateEquipment( Equipment equipment )
-    {
-        equipmentStore.update( equipment );
-    }
-    
+        equipmentStore.deleteEquipment( equipment );
+    }
     @Override
     public Collection<Equipment> getAllEquipments()
     {
         return equipmentStore.getAllEquipments();
     }
+    @Override
+    public void updateEquipment( Equipment equipment )
+    {
+        equipmentStore.updateEquipment( equipment );
+    }
     
     public Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance)
     {
@@ -87,4 +51,5 @@
     {
         return equipmentStore.getEquipment( equipmentInstance, inventoryTypeAttribute );
     }
+    
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStore.java	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStore.java	2012-05-15 12:19:04 +0000
@@ -2,74 +2,66 @@
 
 import java.util.Collection;
 
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.coldchain.inventory.Equipment;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
 import org.hisp.dhis.coldchain.inventory.EquipmentStore;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
 
-public class HibernateEquipmentStore extends HibernateGenericStore<Equipment> implements EquipmentStore
+public class HibernateEquipmentStore implements EquipmentStore
 {
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-    /*
+    
     private SessionFactory sessionFactory;
 
     public void setSessionFactory( SessionFactory sessionFactory )
     {
         this.sessionFactory = sessionFactory;
     }
-    */
+    
     // -------------------------------------------------------------------------
     // EquipmentDetails
     // -------------------------------------------------------------------------
-    /*
-    @Override
-    public void addEquipmentDetails( Equipment equipmentDetails )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.save( equipmentDetails );
-    }
-
-    @Override
-    public void deleteEquipmentDetails( Equipment equipmentDetails )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.delete( equipmentDetails );
-    }
-
-    @Override
-    public Collection<Equipment> getAllEquipmentDetails()
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return session.createCriteria( Equipment.class ).list();
-    }
-
-    @Override
-    public void updateEquipmentDetails( Equipment equipmentDetails )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.update( equipmentDetails );
-    }
-    
-    
-    @Override
-    public Collection<Equipment> getAllEquipmentDetails()
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return session.createCriteria( Equipment.class ).list();
-    }
-    
-    
-    public Collection<Equipment> getEquipmentDetails( EquipmentInstance equipmentInstance )
+    
+    @Override
+    public void addEquipment( Equipment equipment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.save( equipment );
+    }
+
+    @Override
+    public void deleteEquipment( Equipment equipment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.delete( equipment );
+    }
+
+    @Override
+    public Collection<Equipment> getAllEquipments()
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createCriteria( Equipment.class ).list();
+    }
+
+    @Override
+    public void updateEquipment( Equipment equipment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.update( equipment );
+    }
+    
+    
+    public Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance )
     {
         Session session = sessionFactory.getCurrentSession();
         
@@ -80,7 +72,7 @@
         return criteria.list();
     }
 
-    public Equipment getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
+    public Equipment getEquipment( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
     {
         Session session = sessionFactory.getCurrentSession();
         
@@ -91,24 +83,5 @@
         
         return (Equipment) criteria.uniqueResult();
     }
-    */
-    
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public Collection<Equipment> getAllEquipments()
-    {
-        return sessionFactory.getCurrentSession().createCriteria( Equipment.class ).list();
-    }
-    
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance )
-    {
-        return getCriteria( Restrictions.eq( "equipmentInstance", equipmentInstance ) ).list();
-    }
-
-    public Equipment getEquipment( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
-    {
-        return (Equipment) getCriteria( Restrictions.eq( "equipmentInstance", equipmentInstance ),Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) ).uniqueResult();
-    }
+    
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-15 10:33:46 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-15 12:19:04 +0000
@@ -53,9 +53,7 @@
 	
     <bean id="org.hisp.dhis.coldchain.inventory.EquipmentStore"
         class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateEquipmentStore">
-		<property name="clazz" value="org.hisp.dhis.coldchain.inventory.Equipment" />
         <property name="sessionFactory" ref="sessionFactory"/>
-		<property name="cacheable" value="true" />
     </bean>	
 	
     <bean id="org.hisp.dhis.coldchain.inventory.EquipmentInstanceStore"