← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6830: CCEM work in progress

 

------------------------------------------------------------
revno: 6830
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-02 14:48:42 +0530
message:
  CCEM work in progress
added:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusHistoryFormAction.java
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showEquipmentStatusHistory.vm
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogStore.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentStatusService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStatusStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java
  local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-coldchain/src/main/resources/struts.xml
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm


--
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/catalog/CatalogService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogService.java	2012-04-30 11:56:21 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogService.java	2012-05-02 09:18:42 +0000
@@ -21,6 +21,8 @@
     
     Catalog getCatalogByName( String name );
     
+    Collection<Catalog> getCatalogs( CatalogType catalogType );
+    
     int createCatalog( Catalog catalog, List<CatalogDataValue> catalogDataValues );
     
     void updateCatalogAndDataValue(  Catalog catalog, List<CatalogDataValue> valuesForSave, List<CatalogDataValue> valuesForUpdate, Collection<CatalogDataValue> valuesForDelete );

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogStore.java	2012-04-30 11:56:21 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogStore.java	2012-05-02 09:18:42 +0000
@@ -21,4 +21,5 @@
 
     Collection<Catalog> getAllCatalogs();
     
+    Collection<Catalog> getCatalogs( CatalogType catalogType );
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java	2012-05-02 09:18:42 +0000
@@ -30,4 +30,6 @@
     Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max );
     
     int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText );
+    
+    Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText, int min, int max );
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java	2012-05-02 09:18:42 +0000
@@ -27,4 +27,5 @@
 
     int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText );
 
+    Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText, int min, int max );
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusService.java	2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusService.java	2012-05-02 09:18:42 +0000
@@ -13,5 +13,7 @@
     void deleteEquipmentStatus( EquipmentStatus equipmentStatus );
 
     Collection<EquipmentStatus> getAllEquipmentStatus();
-
+    
+    Collection<EquipmentStatus> getEquipmentStatusHistory( EquipmentInstance equipmentInstance );
+    
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusStore.java	2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatusStore.java	2012-05-02 09:18:42 +0000
@@ -2,16 +2,19 @@
 
 import java.util.Collection;
 
-public interface EquipmentStatusStore
+import org.hisp.dhis.common.GenericStore;
+
+public interface EquipmentStatusStore extends GenericStore<EquipmentStatus>
 {
     String ID = EquipmentStatusStore.class.getName();
     
-    int addEquipmentStatus( EquipmentStatus equipmentStatus );
-
-    void updateEquipmentStatus( EquipmentStatus equipmentStatus );
-
-    void deleteEquipmentStatus( EquipmentStatus equipmentStatus );
-
-    Collection<EquipmentStatus> getAllEquipmentStatus();
-
+    //int addEquipmentStatus( EquipmentStatus equipmentStatus );
+
+    //void updateEquipmentStatus( EquipmentStatus equipmentStatus );
+
+    //void deleteEquipmentStatus( EquipmentStatus equipmentStatus );
+
+    //Collection<EquipmentStatus> getAllEquipmentStatus();
+    
+    Collection<EquipmentStatus> getEquipmentStatusHistory( EquipmentInstance equipmentInstance );
 }

=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java	2012-05-02 09:18:42 +0000
@@ -0,0 +1,16 @@
+package org.hisp.dhis.coldchain.inventory.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+
+public class InventoryTypeAttributeMandatoryComparator implements Comparator<InventoryTypeAttribute>
+{
+    public int compare( InventoryTypeAttribute inventoryTypeAttribute0, InventoryTypeAttribute inventoryTypeAttribute1 )
+    {
+        if( inventoryTypeAttribute0.isMandatory() )
+            return 1;
+        else
+            return 0;
+    }
+}

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogService.java	2012-04-30 11:56:21 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogService.java	2012-05-02 09:18:42 +0000
@@ -6,6 +6,7 @@
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.springframework.transaction.annotation.Transactional;
 
+@Transactional
 public class DefaultCatalogService implements CatalogService
 {
     // -------------------------------------------------------------------------
@@ -29,13 +30,12 @@
     // -------------------------------------------------------------------------
     // Catalog
     // -------------------------------------------------------------------------
-    @Transactional
+    
     public int addCatalog( Catalog catalog )
     {
         return catalogStore.addCatalog( catalog );
     }
 
-    @Transactional
     public void deleteCatalog( Catalog catalog )
     {
         catalogStore.deleteCatalog( catalog );
@@ -47,26 +47,22 @@
         catalogStore.delete( catalog );
     }
 
-    @Transactional
     public void updateCatalog( Catalog catalog )
     {
         catalogStore.updateCatalog( catalog );
     }
 
-    @Transactional
     public Collection<Catalog> getAllCatalogs()
     {
         return catalogStore.getAllCatalogs();
     }
     
-    @Transactional
     @Override
     public Catalog getCatalog( int id )
     {
         return catalogStore.getCatalog( id );
     }
     
-    @Transactional
     @Override
     public Catalog getCatalogByName( String name )
     {
@@ -119,4 +115,9 @@
         
         //catalogStore.deleteCatalog( catalog );
     }
+    
+    public Collection<Catalog> getCatalogs( CatalogType catalogType )
+    {
+        return catalogStore.getCatalogs( catalogType );
+    }
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogStore.java	2012-04-30 11:56:21 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogStore.java	2012-05-02 09:18:42 +0000
@@ -8,6 +8,7 @@
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.coldchain.catalog.Catalog;
 import org.hisp.dhis.coldchain.catalog.CatalogStore;
+import org.hisp.dhis.coldchain.catalog.CatalogType;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 
 public class HibernateCatalogStore extends HibernateGenericStore<Catalog> implements CatalogStore
@@ -75,4 +76,14 @@
         return (Catalog) criteria.uniqueResult();
     }
     
+    public Collection<Catalog> getCatalogs( CatalogType catalogType )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( Catalog.class );
+        criteria.add( Restrictions.eq( "catalogType", catalogType ) );
+
+        return criteria.list();
+    }
+    
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java	2012-05-02 06:03:10 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java	2012-05-02 09:18:42 +0000
@@ -100,4 +100,8 @@
         return equipmentInstanceStore.getCountEquipmentInstance(  orgUnit,  inventoryType, inventoryTypeAttribute ,  searchText );
     }
 
+    public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText, int min, int max )
+    {
+        return equipmentInstanceStore.getEquipmentInstances( orgUnit, inventoryType, inventoryTypeAttribute, searchText, min, max );
+    }
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentStatusService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentStatusService.java	2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentStatusService.java	2012-05-02 09:18:42 +0000
@@ -3,7 +3,7 @@
 import java.util.Collection;
 
 import org.springframework.transaction.annotation.Transactional;
-
+@Transactional
 public class DefaultEquipmentStatusService implements EquipmentStatusService
 {
     // -------------------------------------------------------------------------
@@ -20,29 +20,31 @@
     // -------------------------------------------------------------------------
     // EquipmentWorkingStatus
     // -------------------------------------------------------------------------
-    @Transactional
+    
     @Override
     public int addEquipmentStatus( EquipmentStatus equipmentStatus )
     {
-        return equipmentStatusStore.addEquipmentStatus( equipmentStatus );
+        return equipmentStatusStore.save( equipmentStatus );
     }
-    @Transactional
     @Override
     public void deleteEquipmentStatus( EquipmentStatus equipmentStatus )
     {
-        equipmentStatusStore.deleteEquipmentStatus( equipmentStatus );
+        equipmentStatusStore.delete( equipmentStatus );
     }
-    @Transactional
     @Override
     public Collection<EquipmentStatus> getAllEquipmentStatus()
     {
-        return equipmentStatusStore.getAllEquipmentStatus();
+        return equipmentStatusStore.getAll();
     }
-    @Transactional
     @Override
     public void updateEquipmentStatus( EquipmentStatus equipmentStatus )
     {
-        equipmentStatusStore.updateEquipmentStatus( equipmentStatus );
+        equipmentStatusStore.update( equipmentStatus );
     }
     
+    public Collection<EquipmentStatus> getEquipmentStatusHistory( EquipmentInstance equipmentInstance )
+    {
+        return equipmentStatusStore.getEquipmentStatusHistory( equipmentInstance );
+    }
+
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java	2012-05-02 09:18:42 +0000
@@ -127,11 +127,11 @@
 
     public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText )
     {
-        String hql = "select count( distinct(ed.equipmentInstance)) from EquipmentDetails ed JOIN EquipmentInstance ei " +
-                        " where ed.inventoryTypeAttribute = :inventoryTypeAttribute " +
-                        " and ei.organisationUnit = :orgUnit " +
-                        " and ei.inventoryType = :inventoryType " +
-                        " and ed.value like '%" + searchText + "%'";
+        String hql = "SELECT COUNT( DISTINCT ei ) FROM EquipmentInstance AS ei  " +
+                        " WHERE ei IN ( SELECT ed.equipmentInstance FROM EquipmentDetails AS ed WHERE ed.inventoryTypeAttribute.id = "+ inventoryTypeAttribute.getId()+" AND ed.value LIKE '%" + searchText + "%' ) " +
+                        " AND ei.organisationUnit.id = " + orgUnit.getId()  +
+                        " AND ei.inventoryType.id = " + inventoryType.getId();
+
         
         Query query = getQuery( hql );
 
@@ -140,4 +140,18 @@
         return (rs != null) ? rs.intValue() : 0;
     }
 
+    @SuppressWarnings( "unchecked" )
+    public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText, int min, int max )
+    {
+        String hql = "SELECT DISTINCT ei FROM EquipmentInstance AS ei  " +
+                        " WHERE ei IN ( SELECT ed.equipmentInstance FROM EquipmentDetails AS ed WHERE ed.inventoryTypeAttribute.id = "+ inventoryTypeAttribute.getId()+" AND ed.value like '%" + searchText + "%' ) " +
+                        " AND ei.organisationUnit.id = " + orgUnit.getId()  +
+                        " AND ei.inventoryType.id = " + inventoryType.getId();
+
+        
+        Query query = getQuery( hql ).setFirstResult( min ).setMaxResults( max );
+
+        return query.list();
+    }
+    
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStatusStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStatusStore.java	2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentStatusStore.java	2012-05-02 09:18:42 +0000
@@ -2,28 +2,36 @@
 
 import java.util.Collection;
 
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
 import org.hisp.dhis.coldchain.inventory.EquipmentStatus;
 import org.hisp.dhis.coldchain.inventory.EquipmentStatusStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.springframework.transaction.annotation.Transactional;
 
-public class HibernateEquipmentStatusStore implements EquipmentStatusStore
+@Transactional
+public class HibernateEquipmentStatusStore 
+    extends HibernateGenericStore<EquipmentStatus>
+    implements EquipmentStatusStore
 {
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
+    /*
     private SessionFactory sessionFactory;
 
     public void setSessionFactory( SessionFactory sessionFactory )
     {
         this.sessionFactory = sessionFactory;
     }
-
+    */
+    
     // -------------------------------------------------------------------------
     // EquipmentWorkingStatus
     // -------------------------------------------------------------------------
 
+    /*
     @Override
     public int addEquipmentStatus( EquipmentStatus equipmentStatus )
     {
@@ -55,5 +63,11 @@
 
         session.update( equipmentStatus );
     }
-
+    */
+    
+    @SuppressWarnings( "unchecked" )
+    public Collection<EquipmentStatus> getEquipmentStatusHistory( EquipmentInstance equipmentInstance )
+    {
+        return getCriteria( Restrictions.eq( "equipmentInstance", equipmentInstance ) ).list();
+    }
 }

=== 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-04-30 11:56:21 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-02 09:18:42 +0000
@@ -38,6 +38,7 @@
     </bean>
     <bean id="org.hisp.dhis.coldchain.inventory.EquipmentStatusStore"
         class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateEquipmentStatusStore">
+		<property name="clazz" value="org.hisp.dhis.coldchain.inventory.EquipmentStatus" />
         <property name="sessionFactory" ref="sessionFactory"/>
     </bean>
     <bean id="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionStore"

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java	2012-05-02 09:18:42 +0000
@@ -8,6 +8,8 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
 import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
@@ -37,6 +39,8 @@
     
     private EquipmentInstanceService equipmentInstanceService;
     
+    private CatalogService catalogService;
+    
     // -------------------------------------------------------------------------
     // Input/ Output
     // -------------------------------------------------------------------------
@@ -99,6 +103,19 @@
                         // Someone deleted this option ...
                     }
                 }
+                else if ( InventoryTypeAttribute.TYPE_CATALOG.equalsIgnoreCase( attribute.getValueType() ) )
+                {
+                    Catalog catalog = catalogService.getCatalog( NumberUtils.toInt( value, 0 ) );
+                    if ( catalog != null )
+                    {
+                        //equipmentDetails.setInventoryTypeAttributeOption( option );
+                        equipmentDetails.setValue( catalog.getName() );
+                    }
+                    else
+                    {
+                        // Someone deleted this catalog ...
+                    }
+                }
                 else
                 {
                     equipmentDetails.setValue( value.trim() );
@@ -147,6 +164,11 @@
         this.equipmentInstanceService = equipmentInstanceService;
     }
 
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
+
     public void setOuId( Integer ouId )
     {
         this.ouId = ouId;

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java	2012-05-02 09:18:42 +0000
@@ -5,6 +5,9 @@
 import java.util.List;
 import java.util.Map;
 
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
+import org.hisp.dhis.coldchain.catalog.CatalogType;
 import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
 import org.hisp.dhis.coldchain.inventory.EquipmentDetailsService;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
@@ -33,6 +36,13 @@
         this.equipmentDetailsService = equipmentDetailsService;
     }
     
+    private CatalogService catalogService;
+    
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -65,6 +75,13 @@
         return equipmentValueMap;
     }
 
+    private List<Catalog> catalogs;
+    
+    public List<Catalog> getCatalogs()
+    {
+        return catalogs;
+    }
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -90,6 +107,13 @@
             }
         }
         
+        CatalogType catalogType = equipmentInstance.getInventoryType().getCatalogType();
+        
+        if( catalogType != null )
+        {
+            catalogs = new ArrayList<Catalog>( catalogService.getCatalogs( catalogType ) );
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java	2012-05-02 09:18:42 +0000
@@ -1,14 +1,21 @@
 package org.hisp.dhis.coldchain.equipment.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
+import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
+import org.hisp.dhis.coldchain.inventory.EquipmentDetailsService;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
 import org.hisp.dhis.coldchain.inventory.InventoryType;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.comparator.InventoryTypeAttributeMandatoryComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.paging.ActionPagingSupport;
@@ -46,6 +53,13 @@
         this.inventoryTypeAttributeService = inventoryTypeAttributeService;
     }
     
+    private EquipmentDetailsService equipmentDetailsService;
+    
+    public void setEquipmentDetailsService( EquipmentDetailsService equipmentDetailsService )
+    {
+        this.equipmentDetailsService = equipmentDetailsService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -111,6 +125,20 @@
         this.searchText = searchText;
     }
 
+    public Map<String, String> equipmentDetailsMap;
+    
+    public Map<String, String> getEquipmentDetailsMap()
+    {
+        return equipmentDetailsMap;
+    }
+
+    public List<InventoryTypeAttribute> inventoryTypeAttributeList;
+    
+    public List<InventoryTypeAttribute> getInventoryTypeAttributeList()
+    {
+        return inventoryTypeAttributeList;
+    }
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -118,6 +146,8 @@
     {
         System.out.println("insde GetEquipmentInstanceListAction");
         
+        equipmentDetailsMap = new HashMap<String, String>();
+        
         OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
         
         inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
@@ -126,17 +156,51 @@
         {
             listAllEquipmentInstance( orgUnit, inventoryType );
 
+            getInventoryTypeAttributeData();
+            
             return SUCCESS;
         }
 
         InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( Integer.parseInt( inventoryTypeAttributeId ) );
         
         listEquipmentInstancesByFilter( orgUnit, inventoryType, inventoryTypeAttribute, searchText);
-        //equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType ) );
+        
+        getInventoryTypeAttributeData();
         
         return SUCCESS;
     }
     
+    private void getInventoryTypeAttributeData()
+    {
+        inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+        
+        Collections.sort( inventoryTypeAttributeList, new InventoryTypeAttributeMandatoryComparator() );
+        if( inventoryTypeAttributeList != null && inventoryTypeAttributeList.size() > 3 )
+        {
+            int count = 1;
+            Iterator<InventoryTypeAttribute> iterator = inventoryTypeAttributeList.iterator();
+            while( iterator.hasNext() )
+            {
+                if( count > 3 )
+                    iterator.remove();
+                
+                count++;
+            }            
+        }
+        
+        for( EquipmentInstance equipmentInstance : equipmentInstanceList )
+        {
+            for( InventoryTypeAttribute inventoryTypeAttribute1 : inventoryTypeAttributeList )
+            {
+                EquipmentDetails equipmentDetails = equipmentDetailsService.getEquipmentDetails( equipmentInstance, inventoryTypeAttribute1 );
+                if( equipmentDetails != null && equipmentDetails.getValue() != null )
+                {
+                    equipmentDetailsMap.put( equipmentInstance.getId()+":"+inventoryTypeAttribute1.getId(), equipmentDetails.getValue() );
+                }
+            }
+        }
+    }
+    
     private void listAllEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
     {
         total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType );
@@ -151,10 +215,8 @@
     {
         total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType, inventoryTypeAttribute, searchText );
         
-        System.out.println("Total : "+total );
-        
         this.paging = createPaging( total );
         
-        //equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType, inventoryTypeAttribute, searchText, paging.getStartPos(), paging.getPageSize() ) );
+        equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType, inventoryTypeAttribute, searchText, paging.getStartPos(), paging.getPageSize() ) );
     }
 }

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java	2012-05-02 09:18:42 +0000
@@ -3,6 +3,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
+import org.hisp.dhis.coldchain.catalog.CatalogType;
 import org.hisp.dhis.coldchain.inventory.InventoryType;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
@@ -29,6 +32,13 @@
     {
         this.inventoryTypeService = inventoryTypeService;
     }
+    
+    private CatalogService catalogService;
+    
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
 
     // -------------------------------------------------------------------------
     // Input/Output
@@ -69,16 +79,32 @@
         return inventoryTypeAttributes;
     }
 
+    private List<Catalog> catalogs;
+    
+    public List<Catalog> getCatalogs()
+    {
+        return catalogs;
+    }
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
     public String execute() throws Exception
     {
+        catalogs = new ArrayList<Catalog>();
+        
         organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
         
         inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
         
         inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+              
+        CatalogType catalogType = inventoryType.getCatalogType();
+        
+        if( catalogType != null )
+        {
+            catalogs = new ArrayList<Catalog>( catalogService.getCatalogs( catalogType ) );
+        }
         
         return SUCCESS;
     }

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusHistoryFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusHistoryFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusHistoryFormAction.java	2012-05-02 09:18:42 +0000
@@ -0,0 +1,63 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.EquipmentStatus;
+import org.hisp.dhis.coldchain.inventory.EquipmentStatusService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowEquipmentStatusHistoryFormAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private EquipmentInstanceService equipmentInstanceService;
+
+    public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+    {
+        this.equipmentInstanceService = equipmentInstanceService;
+    }
+
+    private EquipmentStatusService equipmentStatusService;
+    
+    public void setEquipmentStatusService( EquipmentStatusService equipmentStatusService )
+    {
+        this.equipmentStatusService = equipmentStatusService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer equipmentInstanceId;
+    
+    public void setEquipmentInstanceId( Integer equipmentInstanceId )
+    {
+        this.equipmentInstanceId = equipmentInstanceId;
+    }
+
+    private List<EquipmentStatus> equipmentStatusHistory;
+    
+    public List<EquipmentStatus> getEquipmentStatusHistory()
+    {
+        return equipmentStatusHistory;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+    public String execute() throws Exception
+    {
+        System.out.println("inside ShowEquipmentStatusHistoryFormAction ");
+        EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+        
+        equipmentStatusHistory = new ArrayList<EquipmentStatus>( equipmentStatusService.getEquipmentStatusHistory( equipmentInstance ) );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java	2012-05-02 09:18:42 +0000
@@ -7,6 +7,8 @@
 
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
 import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
 import org.hisp.dhis.coldchain.inventory.EquipmentDetailsService;
 import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
@@ -33,6 +35,8 @@
 
     private EquipmentDetailsService equipmentDetailsService;
     
+    private CatalogService catalogService;
+    
     // -------------------------------------------------------------------------
     // Input/ Output
     // -------------------------------------------------------------------------
@@ -87,6 +91,19 @@
                         // Someone deleted this option ...
                     }
                 }
+                else if ( InventoryTypeAttribute.TYPE_CATALOG.equalsIgnoreCase( attribute.getValueType() ) )
+                {
+                    Catalog catalog = catalogService.getCatalog( NumberUtils.toInt( value, 0 ) );
+                    if ( catalog != null )
+                    {
+                        //equipmentDetails.setInventoryTypeAttributeOption( option );
+                        equipmentDetails.setValue( catalog.getName() );
+                    }
+                    else
+                    {
+                        // Someone deleted this catalog ...
+                    }
+                }
                 else
                 {
                     equipmentDetails.setValue( value.trim() );
@@ -109,6 +126,19 @@
                         // Someone deleted this option ...
                     }
                 }
+                else if ( InventoryTypeAttribute.TYPE_CATALOG.equalsIgnoreCase( attribute.getValueType() ) )
+                {
+                    Catalog catalog = catalogService.getCatalog( NumberUtils.toInt( value, 0 ) );
+                    if ( catalog != null )
+                    {
+                        //equipmentDetails.setInventoryTypeAttributeOption( option );
+                        equipmentDetails.setValue( catalog.getName() );
+                    }
+                    else
+                    {
+                        // Someone deleted this catalog ...
+                    }
+                }
                 else
                 {
                     equipmentDetails.setValue( value.trim() );
@@ -154,5 +184,9 @@
         this.equipmentInstanceID = equipmentInstanceID;
     }
 
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
 
 }

=== modified file 'local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-02 06:03:10 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-02 09:18:42 +0000
@@ -300,6 +300,12 @@
         <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
     </bean>
 
+    <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction"
+        class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction"
+        scope="prototype">
+        <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+    </bean>	    
+	
 <!-- InventoryType -->
     <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction"
         class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction"
@@ -348,14 +354,15 @@
         scope="prototype">
         <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
     </bean>
-
+	
+		
 <!-- EquipmentDetails -->
     <bean id="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
         class="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
         scope="prototype">
         <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
-		<property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+        <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+        <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     </bean>
     <bean id="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction"
         class="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction"
@@ -368,20 +375,58 @@
         <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
         <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
         <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+        <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+		<property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService" />
     </bean>
     <bean id="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
         class="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
         scope="prototype">
         <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
         <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
-    </bean>
-
-<!-- For Mearging -->
-	<!-- InventoryType Attributes -->
-    <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction"
-        class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction"
-        scope="prototype">
-        <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
-    </bean>	
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+    </bean>
+    <bean id="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction"
+        class="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction"
+        scope="prototype">
+        <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+        <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+        <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+        <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+    </bean>
+    <bean id="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction"
+        class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction"
+        scope="prototype">
+        <property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService" />
+        <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+    </bean>
+    <bean id="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction"
+        class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction"
+        scope="prototype">
+        <property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService" />
+        <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+        <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+    </bean>
+    <bean id="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction"
+        class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction"
+        scope="prototype">
+    </bean>
+    <bean id="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction"
+        class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction"
+        scope="prototype">
+        <property name="equipmentStatusService" ref="org.hisp.dhis.coldchain.inventory.EquipmentStatusService" />
+        <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+        <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />      
+    </bean>
+
+    <bean id="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusHistoryFormAction"
+        class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusHistoryFormAction"
+        scope="prototype">
+        <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+        <property name="equipmentStatusService" ref="org.hisp.dhis.coldchain.inventory.EquipmentStatusService" />
+    </bean>
+
 	
 </beans>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml	2012-05-02 06:03:10 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml	2012-05-02 09:18:42 +0000
@@ -294,6 +294,12 @@
             <result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryTypeAttribute.vm</result>
             <param name="onExceptionReturn">plainTextError</param>
         </action>
+		
+		<action name="inventoryTypeAttributes" 
+			class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction">
+			<result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryTypeAttributes.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
 
 <!-- InventoryType -->
         <action name="inventoryTypeList" class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction">
@@ -352,7 +358,7 @@
             <param name="menu">/dhis-web-coldchain/equipmentMenu.vm</param>
             <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/equipment.js</param>
             <param name="requiredAuthorities">F_EQUIPMENT_MANAGEMENT</param>
-			<interceptor-ref name="organisationUnitTreeStack" />
+            <interceptor-ref name="organisationUnitTreeStack" />
         </action>
         <action name="getOrganisationUnit"
             class="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction">
@@ -364,7 +370,7 @@
             <param name="onExceptionReturn">plainTextError</param>
         </action>
         <action name="getEquipmentInstances" class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceListAction">
-			<result name="success" type="velocity">/content.vm</result>
+            <result name="success" type="velocity">/content.vm</result>
             <param name="page">/dhis-web-coldchain/equipmentInstanceList.vm</param>
             <param name="requiredAuthorities">F_EQUIPMENT_MANAGEMENT</param>
         </action>
@@ -375,16 +381,41 @@
             <param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
         </action>
         <action name="addEquipment"
-            class="">
+            class="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction">
             <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
             <param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
         </action>
-	
-<!-- For Mearging -->
-	<!-- InventoryType Attributes -->
-	<action name="inventoryTypeAttributes" class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributesAction">
-		<result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryTypeAttributes.vm</result>
-		<param name="onExceptionReturn">plainTextError</param>
-	</action>							
+        <action name="showUpdateEquipmentForm"
+            class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction">
+            <result name="success" type="velocity">/content.vm</result>
+            <param name="page">/dhis-web-coldchain/updateEquipmentForm.vm</param>
+            <param name="requiredAuthorities">F_EQUIPMENT_UPDATE</param>
+        </action>
+        <action name="updateEquipment"
+            class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction">
+            <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+            <param name="requiredAuthorities">F_EQUIPMENT_UPDATE</param>
+        </action>
+        
+		<action name="showEquipmentStatusForm"
+            class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction">
+            <result name="success" type="velocity">/content.vm</result>
+            <param name="page">/dhis-web-coldchain/equipmentStatusForm.vm</param>
+            <param name="requiredAuthorities">F_EQUIPMENTSTATUS_UPDATE</param>
+        </action>
+		
+        <action name="updateEquipmentStatus"
+            class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction">
+            <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+            <param name="requiredAuthorities">F_EQUIPMENTSTATUS_UPDATE</param>
+        </action>
+
+        <action name="showEquipmentStatusHistoryForm"
+            class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusHistoryFormAction">
+            <result name="success" type="velocity">/content.vm</result>
+            <param name="page">/dhis-web-coldchain/showEquipmentStatusHistory.vm</param>
+            <param name="requiredAuthorities">F_EQUIPMENTSTATUSHISTORY</param>
+        </action>
+									
 </package>		
 </struts>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm	2012-05-02 09:18:42 +0000
@@ -70,6 +70,13 @@
 								<option value="$option.id" >$option.name</option>
 							#end
 						</select>
+                    #elseif( $attribute.valueType == "CATALOG" )
+                        <select  id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default"  $attribute.mandatory )'>
+                            <option value="">[$i18n.getString( "please_select" )]</option>
+                            #foreach ($catalog in $catalogs )
+                                <option value="$catalog.id" >$catalog.name</option>
+                            #end
+                        </select>
 					#else
 						<input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
 					#end

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm	2012-05-02 09:18:42 +0000
@@ -24,15 +24,21 @@
 <table class="mainPageTable">
     <tr>
     <td>    
-      <table class="listTable" id="equipmentList" width='100%'>          
-          <col/>
+      <table class="listTable" id="equipmentList" width='100%'>
+          #foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
+			<col/>
+		  #end
+		  <col/>
           <col/>
           <col width="200"/>    
           
           <thead>
             <tr>
                 <th>#</th>
-                <th>$i18n.getString( "id" )</th>                
+				  #foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
+					<th>$inventoryTypeAttribute.name</th>
+				  #end
+
                 <th style="text-align:center" class="{sorter: false}">$i18n.getString( "operations" )</th>
               </tr>
           </thead>
@@ -47,12 +53,16 @@
                     $nr
                 </td>
                 
-                <td>$!equipmentInstance.id</td>
+				 #foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
+					#set( $mapId = $equipmentInstance.id + ':' + $inventoryTypeAttribute.id )
+                    <td>$!equipmentDetailsMap.get( $mapId )</td>
+                  #end
                 
                 <td>
                   <a href="javascript:showUpdateEquipmentForm( '$equipmentInstance.id' )" title='$i18n.getString( "edit_equipment" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_equipment" )'></a>
                   #if( $inventoryType.tracking )
-					<a href="javascript:showEquipmentStatusForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "migration_patient" )' style='width:25px; height:25px'></a>
+					<a href="javascript:showEquipmentStatusForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "equipment_tracking" )' style='width:25px; height:25px'></a>
+                    <a href="javascript:showEquipmentStatusHistoryForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking_history" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "equipment_tracking_history" )' style='width:25px; height:25px'></a>
 				  #end
                   <a href="javascript:removeEquipment( '$equipmentInstance.id', '$encoder.jsEncode( $equipmentInstance.id )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
                   <a href="javascript:showEquipmentDetails( '$equipmentInstance.id' )" title='$i18n.getString( "equipment_details" )'><img src="../images/information.png" alt='$i18n.getString( "equipment_details" )'></a>

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm	2012-05-02 09:18:42 +0000
@@ -63,7 +63,7 @@
     <p>
         <input type="submit" class="button" value="$i18n.getString( 'add' )"/>
         <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadAllEquipments();"/>
-		<input type="button" class="button" value="$i18n.getString( 'show_history' )" onclick="showEquipmentStatusHistory( "$equipmentInstanceId" );" />
+		<!--<input type="button" class="button" value="$i18n.getString( 'show_history' )" onclick="showEquipmentStatusHistory( "$equipmentInstanceId" );" />-->
     </p>
 
 </form>	

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js	2012-05-02 09:18:42 +0000
@@ -132,6 +132,35 @@
 }
 
 //----------------------------------------------------------------
+//Show Equipment Status History
+//----------------------------------------------------------------
+
+function showEquipmentStatusHistoryForm( equipmentInstanceId )
+{
+	//hideById('listEquipmentDiv');
+	hideById('editEquipmentStatusDiv');
+	hideById('selectDiv');
+	hideById('searchEquipmentDiv');
+	
+	setInnerHTML('editEquipmentDiv', '');
+	
+	//jQuery('#loaderDiv').show();
+	
+	jQuery('#equipmentStatusHistoryDiv').dialog('destroy').remove();
+	jQuery('<div id="equipmentStatusHistoryDiv">' ).load( 'showEquipmentStatusHistoryForm.action?equipmentInstanceId='+equipmentInstanceId ).dialog({
+		title: 'i18n_equipment_status_history',
+		maximize: true, 
+		closable: true,
+		modal:true,
+		overlay:{background:'#000000', opacity:0.1},
+		width: 800,
+		height: 450
+	});
+	
+}
+
+
+//----------------------------------------------------------------
 //Show Equipment Tracking Form
 //----------------------------------------------------------------
 

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm	2012-05-02 09:18:42 +0000
@@ -54,6 +54,7 @@
 <div id='listEquipmentDiv'></div> <!-- List All/Filtered Equipments -->
 <div id='editEquipmentDiv'></div> <!-- Add / Edit Equipment Form -->
 <div id='editEquipmentStatusDiv'></div> <!-- Add / Edit Equipment Status -->
+<div id='equipmentStatusHistoryDiv'></div> <!-- List Equipment Status History -->
 <div id='resultSearchDiv' style='font-size:13px'></div> <!-- List searching Equipment -->
 
 #parse( "/dhis-web-commons/loader/loader.vm" )

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showEquipmentStatusHistory.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showEquipmentStatusHistory.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showEquipmentStatusHistory.vm	2012-05-02 09:18:42 +0000
@@ -0,0 +1,21 @@
+
+<table>
+	<tr>
+		<th>Reporting Date</th>
+		<th>Date of Updation</th>
+		<th>Status</th>
+		<th>Description</th>
+		<th>Stored by</th>
+	</tr>
+	
+	#foreach( $equimentStatus in $equipmentStatusHistory )
+		<tr>
+			<td>$equimentStatus.reportingDate</td>
+			<td>$equimentStatus.updationDate</td>
+			<td>$equimentStatus.status</td>
+			<td>$equimentStatus.description</td>
+			<td>$equimentStatus.storedBy</td>
+		</tr>		
+	#end
+	
+</table>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm	2012-04-30 08:30:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm	2012-05-02 09:18:42 +0000
@@ -71,6 +71,13 @@
 								<option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
 							#end
 						</select>
+                    #elseif( $attribute.valueType == "CATALOG" )
+                        <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default"  $attribute.mandatory )'>
+                            <option value="">[$i18n.getString( "please_select" )]</option>
+                            #foreach ($catalog in $catalogs )
+                                <option value="$catalog.id" #if($attributeValue == $catalog.name) selected="selected" #end>$catalog.name</option>
+                            #end
+                        </select>
 					#else
 						<input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
 					#end