dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17785
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7211: first version of dxf2 meta-data export ui (still needs polish)
------------------------------------------------------------
revno: 7211
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 13:36:25 +0200
message:
first version of dxf2 meta-data export ui (still needs polish)
added:
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportMetaDataForm.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.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 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-06-05 15:36:07 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-06-06 11:36:25 +0000
@@ -580,21 +580,6 @@
return true;
}
- private ImportConflict reportLookupConflict( IdentifiableObject object )
- {
- return new ImportConflict( ImportUtils.getDisplayName( object ), "Object does not exist." );
- }
-
- private ImportConflict reportMoreThanOneConflict( IdentifiableObject object )
- {
- return new ImportConflict( ImportUtils.getDisplayName( object ), "More than one object matches identifiers." );
- }
-
- private ImportConflict reportConflict( IdentifiableObject object )
- {
- return new ImportConflict( ImportUtils.getDisplayName( object ), "Object already exists." );
- }
-
private IdentifiableObject findObjectByReference( IdentifiableObject identifiableObject )
{
if ( identifiableObject == null )
@@ -718,6 +703,21 @@
}
}
+ private ImportConflict reportLookupConflict( IdentifiableObject object )
+ {
+ return new ImportConflict( ImportUtils.getDisplayName( object ), "Object does not exist." );
+ }
+
+ private ImportConflict reportMoreThanOneConflict( IdentifiableObject object )
+ {
+ return new ImportConflict( ImportUtils.getDisplayName( object ), "More than one object matches identifiers." );
+ }
+
+ private ImportConflict reportConflict( IdentifiableObject object )
+ {
+ return new ImportConflict( ImportUtils.getDisplayName( object ), "Object already exists." );
+ }
+
private void reportReferenceError( Object object, Object idObject )
{
String referenceName = idObject != null ? idObject.getClass().getSimpleName() : "null";
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-06-05 15:36:07 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-06-06 11:36:25 +0000
@@ -84,61 +84,63 @@
return "export";
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.GET, produces = { "application/xml", "text/*" } )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.GET, produces = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
WebOptions options = new WebOptions( parameters );
MetaData metaData = exportService.getMetaData( options );
- contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "export.xml.zip", true );
+ contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "metaData.xml.zip", true );
response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
- zip.putNextEntry( new ZipEntry( "export.xml" ) );
+ zip.putNextEntry( new ZipEntry( "metaData.xml" ) );
JacksonUtils.toXmlWithView( zip, metaData, ExportView.class );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.GET, produces = "application/json" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".json.zip" }, method = RequestMethod.GET, produces = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
WebOptions options = new WebOptions( parameters );
MetaData metaData = exportService.getMetaData( options );
- contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "export.json.zip", true );
+ contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "metaData.json.zip", true );
response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
- zip.putNextEntry( new ZipEntry( "export.json" ) );
+ zip.putNextEntry( new ZipEntry( "metaData.json" ) );
JacksonUtils.toJsonWithView( zip, metaData, ExportView.class );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".gz", method = RequestMethod.GET, produces = { "application/xml", " text/*" } )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz" }, method = RequestMethod.GET, produces = { "application/xml", " text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
WebOptions options = new WebOptions( parameters );
MetaData metaData = exportService.getMetaData( options );
- response.setContentType( CONTENT_TYPE_GZIP );
+ contextUtils.configureResponse( response, CONTENT_TYPE_GZIP, CacheStrategy.NO_CACHE, "metaData.xml.gz", true );
+ response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
+
GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );
-
JacksonUtils.toXmlWithView( gzip, metaData, ExportView.class );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".gz", method = RequestMethod.GET, produces = { "application/json" } )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".json.gz"} , method = RequestMethod.GET, produces = { "application/json" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
WebOptions options = new WebOptions( parameters );
MetaData metaData = exportService.getMetaData( options );
- response.setContentType( CONTENT_TYPE_GZIP );
+ contextUtils.configureResponse( response, CONTENT_TYPE_GZIP, CacheStrategy.NO_CACHE, "metaData.json.gz", true );
+ response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
+
GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );
-
JacksonUtils.toJsonWithView( gzip, metaData, ExportView.class );
}
@@ -170,7 +172,7 @@
JacksonUtils.toJson( response.getOutputStream(), summary );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
{
@@ -185,7 +187,7 @@
JacksonUtils.toXml( response.getOutputStream(), summary );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.POST, consumes = "application/json" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".json.zip" }, method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
@@ -201,7 +203,7 @@
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".gz", method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importGZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
{
@@ -215,7 +217,7 @@
JacksonUtils.toXml( response.getOutputStream(), summary );
}
- @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".gz", method = RequestMethod.POST, consumes = "application/json" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".json.gz"}, method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importGZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
=== added directory 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2'
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportAction.java 2012-06-06 11:36:25 +0000
@@ -0,0 +1,69 @@
+package org.hisp.dhis.importexport.action.dxf2;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MetaDataExportAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Map<String, String> exportClasses = new LinkedHashMap<String, String>();
+
+ public Map<String, String> getExportClasses()
+ {
+ return exportClasses;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute() throws Exception
+ {
+ for ( String key : ExchangeClasses.getExportMap().values() )
+ {
+ String[] camelCaseWords = StringUtils.capitalize( key ).split( "(?=[A-Z])" );
+ exportClasses.put( key, StringUtils.join( camelCaseWords, " " ) );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java 2012-06-06 11:36:25 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.importexport.action.dxf2;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MetaDataImportAction implements Action
+{
+ @Override
+ public String execute() throws Exception
+ {
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-04-16 15:12:08 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-06-06 11:36:25 +0000
@@ -166,4 +166,15 @@
<bean id="org.hisp.dhis.importexport.action.integration.AddRouteAction" class="org.hisp.dhis.importexport.action.integration.AddRouteAction">
<property name="builtinCamelContext" ref="camel-builtin"/>
</bean>
+
+ <!-- DXF2 MetaData import/export -->
+
+ <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction">
+
+ </bean>
+
+ <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataExportAction" class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportAction">
+
+ </bean>
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2012-05-07 14:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2012-06-06 11:36:25 +0000
@@ -306,4 +306,7 @@
more_options=More options
existing_record_check=Existing record check
check_safe_recommended=Check (safe + recommended)
-skip_check_fast=Skip check (fast)
\ No newline at end of file
+skip_check_fast=Skip check (fast)
+dxf2=DXF2
+dxf2_metadata_import=MetaData Import
+dxf2_metadata_export=MetaData Export
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-04-16 15:12:08 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-06-06 11:36:25 +0000
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
-"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
-"http://struts.apache.org/dtds/struts-2.0.dtd">
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="dhis-web-commons.xml" />
@@ -15,32 +15,32 @@
</action>
<!-- Data value import -->
-
- <action name="displayImportDataValueForm" class="org.hisp.dhis.importexport.action.NoAction">
+
+ <action name="displayImportDataValueForm" class="org.hisp.dhis.importexport.action.NoAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-importexport/importDataValue.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
- <param name="javascripts">javascript/importDataValue.js</param>
- </action>
-
- <action name="importDataValue" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction">
- <result name="success" type="redirect">displayImportDataValueForm.action?running=true&importFormat=${importFormat}</result>
- <interceptor-ref name="fileUploadStack" />
- </action>
-
- <action name="getDataValueImportSummary" class="org.hisp.dhis.importexport.action.GetImportSummaryAction">
+ <param name="javascripts">javascript/importDataValue.js</param>
+ </action>
+
+ <action name="importDataValue" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction">
+ <result name="success" type="redirect">displayImportDataValueForm.action?running=true&importFormat=${importFormat}</result>
+ <interceptor-ref name="fileUploadStack" />
+ </action>
+
+ <action name="getDataValueImportSummary" class="org.hisp.dhis.importexport.action.GetImportSummaryAction">
<result name="success" type="velocity">/dhis-web-importexport/importSummary.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
<!-- Data value export -->
-
+
<action name="displayDataValueExportForm" class="org.hisp.dhis.importexport.action.NoAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-importexport/exportDataValueForm.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/export.js</param>
- </action>
+ </action>
<action name="exportDataValue" class="org.hisp.dhis.importexport.action.datavalue.ExportDataValueAction">
<result name="success" type="outputStreamResult" />
@@ -59,7 +59,7 @@
<param name="page">/dhis-web-importexport/externalExportMenu.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
</action>
-
+
<!-- Import -->
<action name="setImportFormat" class="org.hisp.dhis.importexport.action.imp.SetImportTypeAction">
@@ -94,7 +94,7 @@
<param name="page">/dhis-web-importexport/importAnalysisForm.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
</action>
-
+
<!-- Object Ajax -->
<action name="discardObjectAjax" class="org.hisp.dhis.importexport.action.object.DiscardObjectAction">
@@ -108,7 +108,7 @@
<result name="error" type="velocity-xml">/dhis-web-importexport/responseError.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
+
<!-- Preview -->
<action name="displayPreviewForm" class="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction">
@@ -153,7 +153,7 @@
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
<param name="javascripts">javascript/import.js</param>
</action>
-
+
<!-- Export -->
<action name="displayMetaDataExportForm" class="org.hisp.dhis.importexport.action.NoAction">
@@ -163,7 +163,8 @@
<param name="javascripts">javascript/export.js</param>
</action>
- <action name="displayDetailedMetaDataExportForm" class="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction">
+ <action name="displayDetailedMetaDataExportForm"
+ class="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-importexport/exportDetailedMetaDataForm.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
@@ -198,7 +199,8 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="validateAggregatedExport" class="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction">
+ <action name="validateAggregatedExport"
+ class="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction">
<result name="success" type="velocity-xml">/dhis-web-importexport/responseSuccess.vm</result>
<result name="error" type="velocity-xml">/dhis-web-importexport/responseError.vm</result>
<param name="onExceptionReturn">plainTextError</param>
@@ -206,7 +208,8 @@
<!-- Dhis 1.4 Configuration -->
- <action name="displayConfigDhis14Form" class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction">
+ <action name="displayConfigDhis14Form"
+ class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-importexport/configDhis14Form.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
@@ -217,7 +220,8 @@
<result name="success" type="redirect">setImportFormat.action?importFormat=DHIS14FILE</result>
</action>
- <action name="validateConfigDhis14" class="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction">
+ <action name="validateConfigDhis14"
+ class="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction">
<result name="success" type="velocity-xml">/dhis-web-importexport/responseSuccess.vm</result>
<result name="input" type="velocity-xml">/dhis-web-importexport/responseInput.vm</result>
</action>
@@ -243,6 +247,22 @@
<param name="javascripts" />
</action>
+ <!-- DXF2 MetaData import/export -->
+
+ <action name="dxf2MetaDataImport" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="menu">/dhis-web-importexport/mainMenu.vm</param>
+ <param name="page">/dhis-web-importexport/dxf2MetaDataImport.vm</param>
+ <param name="javascripts" />
+ </action>
+
+ <action name="dxf2MetaDataExport" class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="menu">/dhis-web-importexport/mainMenu.vm</param>
+ <param name="page">/dhis-web-importexport/dxf2MetaDataExport.vm</param>
+ <param name="javascripts" />
+ </action>
+
</package>
</struts>
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm 2012-06-06 11:36:25 +0000
@@ -0,0 +1,91 @@
+<script type="text/javascript">
+ jQuery(document).ready(function () {
+ selectAll();
+ });
+
+ function selectAll()
+ {
+ $("#exportForm").find("input:checkbox").attr("checked", true);
+ }
+
+ function selectNone()
+ {
+ $("#exportForm").find("input:checkbox").attr("checked", false);
+ }
+
+ function exportMetaData()
+ {
+ var url = "../api/metaData";
+ var format = $("#format").val();
+ var compression = $("#compression").val();
+
+ url += "." + format;
+
+ if(compression == "zip")
+ {
+ url += ".zip";
+ }
+ else if(compression == "gz")
+ {
+ url += ".gz";
+ }
+
+ url += "?assumeTrue=false&" + $("#exportForm").serialize();
+
+ log("url" + url);
+
+ window.location=url;
+ }
+</script>
+
+<h3>$i18n.getString( "dxf2_metadata_export" )</h3>
+
+<form id="exportForm" name="exportForm">
+<table>
+<tr>
+ <th colspan="2">$i18n.getString( "elements" )</th>
+</tr>
+
+#foreach( $key in $exportClasses.keySet() )
+<tr>
+ <td><input id="$key" name="$key" type="checkbox" value="true" /></td>
+ <td><label for="$key">$exportClasses.get( $key )</label></td>
+</tr>
+#end
+
+<tr>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'select_all' )" style="width:100px;" onclick="selectAll();" />
+ <input type="button" value="$i18n.getString( 'select_none' )" style="width:100px;" onclick="selectNone();" />
+ </td>
+</tr>
+
+<tr>
+ <td colspan="2">
+ <select id="format" style="width: 204px;">
+ <option value="xml">XML</option>
+ <option value="json">Json</option>
+ </select>
+ </td>
+</tr>
+
+<tr>
+ <td colspan="2">
+ <select id="compression" style="width: 204px;">
+ <option value="zip">Zipped</option>
+ <option value="gz">GZipped</option>
+ <option value="uncompressed">Uncompressed</option>
+ </select>
+ </td>
+</tr>
+
+<tr>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'export' )" style="width:204px;" onclick="exportMetaData();" />
+ </td>
+</tr>
+
+</table>
+</form>
+
+<span id="message"></span>
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm 2012-06-06 11:36:25 +0000
@@ -0,0 +1,1 @@
+Import is WIP!
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportMetaDataForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportMetaDataForm.vm 2011-04-24 12:47:31 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportMetaDataForm.vm 2012-06-06 11:36:25 +0000
@@ -16,7 +16,7 @@
</colgroup>
<!-- Elements -->
-
+
<tr>
<th colspan="2">$i18n.getString( "elements" )</th>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm 2012-04-27 15:37:20 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm 2012-06-06 11:36:25 +0000
@@ -29,3 +29,9 @@
<li><a href="displayRoutes.action">$i18n.getString( "integration_configuration" ) </a></li>
</ul>
+<h2>$i18n.getString( "dxf2" ) </h2>
+
+<ul>
+ <li><a href="dxf2MetaDataExport.action">$i18n.getString( "dxf2_metadata_export" ) </a></li>
+ <li><a href="dxf2MetaDataImport.action">$i18n.getString( "dxf2_metadata_import" ) </a></li>
+</ul>