dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26306
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13033: CCEI: work in progress CSV Import functionality
------------------------------------------------------------
revno: 13033
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-11-27 12:27:57 +0000
message:
CCEI: work in progress CSV Import functionality
added:
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/
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/webapp/dhis-web-maintenance-ccem/csvImportResult.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelTypeAttributeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelTypeAttributeStore.java
local/in/dhis-web-maintenance-ccem/pom.xml
local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/importDataForm.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/model/ModelService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelService.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelService.java 2013-11-27 12:27:57 +0000
@@ -21,6 +21,8 @@
Model getModelByName( String name );
+ Model getModelByDescription( String description );
+
Collection<Model> getModels( ModelType modelType );
int createModel( Model model, List<ModelAttributeValue> modelAttributeValues );
@@ -40,7 +42,6 @@
Collection<Model> getModelsBetweenByName( String name, int first, int max );
-
int getCountModel( ModelType modelType );
Collection<Model> getModels( ModelType modelType, int min, int max );
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelStore.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelStore.java 2013-11-27 12:27:57 +0000
@@ -18,6 +18,8 @@
Model getModel( int id );
Model getModelByName( String name );
+
+ Model getModelByDescription( String description );
Collection<Model> getAllModels();
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeService.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeService.java 2013-11-27 12:27:57 +0000
@@ -16,6 +16,8 @@
ModelTypeAttribute getModelTypeAttributeByName( String name );
+ ModelTypeAttribute getModelTypeAttributeByDescription( String description );
+
//ModelType getModelTypeByAttribute( ModelType modelType, ModelTypeAttribute modelTypeAttribute);
Collection<ModelTypeAttribute> getAllModelTypeAttributes();
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeStore.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttributeStore.java 2013-11-27 12:27:57 +0000
@@ -19,6 +19,8 @@
ModelTypeAttribute getModelTypeAttributeByName( String name );
+ ModelTypeAttribute getModelTypeAttributeByDescription( String description );
+
Collection<ModelTypeAttribute> getAllModelTypeAttributes();
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelService.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelService.java 2013-11-27 12:27:57 +0000
@@ -102,6 +102,12 @@
}
@Override
+ public Model getModelByDescription( String description )
+ {
+ return modelStore.getModelByDescription( description );
+ }
+
+ @Override
public int createModel( Model model, List<ModelAttributeValue> modelAttributeValues )
{
int modelId = addModel( model );
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelTypeAttributeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelTypeAttributeService.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/DefaultModelTypeAttributeService.java 2013-11-27 12:27:57 +0000
@@ -105,6 +105,12 @@
return modelTypeAttributeStore.getModelTypeAttributeByName( name );
}
+
+ public ModelTypeAttribute getModelTypeAttributeByDescription( String description )
+ {
+ return modelTypeAttributeStore.getModelTypeAttributeByDescription( description );
+ }
+
//Methods
public int getModelTypeAttributeCount()
{
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelStore.java 2013-10-18 05:57:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelStore.java 2013-11-27 12:27:57 +0000
@@ -36,6 +36,12 @@
}
@Override
+ public Model getModelByDescription( String description )
+ {
+ return (Model) getCriteria( Restrictions.eq( "description", description ) ).uniqueResult();
+ }
+
+ @Override
@SuppressWarnings( "unchecked" )
public Collection<Model> getAllModels()
{
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelTypeAttributeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelTypeAttributeStore.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/model/hibernate/HibernateModelTypeAttributeStore.java 2013-11-27 12:27:57 +0000
@@ -87,6 +87,13 @@
*/
}
+
+ @Override
+ public ModelTypeAttribute getModelTypeAttributeByDescription( String description )
+ {
+ return (ModelTypeAttribute) getCriteria( Restrictions.eq( "description", description ) ).uniqueResult();
+ }
+
@SuppressWarnings( "unchecked" )
public Collection<ModelTypeAttribute> getAllModelTypeAttributes()
{
=== modified file 'local/in/dhis-web-maintenance-ccem/pom.xml'
--- local/in/dhis-web-maintenance-ccem/pom.xml 2013-11-25 07:09:17 +0000
+++ local/in/dhis-web-maintenance-ccem/pom.xml 2013-11-27 12:27:57 +0000
@@ -25,10 +25,11 @@
<dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
<!-- DHIS -->
<dependency>
@@ -40,7 +41,6 @@
<artifactId>dhis-service-core</artifactId>
</dependency>
-
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-commons</artifactId>
@@ -50,11 +50,11 @@
<artifactId>dhis-web-commons-resources</artifactId>
<type>war</type>
</dependency>
- <!--<dependency>
+ <dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-aggregationengine-default</artifactId>
<version>${project.version}</version>
- </dependency>-->
+ </dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-support-external</artifactId>
@@ -74,23 +74,30 @@
<artifactId>dhis-in-service-coldchain</artifactId>
<version>${project.version}</version>
</dependency>
+
<!-- Other -->
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
</dependency>
-
- <dependency>
- <groupId>ar.com.fdvs</groupId>
- <artifactId>DynamicJasper</artifactId>
- <version>4.0.0</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.opencsv</groupId>
+ <dependency>
+ <groupId>ar.com.fdvs</groupId>
+ <artifactId>DynamicJasper</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
+ -->
+
+ <dependency>
+ <groupId>net.sourceforge.javacsv</groupId>
+ <artifactId>javacsv</artifactId>
+ </dependency>
+
</dependencies>
<properties>
<rootDir>../../</rootDir>
=== added directory 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport'
=== added directory 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action'
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/importexport/action/CSVImportAction.java 2013-11-27 12:27:57 +0000
@@ -0,0 +1,324 @@
+package org.hisp.dhis.ccem.importexport.action;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.hisp.dhis.coldchain.model.Model;
+import org.hisp.dhis.coldchain.model.ModelAttributeValue;
+import org.hisp.dhis.coldchain.model.ModelAttributeValueService;
+import org.hisp.dhis.coldchain.model.ModelService;
+import org.hisp.dhis.coldchain.model.ModelType;
+import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
+import org.hisp.dhis.coldchain.model.ModelTypeAttributeOption;
+import org.hisp.dhis.coldchain.model.ModelTypeAttributeService;
+import org.hisp.dhis.coldchain.model.ModelTypeService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.web.bind.annotation.ModelAttribute;
+
+import com.csvreader.CsvReader;
+import com.opensymphony.xwork2.Action;
+
+public class CSVImportAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private ModelTypeAttributeService modelTypeAttributeService;
+
+ public void setModelTypeAttributeService( ModelTypeAttributeService modelTypeAttributeService )
+ {
+ this.modelTypeAttributeService = modelTypeAttributeService;
+ }
+
+ private ModelService modelService;
+
+ public void setModelService( ModelService modelService )
+ {
+ this.modelService = modelService;
+ }
+
+ private ModelTypeService modelTypeService;
+
+ public void setModelTypeService( ModelTypeService modelTypeService )
+ {
+ this.modelTypeService = modelTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getter & Setter
+ // -------------------------------------------------------------------------
+
+ private File upload;
+
+ public void setUpload( File upload )
+ {
+ this.upload = upload;
+ }
+
+ private String fileName;
+
+ public void setUploadFileName( String fileName )
+ {
+ this.fileName = fileName;
+ }
+
+ private String fileFormat;
+
+ public void setFileFormat( String fileFormat )
+ {
+ this.fileFormat = fileFormat;
+ }
+
+ private String message = "";
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ throws Exception
+ {
+ message += "<br><font color=blue>Importing StartTime : " + new Date() + " - By " + currentUserService.getCurrentUsername() + "</font><br>";
+
+ try
+ {
+ ZipInputStream zis = new ZipInputStream( new FileInputStream( upload ) );
+
+ String uncompressedFolderPath = unZip( zis );
+
+ Map<String, List<String>> lookupDataMap = getLookupData( uncompressedFolderPath );
+
+ /**
+ * TODO - Need to use parameter / constant for timebeing directly used name
+ */
+ ModelType refrigeratorModel = modelTypeService.getModelTypeByName( "Refrigerator Catalog" );
+
+ importRefrigeratorCatalogData( uncompressedFolderPath, refrigeratorModel );
+
+ /*
+ for( String lookupKey : lookupDataMap.keySet() )
+ {
+ //System.out.println( "******************** "+ lookupKey + " ***************");
+ for( String lookupVal : lookupDataMap.get( lookupKey ) )
+ {
+ System.out.println( lookupVal );
+ }
+ }
+ */
+
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ message += "<br><font color=red><strong>Please check the file format : " + fileName + "<br>Detailed Log Message: " + e.getMessage() + "</font></strong>";
+ }
+
+ message += "<br><br><font color=blue>Importing EndTime : " + new Date() + " - By " + currentUserService.getCurrentUsername() + "</font>";
+
+ return SUCCESS;
+ }
+
+ public void importRefrigeratorCatalogData( String refrigeratorCatalogDataCSVFilePath, ModelType refrigeratorModel )
+ {
+ refrigeratorCatalogDataCSVFilePath += File.separator + "RefrigeratorCatalog.csv";
+
+ try
+ {
+ CsvReader csvReader = new CsvReader( refrigeratorCatalogDataCSVFilePath, ',', Charset.forName( "UTF-8" ) );
+
+ csvReader.readHeaders();
+
+ Map<String, ModelTypeAttribute> modelTypeAttributeMap = new HashMap<String, ModelTypeAttribute>();
+ String headers[] = csvReader.getHeaders();
+ for( int i = 0; i < headers.length; i++ )
+ {
+ ModelTypeAttribute modelTypeAttribute = modelTypeAttributeService.getModelTypeAttributeByDescription( headers[i] );
+ //Model model = modelTypeAttributeService.getM.getModelByDescription( headers[i] );
+ modelTypeAttributeMap.put( headers[i], modelTypeAttribute );
+ }
+
+ Integer colCount = headers.length;
+
+ while( csvReader.readRecord() )
+ {
+
+ String catalogId = csvReader.get( "CatalogID" );
+ String modelName = csvReader.get( "ModelName" );
+ String manufacturer = csvReader.get( "Manufacturer" );
+ String refPowerSource = csvReader.get( "RefPowerSource" );
+ String refType = csvReader.get( "RefType" );
+ String climateZone = csvReader.get( "ClimateZone" );
+ String dataSource = csvReader.get( "DataSource" );
+ String refGrossVolume = csvReader.get( "RefGrossVolume" );
+ String refNetVolume = csvReader.get( "RefNetVolume" );
+ String freezeGrossVolume = csvReader.get( "FreezeGrossVolume" );
+ String freezeNetVolume = csvReader.get( "FreezeNetVolume" );
+
+
+ Model model = new Model();
+ model.setName( catalogId + " + " + modelName );
+ model.setDescription( catalogId + " + " + modelName );
+ model.setModelType( refrigeratorModel );
+
+ List<ModelAttributeValue> modelAttributeValues = new ArrayList<ModelAttributeValue>();
+
+ for( int i = 0; i < headers.length; i++ )
+ {
+ ModelTypeAttribute modelTypeAttribute = modelTypeAttributeMap.get( headers[i] );
+
+ if ( modelTypeAttribute != null )
+ {
+ ModelAttributeValue modelAttributeValue = new ModelAttributeValue();
+ modelAttributeValue.setModel( model );
+ modelAttributeValue.setModelTypeAttribute( modelTypeAttribute );
+ modelAttributeValue.setValue( csvReader.get( headers[i] ) );
+
+ modelAttributeValues.add( modelAttributeValue );
+
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // Save model
+ // -------------------------------------------------------------------------
+
+ Integer id = modelService.createModel( model, modelAttributeValues );
+
+ }
+
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public Map<String, List<String>> getLookupData( String lookupsCSVFilePath )
+ {
+ Map<String, List<String>> lookupDataMap = new HashMap<String, List<String>>();
+
+ lookupsCSVFilePath += File.separator + "Lookups.csv";
+
+ try
+ {
+ //InputStream in = new FileInputStream( lookupsCSVFilePath );
+
+ CsvReader csvReader = new CsvReader( lookupsCSVFilePath, ',', Charset.forName( "UTF-8" ) );
+ //CsvReader csvReader = new CsvReader( in, Charset.forName( "UTF-8" ) );
+
+ csvReader.readHeaders();
+
+ String headers[] = csvReader.getHeaders();
+
+ 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] );
+ if( tempList == null )
+ {
+ tempList = new ArrayList<String>();
+ }
+ tempList.add( csvReader.get( headers[i] ) );
+ lookupDataMap.put( headers[i], tempList );
+ }
+ }
+
+ csvReader.close();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return lookupDataMap;
+ }
+
+ public String unZip( ZipInputStream zis )
+ {
+ byte[] buffer = new byte[1024];
+
+ String outputReportPath = "";
+
+ try
+ {
+ outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + "temp";
+
+ File newdir = new File( outputReportPath );
+ if( !newdir.exists() )
+ {
+ newdir.mkdirs();
+ }
+ outputReportPath += File.separator + UUID.randomUUID().toString();
+
+ //ZipInputStream zis = new ZipInputStream( new FileInputStream( zipFile ) );
+
+ ZipEntry ze = zis.getNextEntry();
+
+ while ( ze != null )
+ {
+ String individualFileName = ze.getName();
+ File newFile = new File( outputReportPath + File.separator + individualFileName );
+
+ System.out.println( "file unzip : " + newFile.getAbsoluteFile() );
+
+ // create all non exists folders
+ // else you will hit FileNotFoundException for compressed folder
+ new File( newFile.getParent() ).mkdirs();
+
+ FileOutputStream fos = new FileOutputStream( newFile );
+
+ int len;
+ while ( (len = zis.read( buffer )) > 0 )
+ {
+ fos.write( buffer, 0, len );
+ }
+
+ fos.close();
+ ze = zis.getNextEntry();
+ }
+
+ zis.closeEntry();
+
+ zis.close();
+ }
+ catch ( IOException ex )
+ {
+ ex.printStackTrace();
+ }
+
+ return outputReportPath;
+ }
+}
=== 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-09-30 12:17:15 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml 2013-11-27 12:27:57 +0000
@@ -740,4 +740,16 @@
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
<!--<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />-->
</bean>
+
+ <!-- Import / Export -->
+ <bean id="org.hisp.dhis.ccem.importexport.action.CSVImportAction"
+ class="org.hisp.dhis.ccem.importexport.action.CSVImportAction"
+ scope="prototype">
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="modelTypeAttributeService" ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
+ <property name="modelService" ref="org.hisp.dhis.coldchain.model.ModelService" />
+ <property name="modelTypeService" ref="org.hisp.dhis.coldchain.model.ModelTypeService" />
+ </bean>
+
+
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml 2013-11-25 07:09:17 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml 2013-11-27 12:27:57 +0000
@@ -674,7 +674,7 @@
</action>
<!--<result name="success" type="redirect">programStage.action?id=${modelTypeId}</result>-->
-
+
<!-- Transfer Facility Data -->
<action name="transferFacilityDataForm" class="org.hisp.dhis.ccem.transferfacilitydata.action.TraferFacilityDataFormAction">
<result name="success" type="velocity">/main.vm</result>
@@ -683,19 +683,26 @@
<param name="javascripts">javascript/transferFacilityData.js</param>
<param name="requiredAuthorities">F_TRANSFER_FACILITY_DATA</param>
</action>
-
+
<action name="transferFacilityDataResult" class="org.hisp.dhis.ccem.transferfacilitydata.action.TraferFacilityDataResultAction">
<result name="success" type="velocity">/content.vm</result>
<param name="page">/dhis-web-maintenance-ccem/transferFacilityDataResult.vm</param>
<param name="requiredAuthorities">F_TRANSFER_FACILITY_DATA</param>
</action>
-
+
<!-- Import ColdChain Data -->
<action name="importDataForm" class="org.hisp.dhis.ccem.action.NoAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-ccem/importDataForm.vm</param>
<param name="menu">/dhis-web-maintenance-ccem/menu.vm</param>
</action>
+
+ <action name="importCSVData" class="org.hisp.dhis.ccem.importexport.action.CSVImportAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-ccem/csvImportResult.vm</param>
+ <param name="menu">/dhis-web-maintenance-ccem/menu.vm</param>
+ <interceptor-ref name="fileUploadStack"/>
+ </action>
</package>
</struts>
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/csvImportResult.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/csvImportResult.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/csvImportResult.vm 2013-11-27 12:27:57 +0000
@@ -0,0 +1,14 @@
+
+<br/>
+<div style="font-size:16px; width:70%; margin:auto;" class="ui-widget-header ui-corner-all"><b>$i18n.getString( "offline_data_upload_result" )</b></div>
+<div id="reportFilterDiv" style="width:70%; margin:auto; border-width: 1px;background-color:#E0ECF8;border-color: #A9D0F5; display:block;">
+<table>
+ <tr>
+ <td><input type="button" value="Back" onclick="window.location.href='importDataForm.action'" /></td>
+ </tr>
+ <tr>
+ <td>$message</td>
+ </tr>
+</table>
+</div>
+</div>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/importDataForm.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/importDataForm.vm 2013-11-25 07:09:17 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/importDataForm.vm 2013-11-27 12:27:57 +0000
@@ -17,12 +17,12 @@
}
</script>
<h3>$i18n.getString( "Import Data" )</h3>
-<form id="dataImportForm" name="dataImportForm" method="post" enctype="multipart/form-data" action="#" onsubmit="return Checkfiles();">
+<form id="dataImportForm" name="dataImportForm" method="post" enctype="multipart/form-data" action="importCSVData.action" >
<table style="width:60%">
<tr >
<td >
Upload CSV File :<br><br>
- <input type="file" id="importData" name="importData" size="45" class="{validate:{required:true}}">
+ <input type="file" id="upload" name="upload" size="45" class="{validate:{required:true}}">
</td>
<td>
<div class="ui-widget-content ui-corner-all" style="padding:10px 10px 10px 30px;">
@@ -41,8 +41,7 @@
<input type="submit" name="importReport" value="Upload Data" style="width:325px">
</td>
<td> </td>
- </tr>
-
+ </tr>
</table>
</form>