← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13188: CCEM Import Functionality

 

------------------------------------------------------------
revno: 13188
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-10 10:44:10 +0000
message:
  CCEM Import Functionality
modified:
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/manager/action/ShowUpdateFacilityDataEntryFormAction.java
  local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/CSVImportAction.java
  local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml
  local/in/pom.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/manager/action/ShowUpdateFacilityDataEntryFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/manager/action/ShowUpdateFacilityDataEntryFormAction.java	2013-08-13 12:40:46 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/manager/action/ShowUpdateFacilityDataEntryFormAction.java	2013-12-10 10:44:10 +0000
@@ -78,7 +78,7 @@
         organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
 
         // Data set and sections Information
-		List<DataSet> dataSets = new ArrayList<DataSet>( dataSetService.getDataSetByShortName( "FMD" ) ); 
+        List<DataSet> dataSets = new ArrayList<DataSet>( dataSetService.getDataSetByShortName( "FMD" ) ); 
         dataSet = dataSets.get( 0 );
         
         

=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/CSVImportAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/CSVImportAction.java	2013-12-05 11:55:45 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/CSVImportAction.java	2013-12-10 10:44:10 +0000
@@ -5,6 +5,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -29,12 +30,20 @@
 import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
 import org.hisp.dhis.coldchain.model.ModelTypeAttributeService;
 import org.hisp.dhis.coldchain.model.ModelTypeService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.jdbc.core.JdbcTemplate;
 
@@ -119,6 +128,27 @@
         this.dataSetService = dataSetService;
     }
 
+    private DataElementService dataElementService;
+    
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    
+    private DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+
     private JdbcTemplate jdbcTemplate;
 
     public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
@@ -185,11 +215,11 @@
             
             Map<String, OrganisationUnit> orgUnitMap = importAdminHierarchy( uncompressedFolderPath );
             
-            Map<String, OrganisationUnit> faclityMap = importFacility( uncompressedFolderPath, orgUnitMap );
-            
-            Map<String, Model> refrigeratorModelMap = importRefrigeratorCatalogData( uncompressedFolderPath, refrigeratorModel, lookupDataMap );
-            
-            importRefrigetaorDetails( uncompressedFolderPath, refrigeratorEquipment, assetMap, faclityMap, refrigeratorModelMap, lookupDataMap );
+            Map<String, OrganisationUnit> faclityMap = importFacility( uncompressedFolderPath, orgUnitMap, lookupDataMap );
+            
+            //Map<String, Model> refrigeratorModelMap = importRefrigeratorCatalogData( uncompressedFolderPath, refrigeratorModel, lookupDataMap );
+            
+            //importRefrigetaorDetails( uncompressedFolderPath, refrigeratorEquipment, assetMap, faclityMap, refrigeratorModelMap, lookupDataMap );
             
             /*
             for( String lookupKey : lookupDataMap.keySet() )
@@ -215,10 +245,58 @@
     }
     
     
-    public Map<String, OrganisationUnit> importFacility( String facilityCSVFilePath, Map<String, OrganisationUnit> orgUnitMap )
+    public Map<String, OrganisationUnit> importFacility( String facilityCSVFilePath, Map<String, OrganisationUnit> orgUnitMap, Map<String, List<String>> lookupDataMap )
     {
         facilityCSVFilePath += File.separator + "Facility.csv";
         
+        message += "<br><font color=black>Importing started for Facility.csv " + new Date() + " </font><br>";
+        
+        // Creating missing Orgunitgroups from lookup data
+        List<String> facilityTypes = lookupDataMap.get( "FacilityType" );
+        //facilityTypes.addAll( lookupDataMap.get( "Ownership" ) );        
+        Map<String, OrganisationUnitGroup> orgunitGroups = new HashMap<String, OrganisationUnitGroup>();
+        for( String facilityType : facilityTypes )
+        {
+            if( facilityType != null && !facilityType.trim().equals("") )
+            {
+                List<OrganisationUnitGroup> organisationUnitGroups  = organisationUnitGroupService.getOrganisationUnitGroupByName( facilityType );
+                if( organisationUnitGroups == null || organisationUnitGroups.isEmpty() )
+                {
+                    OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup();
+                    organisationUnitGroup.setName( facilityType );
+                    organisationUnitGroup.setShortName( facilityType );
+                    
+                    organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
+                    
+                    orgunitGroups.put( facilityType, organisationUnitGroup );
+                }
+            }
+        }
+        
+        List<String> ownership = lookupDataMap.get( "Ownership" );        
+        Map<String, OrganisationUnitGroup> ownershiOrgunitGroups = new HashMap<String, OrganisationUnitGroup>();
+        for( String ownershiptype : ownership )
+        {
+            if( ownershiptype != null && !ownershiptype.trim().equals("") )
+            {
+                List<OrganisationUnitGroup> organisationUnitGroups  = organisationUnitGroupService.getOrganisationUnitGroupByName( ownershiptype );
+                if( organisationUnitGroups == null || organisationUnitGroups.isEmpty() )
+                {
+                    OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup();
+                    organisationUnitGroup.setName( ownershiptype );
+                    organisationUnitGroup.setShortName( ownershiptype );
+                    
+                    organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
+                    
+                    ownershiOrgunitGroups.put( ownershiptype, organisationUnitGroup );
+                }
+            }
+        }
+        
+
+        System.out.println("************************************************************************************************************");
+        System.out.println("************************************************************************************************************");
+        
         List<OrganisationUnitGroup> ouGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getOrganisationUnitGroupByName( EquipmentAttributeValue.HEALTHFACILITY ) ); 
         OrganisationUnitGroup ouGroup = null;
         if( ouGroups != null )
@@ -232,6 +310,14 @@
         {
             dataSet = dataSets.get( 0 );
         }
+        
+        
+        Date curDate = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "YYYY" );
+        String curPeriodISOString = simpleDateFormat.format( curDate );
+        Period period = PeriodType.getPeriodFromIsoString( curPeriodISOString );
+        
+        String storedBy = currentUserService.getCurrentUsername() ;
 
         try
         {
@@ -239,6 +325,18 @@
             csvReader.readHeaders();
             String headers[] = csvReader.getHeaders();
 
+            //Creating map for DataElements
+            Map<String, DataElement> dataElementMap = new HashMap<String, DataElement>();
+            for( int i = 8; i < headers.length; i++ )
+            {
+                DataElement dataElement = dataElementService.getDataElementByShortName( headers[i] );
+                if( dataElement != null )
+                {
+                    dataElementMap.put( headers[i], dataElement );
+                }
+            }
+            DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+
             Integer colCount = headers.length;
             while( csvReader.readRecord() )
             {
@@ -247,6 +345,10 @@
                 //Integer ouLevel = Integer.parseInt( csvReader.get( "Level" ) );                         
                 String parentId = csvReader.get( "AdminRegion" );
                 //String ouCode = csvReader.get( "Code" );
+                String gisCoordinates = csvReader.get( "GisCoordinates" );
+                Integer facilityType = Integer.parseInt(  csvReader.get( "FacilityType" ) ) - 1;
+                Integer facilityOwnership = Integer.parseInt( csvReader.get( "FacilityOwnership" ) ) - 1;
+                String contactInfo = csvReader.get( "ContactInformation" );
                 
                 //if( ouCode != null && ouCode.trim().equals("") )
                 //        ouCode = null;
@@ -256,17 +358,146 @@
                 {
                     OrganisationUnit parentOU = orgUnitMap.get( parentId );
                     organisationUnit.setParent( parentOU );
+                    if( gisCoordinates != null && !gisCoordinates.trim().equals( "" ) )
+                    {
+                        organisationUnit.setFeatureType( OrganisationUnit.FEATURETYPE_POINT );
+                        organisationUnit.setCoordinates( "["+gisCoordinates+"]" );
+                    }
+                    
+                    if( contactInfo != null && !contactInfo.trim().equals("") )
+                    {
+                        String[] contactDetails = contactInfo.split( " " );
+                        if( contactDetails!= null )                            
+                        {
+                            if( contactDetails.length == 3 )
+                            {
+                                organisationUnit.setContactPerson( contactDetails[0] );
+                                organisationUnit.setPhoneNumber( contactDetails[1] );
+                                organisationUnit.setEmail( contactDetails[2] );
+                            }
+                            else if( contactDetails.length == 3 )
+                            {
+                                organisationUnit.setContactPerson( contactDetails[0] );
+                                organisationUnit.setPhoneNumber( contactDetails[1] );
+                            }
+                            else
+                            {
+                                organisationUnit.setContactPerson( contactInfo );
+                            }
+                        }
+                    }
+                    
                     int orgUnitId = organisationUnitService.addOrganisationUnit( organisationUnit );
                     orgUnitMap.put( nodeId, organisationUnit );
                     ouGroup.addOrganisationUnit( organisationUnit );
-                    organisationUnitGroupService.updateOrganisationUnitGroup( ouGroup );
+                    //organisationUnitGroupService.updateOrganisationUnitGroup( ouGroup );
+                    
+                    //System.out.println( facilityType + " : " + facilityTypes.get( facilityType ) );
+                    if( facilityType != null )
+                    {
+                        System.out.println( facilityType + " : " + facilityTypes.get( facilityType ) + " : " + orgunitGroups.get( facilityTypes.get( facilityType ) ) );
+                        OrganisationUnitGroup orgUnitGroup = orgunitGroups.get( facilityTypes.get( facilityType ) );
+                        if( orgUnitGroup != null )
+                        {
+                            orgUnitGroup.addOrganisationUnit( organisationUnit );
+                            orgunitGroups.put( facilityTypes.get( facilityType ), orgUnitGroup );
+                            System.out.println( orgUnitGroup.getName() +" Size : " + orgUnitGroup.getMembers().size() );
+                            //organisationUnitGroupService.updateOrganisationUnitGroup( orgUnitGroup );
+                        }
+                    }
+
+                    if( facilityOwnership != null )
+                    {
+                        System.out.println( facilityOwnership + " : " + ownership.get( facilityOwnership ) + " : " + ownershiOrgunitGroups.get( ownership.get( facilityOwnership ) ) );
+                        OrganisationUnitGroup orgUnitGroup = ownershiOrgunitGroups.get( ownership.get( facilityOwnership ) );
+                        if( orgUnitGroup != null )
+                        {
+                            orgUnitGroup.addOrganisationUnit( organisationUnit );
+                            ownershiOrgunitGroups.put( ownership.get( facilityOwnership ), orgUnitGroup );
+                            System.out.println( orgUnitGroup.getName() +" Size : " + orgUnitGroup.getMembers().size() );
+                            //organisationUnitGroupService.updateOrganisationUnitGroup( orgUnitGroup );
+                        }
+                    }
+
                     if( dataSet != null )
                     {
                         dataSet.getSources().add( organisationUnit );                        
                     }
-                }
-            }
-                
+
+                    for( int i = 8; i < headers.length; i++ )
+                    {
+                        DataElement dataElement = dataElementMap.get( headers[i] );
+                        
+                        if( dataElement == null )
+                        {
+                            message += "<br><font color=red>Dataelememnt with the name/shortname : " + headers[i] +" is missing</font><br>";
+                            continue;
+                        }
+                        
+                        String value = null;
+                        if( dataElement.getOptionSet() != null )
+                        {
+                            List<String> lookupOptions = lookupDataMap.get( headers[i] );
+                            if( lookupOptions != null )
+                            {
+                                try
+                                {                                       
+                                    value = lookupOptions.get( Integer.parseInt( csvReader.get( headers[i] ) ) - 1  );
+                                }
+                                catch( Exception e )
+                                {
+                                                
+                                }
+                            }
+                        }
+                        else
+                        {
+                            value = csvReader.get( headers[i] );
+                        }
+                        
+                        DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, decoc );
+                        if ( dataValue == null )
+                        {
+                            if ( value != null )
+                            {
+                                dataValue = new DataValue( dataElement, period, organisationUnit, value, storedBy, curDate, null, decoc );
+                                dataValueService.addDataValue( dataValue );
+                            }
+                        }
+                        else
+                        {
+                            dataValue.setValue( value );
+                            dataValue.setTimestamp( curDate );
+                            dataValue.setStoredBy( storedBy );
+
+                            dataValueService.updateDataValue( dataValue );
+                        }
+                    }
+                }
+            }
+
+            for( String facilityType : facilityTypes )
+            {
+                OrganisationUnitGroup orgUnitGroup = orgunitGroups.get( facilityType );
+                
+                if( orgUnitGroup != null )
+                {
+                    organisationUnitGroupService.updateOrganisationUnitGroup( orgUnitGroup );
+                }
+            }
+
+            for( String ownershipType : ownership )
+            {
+                OrganisationUnitGroup orgUnitGroup = orgunitGroups.get( ownershipType );
+                
+                if( orgUnitGroup != null )
+                {
+                    organisationUnitGroupService.updateOrganisationUnitGroup( orgUnitGroup );
+                }
+            }
+
+            organisationUnitGroupService.updateOrganisationUnitGroup( ouGroup );
+            
             dataSetService.updateDataSet( dataSet );
             
             csvReader.close();                       
@@ -274,8 +505,11 @@
         catch( Exception e )
         {
             e.printStackTrace();
+            message += "<br><font color=red><b>Error while importing Facility.csv " + e.getMessage()+"</b></font><br>";
         }
 
+        message += "<br><font color=black>Importing finished for Facility.csv " + new Date() + " </font><br>";
+        
         return orgUnitMap;
     }
 
@@ -289,38 +523,40 @@
     	
     	List<Integer> ouLevels = new ArrayList<Integer>();
     	
+    	message += "<br><font color=black>Importing started for AdminHierarchy.csv " + new Date() + " </font><br>";
+    	
     	try
     	{
-		CsvReader csvReader = new CsvReader( adminHierarchyCSVFilePath, ',', Charset.forName( "UTF-8" ) );
-		csvReader.readHeaders();
-		String headers[] = csvReader.getHeaders();
-
-		Integer colCount = headers.length;
-		while( csvReader.readRecord() )
-		{
-		    String nodeId = csvReader.get( "NodeID" );
-		    String ouName = csvReader.get( "Name" );
-		    Integer ouLevel = Integer.parseInt( csvReader.get( "Level" ) );    			
-		    String parentId = csvReader.get( "Parent" );
-		    String ouCode = csvReader.get( "Code" );
-			
-		    if( ouCode != null && ouCode.trim().equals("") )
-		        ouCode = null;
-			
-        	    List<OrganisationUnit> tempList = levelwiseOrgunits.get( ouLevel );
-        	    if( tempList == null )
-        	    {
-        	        tempList = new ArrayList<OrganisationUnit>();                        
-        	    }
-            
-        	    OrganisationUnit organisationUnit = new OrganisationUnit( ouName, ouName, ouCode, new Date(), null, true, parentId );
-        	    organisationUnit.setDescription( nodeId );
-        	    orgUnitMap.put( nodeId, organisationUnit );
+    	    CsvReader csvReader = new CsvReader( adminHierarchyCSVFilePath, ',', Charset.forName( "UTF-8" ) );
+    	    csvReader.readHeaders();
+    	    String headers[] = csvReader.getHeaders();
+
+    	    Integer colCount = headers.length;
+    	    while( csvReader.readRecord() )
+    	    {
+    	        String nodeId = csvReader.get( "NodeID" );
+    	        String ouName = csvReader.get( "Name" );
+    	        Integer ouLevel = Integer.parseInt( csvReader.get( "Level" ) );    			
+    	        String parentId = csvReader.get( "Parent" );
+    	        String ouCode = csvReader.get( "Code" );
+
+    	        if( ouCode != null && ouCode.trim().equals("") )
+    	            ouCode = null;
+			
+    	        List<OrganisationUnit> tempList = levelwiseOrgunits.get( ouLevel );
+    	        if( tempList == null )
+    	        {
+    	            tempList = new ArrayList<OrganisationUnit>();                        
+    	        }
+
+    	        OrganisationUnit organisationUnit = new OrganisationUnit( ouName, ouName, ouCode, new Date(), null, true, parentId );
+    	        organisationUnit.setDescription( nodeId );
+    	        orgUnitMap.put( nodeId, organisationUnit );
                           
-        	    tempList.add( organisationUnit );
+    	        tempList.add( organisationUnit );
             
-        	    levelwiseOrgunits.put( ouLevel, tempList );
-		}
+    	        levelwiseOrgunits.put( ouLevel, tempList );
+    	    }
     		
             csvReader.close();
             
@@ -332,31 +568,34 @@
             	List<OrganisationUnit> orgUnits = levelwiseOrgunits.get( ouLevel );
             	for( OrganisationUnit ou : orgUnits )
             	{
-            		String parentId = ou.getComment();
-            		String nodeId = ou.getDescription();
-            		//ou.setComment( null );
-            		//ou.setAlternativeName( null );
-            		if( parentId == null || Integer.parseInt( parentId ) == -1 )
-            		{
-            			parentId = null;
-            			int orgUnitId = organisationUnitService.addOrganisationUnit( ou );
-            			orgUnitMap.put( nodeId, ou );
-            		}
-            		else
-            		{
-            			OrganisationUnit parentOU = orgUnitMap.get( parentId );
-            			ou.setParent( parentOU );
-            			int orgUnitId = organisationUnitService.addOrganisationUnit( ou );
-            			orgUnitMap.put( nodeId, ou );
-            		}
+            	    String parentId = ou.getComment();
+            	    String nodeId = ou.getDescription();
+            	    //ou.setComment( null );
+            	    //ou.setAlternativeName( null );
+            	    if( parentId == null || Integer.parseInt( parentId ) == -1 )
+            	    {
+            	        parentId = null;
+            	        int orgUnitId = organisationUnitService.addOrganisationUnit( ou );
+            	        orgUnitMap.put( nodeId, ou );
+            	    }
+            	    else
+            	    {
+            	        OrganisationUnit parentOU = orgUnitMap.get( parentId );
+            	        ou.setParent( parentOU );
+            	        int orgUnitId = organisationUnitService.addOrganisationUnit( ou );
+            	        orgUnitMap.put( nodeId, ou );
+            	    }
             	}
             }
     	}
         catch( Exception e )
         {
             e.printStackTrace();
+            message += "<br><font color=red><b>Error while importing AdminHierarchy.csv " + e.getMessage()+"</b></font><br>";
         }
 
+    	message += "<br><font color=black>Importing finished for AdminHierarchy.csv " + new Date() + " </font><br>";
+    	
     	return orgUnitMap;
     }
     
@@ -364,6 +603,8 @@
     {
     	refrigeratorDetailsCSVFilePath += File.separator + "Refrigerators.csv";
     	
+    	message += "<br><font color=black>Importing started for Refrigerators.csv " + new Date() + " </font><br>";
+    	
         try
         {
             CsvReader csvReader = new CsvReader( refrigeratorDetailsCSVFilePath, ',', Charset.forName( "UTF-8" ) );
@@ -388,7 +629,8 @@
             	
             	if( tempList == null )
             	{
-            	    System.out.println( "tempList is null for : " + uniqueId );
+            	    //System.out.println( "tempList is null for : " + uniqueId );
+            	    message += "<br><font color=red>Orgunit with the id : " + uniqueId +" is missing</font><br>";
             	    continue;
             	}
             	
@@ -396,7 +638,8 @@
             	
             	if( orgUnit == null )
             	{
-            	    System.out.println(" ********************* " + tempList.get(0) + " IS NULL ********************* ");
+            	    //System.out.println(" ********************* " + tempList.get(0) + " IS NULL ********************* ");
+            	    message += "<br><font color=red>Orgunit with the id : " + tempList.get(0) +" is missing</font><br>";
             	    continue;
             	}
             	
@@ -407,7 +650,8 @@
 	        Model model = refrigeratorModelMap.get( catalogID );
 	        if( model == null )
 	        {
-	            System.out.println( "model is null for : " + catalogID );
+	            //System.out.println( "model is null for : " + catalogID );
+	            message += "<br><font color=red>Catalog with the id : " + catalogID +" is missing</font><br>";
 	            continue;
 	        }
 	        
@@ -451,8 +695,8 @@
                             if( csvReader.get( headers[i] ) != null && !csvReader.get( headers[i] ).trim().equals( "" ) )
                             {
                                 //System.out.print( orgUnit.getName()  + " : " );
-                                System.out.print( equipmentTypeAttribute.getName() + " : " );
-                                System.out.println( csvReader.get( headers[i] ) );
+                                //System.out.print( equipmentTypeAttribute.getName() + " : " );
+                                //System.out.println( csvReader.get( headers[i] ) );
                                 equipmentAttributeValueDetails.setValue( csvReader.get( headers[i] ) );
                                 equipmentAttributeValueDetailsList.add( equipmentAttributeValueDetails );
                             }
@@ -470,17 +714,21 @@
             csvReader.close();
 
         }
-		catch( Exception e )
-		{
-		    e.printStackTrace();
-		}
+	catch( Exception e )
+	{
+	    e.printStackTrace();
+	    message += "<br><font color=red>Error while importing for Refrigerators.csv " + e.getMessage() + " </font><br>";
+	}
 
+        message += "<br><font color=black>Importing finished for Refrigerators.csv " + new Date() + " </font><br>";
     }
     
     public Map<String, Model> importRefrigeratorCatalogData( String refrigeratorCatalogDataCSVFilePath, ModelType refrigeratorModel, Map<String, List<String>> lookupDataMap )
     {
         refrigeratorCatalogDataCSVFilePath += File.separator + "RefrigeratorCatalog.csv";
         
+        message += "<br><font color=black>Importing started for RefrigeratorCatalog.csv " + new Date() + " </font><br>";
+        
         Map<String, Model> refrigeratorModelMap = new HashMap<String, Model>();
         try
         {
@@ -517,7 +765,8 @@
                 
                 if( catalogId == null || catalogId.trim().equals("") || modelName == null || modelName.trim().equals("") )
                 {
-                	continue;
+                    message += "<br><font color=red>Catalog with the id : " + catalogId +"/"+ modelName +" is missing</font><br>";
+                    continue;
                 }
                 
                 Model model = new Model();
@@ -539,28 +788,28 @@
                         
                         if( modelTypeAttribute.getOptionSet() != null )
                         {
-                        	List<String> lookupOptions = lookupDataMap.get( headers[i] );
-                        	if( lookupOptions != null )
-                        	{
-                        	    try
-                        	    {                        	        
-                        		modelAttributeValue.setValue( lookupOptions.get( Integer.parseInt( csvReader.get( headers[i] ) ) - 1  ) );
-                        		modelAttributeValues.add( modelAttributeValue );
-                        	    }
-                        	    catch( Exception e )
-                        	    {
+                            List<String> lookupOptions = lookupDataMap.get( headers[i] );
+                            if( lookupOptions != null )
+                            {
+                                try
+                                {                        	        
+                                    modelAttributeValue.setValue( lookupOptions.get( Integer.parseInt( csvReader.get( headers[i] ) ) - 1  ) );
+                                    modelAttributeValues.add( modelAttributeValue );
+                                }
+                                catch( Exception e )
+                                {
                         			
-                        	    }
-                        	}
-                        	else
-                        	{
-                        		
-                        	}
+                                }
+                            }
+                            else
+                            {
+                        	
+                            }
                         }
                         else
                         {
-                        	modelAttributeValue.setValue( csvReader.get( headers[i] ) );
-                        	modelAttributeValues.add( modelAttributeValue );
+                            modelAttributeValue.setValue( csvReader.get( headers[i] ) );
+                            modelAttributeValues.add( modelAttributeValue );
                         }
                     }
                 }
@@ -580,8 +829,10 @@
         catch( Exception e )
         {
             e.printStackTrace();
+            message += "<br><font color=red>Error while importing for RefrigeratorCatalog.csv " + e.getMessage() + " </font><br>";
         }
         
+        message += "<br><font color=black>Importing finished for RefrigeratorCatalog.csv " + new Date() + " </font><br>";
         return refrigeratorModelMap;
     }
 
@@ -591,6 +842,8 @@
         
         assetListCSVFilePath += File.separator + "AssetList.csv";
         
+        message += "<br><font color=black>Importing started for AssetList.csv " + new Date() + " </font><br>";
+        
         try
         {
             CsvReader csvReader = new CsvReader( assetListCSVFilePath, ',', Charset.forName( "UTF-8" ) );
@@ -612,8 +865,11 @@
         catch( Exception e )
         {
             e.printStackTrace();
+            message += "<br><font color=red><b>Error while importing AssetList.csv " + e.getMessage()+"</b></font><br>";
         }
         
+        message += "<br><font color=black>Importing ended for AssetList.csv " + new Date() + " </font><br>";
+        
         return assetMap;
     }
 
@@ -623,12 +879,32 @@
         
         lookupsCSVFilePath += File.separator + "Lookups.csv";
         
+        message += "<br><font color=black>Importing started for Lookups.csv " + new Date() + " </font><br>";
+        
         try
         {
-            //InputStream in = new FileInputStream( lookupsCSVFilePath );
-            
+            List<String> lookupHeaders = new ArrayList<String>();
+            lookupHeaders.add( "FacilityType" );
+            lookupHeaders.add( "Ownership" );
+            lookupHeaders.add( "StorageType" );
+            lookupHeaders.add( "DeliveryType" );
+            lookupHeaders.add( "ElectricitySource" );
+            lookupHeaders.add( "GridAvailability" );
+            lookupHeaders.add( "FuelAvailability" );
+            lookupHeaders.add( "YesOrNo" );
+            lookupHeaders.add( "TempartureZone" );
+            lookupHeaders.add( "VaccineMode" );
+            lookupHeaders.add( "AssetType" );
+            lookupHeaders.add( "WorkingStatus" );
+            lookupHeaders.add( "ReasonNotWorking" );
+            lookupHeaders.add( "Utilization" );
+            lookupHeaders.add( "PowerSource" );
+            lookupHeaders.add( "RefPowerSource" );
+            lookupHeaders.add( "RefType" );
+            lookupHeaders.add( "StorageTemp" );
+            lookupHeaders.add( "DataSource" );
+                        
             CsvReader csvReader = new CsvReader( lookupsCSVFilePath, ',', Charset.forName( "UTF-8" ) );
-            //CsvReader csvReader = new CsvReader( in, Charset.forName( "UTF-8" ) );
             
             csvReader.readHeaders();
             
@@ -636,11 +912,8 @@
             
             Integer colCount = headers.length;
             
-            //System.out.println( colCount );
-            
             while( csvReader.readRecord() )
             {
-                //System.out.println( csvReader.get(0) );
                 for( int i = 0; i < colCount; i++ )
                 {
                     List<String> tempList = lookupDataMap.get( headers[i] );
@@ -657,9 +930,12 @@
         }
         catch( Exception e )
         {
+            message += "<br><font color=red><b>Error while importing Lookups.csv " + e.getMessage()+"</b></font><br>";
             e.printStackTrace();
         }
         
+        message += "<br><font color=black>Importing ended for Lookups.csv " + new Date() + " </font><br>";
+        
         return lookupDataMap;
     }
 
@@ -689,7 +965,7 @@
                 String individualFileName = ze.getName();
                 File newFile = new File( outputReportPath + File.separator + individualFileName );
 
-                System.out.println( "file unzip : " + newFile.getAbsoluteFile() );
+                //System.out.println( "file unzip : " + newFile.getAbsoluteFile() );
 
                 // create all non exists folders
                 // else you will hit FileNotFoundException for compressed folder

=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml	2013-12-05 11:55:45 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml	2013-12-10 10:44:10 +0000
@@ -755,6 +755,9 @@
         <property name="equipmentService" ref="org.hisp.dhis.coldchain.equipment.EquipmentService" />
         <property name="equipmentTypeAttributeService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService" />
         <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+        <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+        <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+        <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     </bean> 
 		
 	

=== modified file 'local/in/pom.xml'
--- local/in/pom.xml	2013-10-18 05:57:53 +0000
+++ local/in/pom.xml	2013-12-10 10:44:10 +0000
@@ -15,9 +15,11 @@
     <module>dhis-in-services</module>
 	
 	<module>dhis-web-maintenance-in</module>
-	<module>dhis-web-maintenance-ccem</module>
+	<module>dhis-web-maintenance-pbf</module>
+	<module>dhis-web-maintenance-ccem</module>	
 	<module>dhis-web-coldchain</module>
     <module>dhis-web-dataentry-ccem</module>
+	
 
     <!--<module>dhis-web-dashboard</module>
     <module>dhis-web-dataentry-linelisting</module>