dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08144
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2426: Add missing file for Patient datavalue archive.
------------------------------------------------------------
revno: 2426
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-10-25 13:11:22 +0700
message:
Add missing file for Patient datavalue archive.
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/patientDataArchiveForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java 2010-10-25 06:11:22 +0000
@@ -0,0 +1,123 @@
+package org.hisp.dhis.dataadmin.action.dataarchive;
+
+/*
+ * Copyright (c) 2004-2010, 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 java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataarchive.DataArchiveOperation;
+import org.hisp.dhis.dataarchive.DataArchiveService;
+import org.hisp.dhis.dataarchive.DataEliminationStrategy;
+import org.hisp.dhis.system.util.DateUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ */
+public class ArchivePatientDataAction
+ implements Action
+{
+ private static final Log log = LogFactory.getLog( ArchivePatientDataAction.class );
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataArchiveService dataArchiveService;
+
+ public void setDataArchiveService( DataArchiveService dataArchiveService )
+ {
+ this.dataArchiveService = dataArchiveService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String startDate;
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ private String endDate;
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
+
+ private String operation;
+
+ public void setOperation( String operation )
+ {
+ this.operation = operation;
+ }
+
+ private String strategy;
+
+ public void setStrategy( String strategy )
+ {
+ this.strategy = strategy;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private int number;
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ Date startDate_ = DateUtils.getMediumDate( startDate );
+
+ Date endDate_ = DateUtils.getMediumDate( endDate );
+
+ DataArchiveOperation operation_ = DataArchiveOperation.valueOf( operation.toUpperCase() );
+
+ DataEliminationStrategy strategy_ = DataEliminationStrategy.valueOf( strategy.toUpperCase() );
+
+ log.info( "Archiving: start date: " + startDate + ", end date: " + endDate + ", operation: " + operation + ", strategy: " + strategy );
+
+ number = dataArchiveService.archivePatientData( startDate_, endDate_, operation_, strategy_ );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java 2010-10-25 06:11:22 +0000
@@ -0,0 +1,72 @@
+package org.hisp.dhis.dataadmin.action.dataarchive;
+
+/*
+ * Copyright (c) 2004-2010, 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 org.hisp.dhis.dataarchive.DataArchiveService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class GetNumberOfOverlapingPatientValuesAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataArchiveService dataArchiveService;
+
+ public void setDataArchiveService( DataArchiveService dataArchiveService )
+ {
+ this.dataArchiveService = dataArchiveService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ private int number;
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ number = dataArchiveService.getNumberOfOverlappingPatientValues();
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/patientDataArchiveForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/patientDataArchiveForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/patientDataArchiveForm.vm 2010-10-25 06:11:22 +0000
@@ -0,0 +1,65 @@
+
+<style type="text/css">
+.overlaps
+{
+ padding:1em;
+ margin:1em;
+ background-color: #baffbc;
+ border: 1px solid #12cd17;
+ width: 500px;
+ display: none;
+}
+</style>
+
+<h3>$i18n.getString( "patient_data_archive" ) #openHelp( "patientDataArchive" )</h3>
+
+#parse( "dhis-web-commons/loader/loader.vm" )
+
+<div id="overlapsDiv" class="overlaps">
+ <p>$i18n.getString( "there_are" ) <span id="number"></span> $i18n.getString( "overlapping_values" )</p>
+ <input type="radio" name="strategy" id="oldestRadio" value="oldest" checked="checked"/>
+ <label for="oldestRadio">$i18n.getString( 'eliminate_oldest' )</label><br/>
+ <input type="radio" name="strategy" id="archiveRadio" value="archive"/>
+ <label for="archiveRadio">$i18n.getString( 'eliminate_from_archive' )</label><br/>
+ <input type="radio" name="strategy" id="regularRadio" value="regular"/>
+ <label for="regularRadio">$i18n.getString( 'eliminate_from_regular' )</label>
+</div>
+
+<div id="noOverlapsDiv" class="overlaps">
+ $i18n.getString( "there_are_no_overlapping_values" )
+</div>
+
+<br/>
+
+<div id="contentDiv" style="display:none">
+<table width="100%">
+ <tr>
+ <td style="width:170px">$i18n.getString( "start_date" ) ($i18n.getString( "format.date" ))</td>
+ <td><input type="text" id="startDate"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "end_date" ) ($i18n.getString( "format.date" ))</td>
+ <td><input type="text" id="endDate"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="button" value="$i18n.getString( 'archive' )" style="width:100px" onclick="patientArchive( 'archive' )"/><input
+ type="button" value="$i18n.getString( 'unarchive' )" style="width:100px" onclick="patientArchive( 'unarchive' )"/></td>
+ </tr>
+</table>
+</div>
+
+<br/>
+
+<span id="message"></span>
+
+<script type="text/javascript">
+ var i18n_archiving = '$encoder.jsEscape( $i18n.getString( "archiving" ) , "'")';
+ var i18n_unarchiving = '$encoder.jsEscape( $i18n.getString( "unarchiving" ) , "'")';
+ var i18n_done_number_of_values = '$encoder.jsEscape( $i18n.getString( "done_number_of_values" ) , "'")';
+
+ $(document).ready(function()
+ {
+ datePickerInRange( 'startDate' , 'endDate' );
+ });
+</script>