dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18135
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7523: meta-data import summary
------------------------------------------------------------
revno: 7523
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-07-06 10:01:27 +0200
message:
meta-data import summary
added:
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/GetImportSummaryAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importMetaDataSummary.vm
modified:
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/struts.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
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/GetImportSummaryAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/GetImportSummaryAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/GetImportSummaryAction.java 2012-07-06 08:01:27 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.importexport.action.dxf2;
+
+/*
+ * Copyright (c) 2011, 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.hisp.dhis.dxf2.metadata.ImportSummary;
+import org.hisp.dhis.scheduling.TaskCategory;
+import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.system.notification.Notifier;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class GetImportSummaryAction
+ implements Action
+{
+ @Autowired
+ private Notifier notifier;
+
+ @Autowired
+ private CurrentUserService currentUserService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private TaskCategory category;
+
+ public void setCategory( TaskCategory category )
+ {
+ this.category = category;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private ImportSummary summary;
+
+ public ImportSummary getSummary()
+ {
+ return summary;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ TaskId taskId = new TaskId( category, currentUserService.getCurrentUser() );
+
+ summary = (ImportSummary) notifier.getTaskSummary( taskId, category );
+
+ 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-07-04 20:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-07-06 08:01:27 +0000
@@ -201,8 +201,8 @@
<bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction"
class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" scope="prototype" />
- <bean id="org.hisp.dhis.importexport.action.GetMetaDataImportSummaryAction"
- class="org.hisp.dhis.importexport.action.GetImportSummaryAction" scope="prototype">
+ <bean id="org.hisp.dhis.importexport.action.dxf2.GetImportSummaryAction"
+ class="org.hisp.dhis.importexport.action.dxf2.GetImportSummaryAction" scope="prototype">
<property name="category" value="METADATA_IMPORT" />
</bean>
=== 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-07-04 20:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-07-06 08:01:27 +0000
@@ -268,8 +268,8 @@
<interceptor-ref name="fileUploadStack" />
</action>
- <action name="getMetaDataImportSummary" class="org.hisp.dhis.importexport.action.GetMetaDataImportSummaryAction">
- <result name="success" type="velocity">/dhis-web-importexport/importSummary.vm</result>
+ <action name="getMetaDataImportSummary" class="org.hisp.dhis.importexport.action.dxf2.GetImportSummaryAction">
+ <result name="success" type="velocity">/dhis-web-importexport/importMetaDataSummary.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importMetaDataSummary.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importMetaDataSummary.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importMetaDataSummary.vm 2012-07-06 08:01:27 +0000
@@ -0,0 +1,32 @@
+<h3>$i18n.getString( "import_summary" )</h3>
+
+<h4>Counts</h4>
+
+$summary.importCount.imported Imported<br/>
+$summary.importCount.updated Updated<br/>
+$summary.importCount.ignored Ignored<br/>
+
+<h4>Type Summary</h4>
+
+<table>
+ <thead>
+ <tr>
+ <td>Type</td>
+ <td>Imported</td>
+ <td>Updated</td>
+ <td>Ignored</td>
+ <td>Conflicts</td>
+ </tr>
+ </thead>
+ <tbody>
+ #foreach( $typeSummary in $summary.importTypeSummaries )
+ <tr>
+ <td>$typeSummary.type</td>
+ <td>$typeSummary.importCount.imported</td>
+ <td>$typeSummary.importCount.updated</td>
+ <td>$typeSummary.importCount.ignored</td>
+ <td>$typeSummary.conflicts.size()</td>
+ </tr>
+ #end
+ </tbody>
+</table>
\ No newline at end of file