← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 6825
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-02 11:33:10 +0530
message:
  CCEM work in progress
added:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeComparator.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeComparator.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeComparator.java
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js
modified:
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.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/DefaultInventoryTypeAttributeService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeFormAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributesAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java
  local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties
  local/in/dhis-web-coldchain/src/main/resources/struts.xml
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogTypeForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.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
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeComparator.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeComparator.java	2012-05-02 06:03:10 +0000
@@ -0,0 +1,14 @@
+package org.hisp.dhis.coldchain.catalog.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+
+public class CatalogTypeComparator
+implements Comparator<CatalogType>
+{
+    public int compare( CatalogType catalogType0, CatalogType catalogType1 )
+    {
+        return catalogType0.getName().compareToIgnoreCase( catalogType1.getName() );
+    }
+}

=== added directory 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator'
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeComparator.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeComparator.java	2012-05-02 06:03:10 +0000
@@ -0,0 +1,14 @@
+package org.hisp.dhis.coldchain.inventory.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+
+public class InventoryTypeAttributeComparator
+    implements Comparator<InventoryTypeAttribute>
+{
+    public int compare( InventoryTypeAttribute inventoryTypeAttribute0, InventoryTypeAttribute inventoryTypeAttribute1 )
+    {
+        return inventoryTypeAttribute0.getName().compareToIgnoreCase( inventoryTypeAttribute1.getName() );
+    }
+}

=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeComparator.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeComparator.java	2012-05-02 06:03:10 +0000
@@ -0,0 +1,13 @@
+package org.hisp.dhis.coldchain.inventory.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+
+public class InventoryTypeComparator implements Comparator<InventoryType>
+{
+    public int compare( InventoryType inventoryType0, InventoryType inventoryType1 )
+    {
+        return inventoryType0.getName().compareToIgnoreCase( inventoryType1.getName() );
+    }
+}

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.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/DefaultEquipmentDetailsService.java	2012-05-02 06:03:10 +0000
@@ -2,9 +2,6 @@
 
 import java.util.Collection;
 
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.criterion.Restrictions;
 import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public class DefaultEquipmentDetailsService implements EquipmentDetailsService

=== 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-04-30 08:30:00 +0000
+++ 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
@@ -3,7 +3,6 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.hibernate.Query;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.springframework.transaction.annotation.Transactional;
 

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java	2012-05-02 06:03:10 +0000
@@ -2,7 +2,6 @@
 
 import java.util.Collection;
 
-import org.hibernate.Session;
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
@@ -23,24 +22,28 @@
     // InventoryTypeAttribute
     // -------------------------------------------------------------------------
     
+    @Transactional
     @Override
     public int addInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
     {
         return inventoryTypeAttributeStore.addInventoryTypeAttribute( inventoryTypeAttribute );
     }
     
+    @Transactional
     @Override
     public void deleteInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
     {
         inventoryTypeAttributeStore.deleteInventoryTypeAttribute( inventoryTypeAttribute );
     }
     
+    @Transactional
     @Override
     public Collection<InventoryTypeAttribute> getAllInventoryTypeAttributes()
     {
         return inventoryTypeAttributeStore.getAllInventoryTypeAttributes();
     }
     
+    @Transactional
     @Override
     public void updateInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
     {

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java	2012-05-02 06:03:10 +0000
@@ -2,9 +2,7 @@
 
 import java.util.Collection;
 
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.criterion.Restrictions;
+import org.springframework.transaction.annotation.Transactional;
 
 public class DefaultInventoryTypeService implements InventoryTypeService
 {
@@ -22,24 +20,28 @@
     // InventoryType
     // -------------------------------------------------------------------------
 
+    @Transactional
     @Override
     public int addInventoryType( InventoryType inventoryType )
     {
         return inventoryTypeStore.addInventoryType( inventoryType );
     }
 
+    @Transactional
     @Override
     public void deleteInventoryType( InventoryType inventoryType )
     {
         inventoryTypeStore.deleteInventoryType( inventoryType );
     }
 
+    @Transactional
     @Override
     public Collection<InventoryType> getAllInventoryTypes()
     {
         return inventoryTypeStore.getAllInventoryTypes();
     }
 
+    @Transactional
     @Override
     public void updateInventoryType( InventoryType inventoryType )
     {

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java	2012-05-02 06:03:10 +0000
@@ -7,7 +7,6 @@
 import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.coldchain.inventory.InventoryType;
-import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeStore;
 
 public class HibernateInventoryTypeStore implements InventoryTypeStore

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml	2012-04-17 11:59:19 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml	2012-05-02 06:03:10 +0000
@@ -21,9 +21,9 @@
 	<set name="inventoryTypeAttributes" table="inventorytype_attributes">
       <key column="inventorytypeid" foreign-key="fk_inventorytype_attributes_inventorytypeid" />
       <many-to-many class="org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute" column="inventorytypeattributeid"
-          foreign-key="fk_inventorytype_attributes_inventorytypeattribtueid" />
+          foreign-key="fk_inventorytype_attributes_inventorytypeattributeid" />
     </set>
 	
 
   </class>
-</hibernate-mapping>
+</hibernate-mapping>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java	2012-04-30 11:24:11 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java	2012-05-02 06:03:10 +0000
@@ -1,10 +1,12 @@
 package org.hisp.dhis.coldchain.catalog.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.coldchain.catalog.CatalogType;
 import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeComparator;
 import org.hisp.dhis.paging.ActionPagingSupport;
 
 public class CatalogTypeListAction
@@ -61,7 +63,7 @@
         
         
         catalogTypes = new ArrayList<CatalogType>( catalogTypeService.getAllCatalogTypes());
-        
+        Collections.sort( catalogTypes, new CatalogTypeComparator() );
         /*
         if ( isNotBlank( key ) ) // Filter on key only if set
         {

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeFormAction.java	2012-04-25 05:52:37 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeFormAction.java	2012-05-02 06:03:10 +0000
@@ -2,14 +2,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 
 import org.hisp.dhis.coldchain.catalog.CatalogType;
 import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
 import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.program.ProgramStageDataElement;
 
 import com.opensymphony.xwork2.Action;
 

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java	2012-05-02 06:03:10 +0000
@@ -1,5 +1,6 @@
 package org.hisp.dhis.coldchain.inventory.action;
 
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -68,13 +69,14 @@
         this.tracking = tracking;
     }
     
-    private List<Integer> selectedList;
+    private List<Integer> selectedInventoryTypeAttributeList = new ArrayList<Integer>();
     
-    public void setSelectedList( List<Integer> selectedList )
+    public void setSelectedInventoryTypeAttributeList( List<Integer> selectedInventoryTypeAttributeList )
     {
-        this.selectedList = selectedList;
+        this.selectedInventoryTypeAttributeList = selectedInventoryTypeAttributeList;
     }
 
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -86,12 +88,34 @@
         inventoryType.setDescription( description );
         inventoryType.setTracking( tracking );
         
-        inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
+        if( catalogType != null )
+        {
+            inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
+        }
         
         Set<InventoryTypeAttribute> inventoryTypeSet = new HashSet<InventoryTypeAttribute>();
-        for( Integer inventoryTypeAttId : selectedList )
+        
+        if ( selectedInventoryTypeAttributeList != null && selectedInventoryTypeAttributeList.size() > 0 )
         {
-            inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
+            for ( int i = 0; i < this.selectedInventoryTypeAttributeList.size(); i++ )
+            {
+                
+                InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) );
+                /*
+                System.out.println( "ID---" + inventoryTypeAttribute.getId() );
+                System.out.println( "Name---" + inventoryTypeAttribute.getName());
+                System.out.println( "ValueType---" + inventoryTypeAttribute.getValueType() );
+                */
+                inventoryTypeSet.add( inventoryTypeAttribute );
+                
+                //inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) ) );
+            }
+            /*
+            for( Integer inventoryTypeAttId : selectedInventoryTypeAttributeList )
+            {
+                inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
+            }
+            */
         }
         
         inventoryType.setInventoryTypeAttributes( inventoryTypeSet );

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java	2012-04-21 12:57:24 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java	2012-05-02 06:03:10 +0000
@@ -41,7 +41,7 @@
 
     public String execute() throws Exception
     {
-        System.out.println("inside GetInventoryTypeAttributeAction");
+        //System.out.println("inside GetInventoryTypeAttributeAction");
         
         inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( id );
         

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java	2012-05-02 06:03:10 +0000
@@ -1,12 +1,14 @@
 package org.hisp.dhis.coldchain.inventory.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 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.InventoryTypeAttributeComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -52,7 +54,7 @@
     public String execute()
     throws Exception
     {
-        System.out.println(" Inside GetInventoryTypeAttributeListAction");
+        //System.out.println(" Inside GetInventoryTypeAttributeListAction");
         if( id != null )
         {
             InventoryType inventoryType = inventoryTypeService.getInventoryType( id );
@@ -63,6 +65,8 @@
         {
             inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
         }
+        Collections.sort( inventoryTypeAttributes, new InventoryTypeAttributeComparator() );
+        
         
         /**
          * TODO - need to write comparator for sorting the list

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributesAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributesAction.java	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributesAction.java	2012-05-02 06:03:10 +0000
@@ -1,10 +1,13 @@
 package org.hisp.dhis.coldchain.inventory.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
+import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeComparator;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.comparator.InventoryTypeAttributeComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -37,7 +40,9 @@
     public String execute() throws Exception
     {
         inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+        Collections.sort( inventoryTypeAttributes, new InventoryTypeAttributeComparator() );
         
+        /*
         for( InventoryTypeAttribute inventoryTypeAttribute : inventoryTypeAttributes )
         {
             System.out.println( "ID---" + inventoryTypeAttribute.getId() );
@@ -45,6 +50,7 @@
             System.out.println( "Discription---" + inventoryTypeAttribute.getDescription() );
             System.out.println( "ValueType---" + inventoryTypeAttribute.getValueType() );
         }
+        */
         return SUCCESS;
     }
 

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java	2012-05-02 06:03:10 +0000
@@ -1,10 +1,12 @@
 package org.hisp.dhis.coldchain.inventory.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.coldchain.inventory.InventoryType;
 import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.comparator.InventoryTypeComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -37,6 +39,8 @@
     {
         inventoryTypes = new ArrayList<InventoryType>( inventoryTypeService.getAllInventoryTypes() );
         
+        Collections.sort( inventoryTypes, new InventoryTypeComparator() );
+        
         /**
          * TODO - need to write comparator for sorting the list
          */

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java	2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java	2012-05-02 06:03:10 +0000
@@ -1,9 +1,12 @@
 package org.hisp.dhis.coldchain.inventory.action;
 
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
 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;
 
@@ -73,13 +76,14 @@
         this.tracking = tracking;
     }
     
-    private List<Integer> selectedList;
+    private List<Integer> selectedInventoryTypeAttributeList;
     
-    public void setSelectedList( List<Integer> selectedList )
+    public void setSelectedInventoryTypeAttributeList( List<Integer> selectedInventoryTypeAttributeList )
     {
-        this.selectedList = selectedList;
+        this.selectedInventoryTypeAttributeList = selectedInventoryTypeAttributeList;
     }
 
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -91,16 +95,41 @@
         inventoryType.setDescription( description );
         inventoryType.setTracking( tracking );
         
-        inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
-        
-        inventoryType.getInventoryTypeAttributes().clear();
-        
-        for( Integer inventoryTypeAttId : selectedList )
-        {
-            
-            inventoryType.getInventoryTypeAttributes().add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
-        }
-
+        if( catalogType != null )
+        {
+            inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
+        }
+        
+        if( inventoryType != null )
+        {
+            inventoryType.getInventoryTypeAttributes().clear();
+        }
+        
+        Set<InventoryTypeAttribute> inventoryTypeSet = new HashSet<InventoryTypeAttribute>();
+        
+        if ( selectedInventoryTypeAttributeList != null && selectedInventoryTypeAttributeList.size() > 0 )
+        {
+           
+            for ( int i = 0; i < this.selectedInventoryTypeAttributeList.size(); i++ )
+            {
+                InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) );
+                /*
+                System.out.println( "ID---" + inventoryTypeAttribute.getId() );
+                System.out.println( "Name---" + inventoryTypeAttribute.getName());
+                System.out.println( "ValueType---" + inventoryTypeAttribute.getValueType() );
+                */
+                inventoryTypeSet.add( inventoryTypeAttribute );
+                
+                //inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) ) );
+            }
+            /*
+            for( Integer inventoryTypeAttId : selectedInventoryTypeAttributeList )
+            {
+                inventoryType.getInventoryTypeAttributes().add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
+            }
+            */
+        }
+        inventoryType.setInventoryTypeAttributes( inventoryTypeSet );
         inventoryTypeService.updateInventoryType( inventoryType );
         
         return SUCCESS;

=== 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-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-02 06:03:10 +0000
@@ -348,14 +348,7 @@
         scope="prototype">
         <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
     </bean>
-	
-	<!-- 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>	
-		
+
 <!-- EquipmentDetails -->
     <bean id="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
         class="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
@@ -382,5 +375,13 @@
         <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>	
 	
 </beans>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties'
--- local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties	2012-05-02 06:03:10 +0000
@@ -1,7 +1,7 @@
 
 coldchain = Cold Chain
 coldchain_management = Cold chain management
-coldchain_catalog_type_attribute_management = Cold chain catalogtype attribute management
+coldchain_catalog_type_attribute_management = Catalogtype attribute management
 filter_by_name = Filter by name
 catalogType_attribute = Catalogtype attribute
 create_new_catalog_type_attribute = Create new catalogtype attribute
@@ -63,3 +63,4 @@
 inventorytype_management = Inventorytype management
 edit_inventorytype = Edit inventorytype
 inventorytype_details = Details inventorytype
+edit_inventorytype_attribute = Edit inventorytype attribute

=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml	2012-05-02 06:03:10 +0000
@@ -344,14 +344,6 @@
             <param name="onExceptionReturn">plainTextError</param>
         </action>
 	
-	<!-- InventoryType Attributes -->
-	<action name="getInventoryTypeAttributes" 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>	
-	
-	
-
 <!-- EquipmentDetails -->
         <action name="enquipmentSelect"
             class="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction">
@@ -388,6 +380,11 @@
             <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>							
 </package>		
 </struts>
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogTypeForm.vm	2012-04-25 05:52:37 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogTypeForm.vm	2012-05-02 06:03:10 +0000
@@ -22,7 +22,7 @@
     <thead>
       <tr>        
         <th>$i18n.getString( "available_catalogType_attribute" )</th>
-        <th></th>
+        <th>$i18n.getString( "filter" )</th>
         <th>$i18n.getString( "selected_catalogType_attribute" )							
 			<select id="selectedCatalogTypeAttributesValidator" name='selectedCatalogTypeAttributesValidator' multiple="multiple" class="{validate:{required:true}} hidden" ></select>
 		</th>

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm	2012-05-02 06:03:10 +0000
@@ -1,18 +1,6 @@
 <script type="text/javascript" src="javascript/addInventoryTypeForm.js"></script>
 <script type="text/javascript">
-	jQuery("#availableInventoryTypeAttributeList").dhisAjaxSelect({
-		source: "getInventoryTypeAttributes.action",
-		iterator: "inventoryTypeAttributes",
-		connectedTo: 'selectedInventoryTypeAttributeList',
-		handler: function(item) {
-			var option = jQuery("<option />");
-			option.text( item.name );
-			option.attr( "value", item.id );
-			
-			return option;
-			
-		}
-	});	
+
 </script>
 <h3>$i18n.getString( "create_new_inventorytype" )</h3>
 <form id="addInventoryTypeForm" action="addInventoryType.action" method="post" >
@@ -63,7 +51,7 @@
     
 	</table>
 	
-	<br/>&nbsp;
+	<br/>
   <table id="inventoryTypeMembersArea">
     <col style="width: 450px"/>
     <col/>
@@ -78,20 +66,16 @@
     <tbody>
       <tr>
         <td>
-          <select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )">
-			##foreach( $inventoryTypeAttribute in $inventoryTypeAttributes )
-				<!--<option value="$inventoryTypeAttribute.id">$inventoryTypeAttribute.name</option>-->
-			##end			
-          </select>
+          <select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select>
         </td>
         <td>
           	<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableInventoryTypeAttributeList' );"/><br/>
             <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedInventoryTypeAttributeList' );"/><br/>
 			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableInventoryTypeAttributeList' );"/><br/>
 			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedInventoryTypeAttributeList' );"/>
-        </td>           
+        </td>         
         <td>
-            <select id="selectedInventoryTypeAttributeList" name="selectedInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'selectedInventoryTypeAttributeList', 'availableInventoryTypeAttributeList' )"></select>
+            <select id="selectedInventoryTypeAttributeList" name="selectedInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%" ondblclick="moveSelectedById( 'selectedInventoryTypeAttributeList', 'availableInventoryTypeAttributeList' )"></select>
         </td>
       </tr>
 	  
@@ -104,9 +88,6 @@
     </tbody>
   </table>
 
-
-    
-
 <span id='message'></span>
 
 </form>   

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js	2012-05-02 06:03:10 +0000
@@ -7,7 +7,21 @@
             $("#selectedInventoryTypeAttributeList").find("option").attr("selected", "selected");
 		},
 	});
-
+	
+	jQuery("#availableInventoryTypeAttributeList").dhisAjaxSelect({
+		source: "inventoryTypeAttributes.action",
+		iterator: "inventoryTypeAttributes",
+		connectedTo: 'selectedInventoryTypeAttributeList',
+		handler: function(item) {
+			var option = jQuery("<option />");
+			option.text( item.name );
+			option.attr( "value", item.id );
+			
+			return option;
+			
+		}
+	});		
+	
 	checkValueIsExist("name", "validateInventoryType.action");
 });
 

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js	2012-05-02 06:03:10 +0000
@@ -0,0 +1,28 @@
+jQuery(document).ready(function() {
+	validation2('updateInventoryTypeForm', function(form) {
+		form.submit();
+	}, {
+		'beforeValidateHandler' : function() {
+            $("#selectedInventoryTypeAttributeList").find("option").attr("selected", "selected");
+		},
+	});
+	
+	checkValueIsExist( "name", "validateInventoryType.action", {id:getFieldValue('id')});	
+	
+	
+	jQuery("#availableInventoryTypeAttributeList").dhisAjaxSelect({
+		source: "inventoryTypeAttributes.action",
+		iterator: "inventoryTypeAttributes",
+		connectedTo: 'selectedInventoryTypeAttributeList',
+		handler: function(item) {
+			var option = jQuery("<option />");
+			option.text( item.name );
+			option.attr( "value", item.id );
+			
+			return option;
+			
+		}
+	});		
+	
+	
+});

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm	2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm	2012-05-02 06:03:10 +0000
@@ -1,21 +1,5 @@
-
-<script>
-	
-jQuery(document).ready(function() {
-    validation2('updateInventoryTypeForm', function(form) {
-        form.submit();
-    }, {
-        'beforeValidateHandler' : function() {
-            selectAllById('selectedList');
-        },
-    });
-
-	checkValueIsExist("name", "validateInventoryType.action", {
-            id : $organisationUnitGroupSet.id
-        });
-
-});
-	
+<script type="text/javascript" src="javascript/updateInventoryTypeForm.js"></script>
+<script type="text/javascript">
 </script>
 <h3>$i18n.getString( "edit_inventorytype" )</h3>
 <form id="updateInventoryTypeForm" action="updateInventoryType.action" method="post" >
@@ -57,7 +41,7 @@
             <select id="catalogType" name="catalogType">
             	<option value="">[$i18n.getString( "please_select_catalog_type" )]</option>
 					#foreach( $catalogType in $catalogTypes )
-						<option value="$catalogType.id" #if( $inventoryType.catalogType.id ) selected="selected" #end>$catalogType.name</option>
+						<option value="$catalogType.id" #if( $catalogType.id == $inventoryType.catalogType.id ) selected="selected" #end>$catalogType.name</option>
 					#end
             </select>
         </td>
@@ -67,7 +51,7 @@
     </tbody>
 	</table>
 
-    <br/>&nbsp;
+    <br/>
 
   <table id="dataElementSelectionArea">
     <col style="width: 450px"/>
@@ -83,20 +67,17 @@
     <tbody>
       <tr>
         <td>
-          <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">
-			#foreach( $inventoryTypeAttribute in $availInventoryTypeAttributes )
-				<option value="$inventoryTypeAttribute.id">$inventoryTypeAttribute.name</option>
-			#end			
-          </select>
-        </td>
+          <select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select>        </td>
         <td>
-            <input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onClick="moveSelectedById( 'availableList', 'selectedList' )"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onClick="moveSelectedById( 'selectedList', 'availableList' )"/><br/>
+            <input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableInventoryTypeAttributeList' );"/><br/>
+            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedInventoryTypeAttributeList' );"/><br/>
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableInventoryTypeAttributeList' );"/><br/>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedInventoryTypeAttributeList' );"/>
         </td>           
         <td>
-            <select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'selectedList', 'availableList' )">
-            #foreach( $inventoryTypeAttribute1 in $selInventoryTypeAttributes )
-                <option value="$inventoryTypeAttribute1.id">$inventoryTypeAttribute1.name</option>
+            <select id="selectedInventoryTypeAttributeList" name="selectedInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%" ondblclick="moveSelectedById( 'selectedInventoryTypeAttributeList', 'availableInventoryTypeAttributeList' )">
+            #foreach( $inventoryTypeAttribute in $selInventoryTypeAttributes )
+                <option value="$inventoryTypeAttribute.id">$inventoryTypeAttribute.name</option>
             #end            
             </select>
         </td>