← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1117: Removed the data value audit functionality. The implementation was wrong, storing an audit value ...

 

------------------------------------------------------------
revno: 1117
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-11-25 09:19:22 +0100
message:
  Removed the data value audit functionality. The implementation was wrong, storing an audit value even at insert instead of update only, which means the audit table will grow bigger than the datavalue table.
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ViewDataValueAuditPopupAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/auditResponseSuccess.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js


--
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-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2009-09-25 21:45:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2009-11-25 08:19:22 +0000
@@ -256,16 +256,4 @@
      * @return a collection of all DataValues which mach the given collection of DataElements.
      */
     Collection<DataValue> getDataValues( DataElement dataElement );
-    
-    /**
-     * Returns all DataValueAudits for a given DataElement, CategoryOptionCombo, Period,
-     * Sources.
-     * 
-     * @param dataElement the DataElement of the DataValue.
-     * @param optionCombo the DataElementCategoryOptionCombo of the DataElement.
-     * @param source the Source of the DataValue.
-     * @param period the Period of the DataValue.
-     * @return a collection of all DataValueAudits which match the given parameters.
-     */    
-    Collection<DataValueAudit> getDataValueAudits( Source source, Period period, DataElement dataElement, DataElementCategoryOptionCombo optionCombo  );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2009-09-25 21:45:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2009-11-25 08:19:22 +0000
@@ -248,16 +248,4 @@
      * @return a collection of all DataValues which mach the given collection of DataElements.
      */
     Collection<DataValue> getDataValues( DataElement dataElement );  
-    
-    /**
-     * Returns all DataValueAudits for a given DataElement, CategoryOptionCombo, Period,
-     * Sources.
-     * 
-     * @param dataElement the DataElement of the DataValue.
-     * @param optionCombo the DataElementCategoryOptionCombo of the DataElement.
-     * @param source the Source of the DataValue.
-     * @param period the Period of the DataValue.
-     * @return a collection of all DataValueAudits which match the given parameters.
-     */    
-    Collection<DataValueAudit> getDataValueAudits( Source source, Period period, DataElement dataElement, DataElementCategoryOptionCombo optionCombo  );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2009-09-25 21:45:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2009-11-25 08:19:22 +0000
@@ -61,7 +61,7 @@
 
     public void addDataValue( DataValue dataValue )
     {
-        if ( !(dataValue.getValue() == null && dataValue.getComment() == null) )
+        if ( !( dataValue.getValue() == null && dataValue.getComment() == null ) )
         {
             dataValueStore.addDataValue( dataValue );
         }
@@ -178,10 +178,4 @@
     {
         return dataValueStore.getDataValues( dataElement );
     }
-
-    public Collection<DataValueAudit> getDataValueAudits( Source source, Period period, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo )
-    {
-        return dataValueStore.getDataValueAudits( source, period, dataElement, optionCombo );
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2009-09-25 21:45:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2009-11-25 08:19:22 +0000
@@ -45,7 +45,6 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueAudit;
 import org.hisp.dhis.datavalue.DataValueStore;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
@@ -124,11 +123,6 @@
         Session session = sessionFactory.getCurrentSession();
 
         session.save( dataValue );
-        
-        DataValueAudit dataValueAudit = new DataValueAudit(dataValue);
-        dataValueAudit.setRevisionType("dv_added");
-        
-        session.save( dataValueAudit );
     }
 
     public void updateDataValue( DataValue dataValue )
@@ -138,11 +132,6 @@
         Session session = sessionFactory.getCurrentSession();
 
         session.update( dataValue );
-        
-        DataValueAudit dataValueAudit = new DataValueAudit(dataValue);
-        dataValueAudit.setRevisionType("dv_updated");
-        
-        session.save( dataValueAudit );
     }
 
     public void deleteDataValue( DataValue dataValue )
@@ -150,11 +139,6 @@
         Session session = sessionFactory.getCurrentSession();
 
         session.delete( dataValue );
-        
-        DataValueAudit dataValueAudit = new DataValueAudit(dataValue);
-        dataValueAudit.setRevisionType("dv_deleted");
-        
-        session.save( dataValueAudit );
     }
 
     public int deleteDataValuesBySource( Source source )
@@ -478,18 +462,4 @@
 
         return criteria.list();
     }
-
-    @SuppressWarnings( "unchecked" )
-    public Collection<DataValueAudit> getDataValueAudits( Source source, Period period, DataElement dataElement, DataElementCategoryOptionCombo optionCombo  )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        Criteria criteria = session.createCriteria( DataValueAudit.class );
-        criteria.add( Restrictions.eq( "source", source ) );
-        criteria.add( Restrictions.eq( "period", period ) );
-        criteria.add( Restrictions.eq( "dataElement", dataElement ) );
-        criteria.add( Restrictions.eq( "optionCombo", optionCombo ) );
-
-        return criteria.list();
-    }
 }

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ViewDataValueAuditPopupAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ViewDataValueAuditPopupAction.java	2009-10-18 22:44:41 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ViewDataValueAuditPopupAction.java	1970-01-01 00:00:00 +0000
@@ -1,225 +0,0 @@
-package org.hisp.dhis.de.action;
-
-/*
- * Copyright (c) 2004-2009, 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.List;
-
-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.datavalue.DataValueAudit;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Latifov Murodillo Abdusamadovich
- * @version $Id$
- */
-public class ViewDataValueAuditPopupAction
-    implements Action
-{
-    private Integer organisationUnitId;
-
-    private Integer dataElementComboId;
-
-    private Integer dataElementId;
-
-    private Integer periodId;
-
-    private List<DataValueAudit> dataValueAudits;
-
-    private DataValueAudit dataValueAudit;
-
-    private OrganisationUnit organisationUnit;
-
-    private Period period;
-
-    private DataElementCategoryOptionCombo dataElementCategoryOptionCombo;
-
-    private DataElement dataElement;
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    public DataElementCategoryOptionCombo getDataElementCategoryOptionCombo()
-    {
-        return dataElementCategoryOptionCombo;
-    }
-
-    public void setDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo )
-    {
-        this.dataElementCategoryOptionCombo = dataElementCategoryOptionCombo;
-    }
-
-    private DataValueService dataValueService;
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataElementCategoryService categoryService;
-    
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    public DataElement getDataElement()
-    {
-        return dataElement;
-    }
-
-    public void setDataElement( DataElement dataElement )
-    {
-        this.dataElement = dataElement;
-    }
-
-    public OrganisationUnit getOrganisationUnit()
-    {
-        return organisationUnit;
-    }
-
-    public void setOrganisationUnit( OrganisationUnit organisationUnit )
-    {
-        this.organisationUnit = organisationUnit;
-    }
-
-    public Period getPeriod()
-    {
-        return period;
-    }
-
-    public void setPeriod( Period period )
-    {
-        this.period = period;
-    }
-
-    public DataValueAudit getDataValueAudit()
-    {
-        return dataValueAudit;
-    }
-
-    public void setDataValueAudit( DataValueAudit dataValueAudit )
-    {
-        this.dataValueAudit = dataValueAudit;
-    }
-
-    public List<DataValueAudit> getDataValueAudits()
-    {
-        return dataValueAudits;
-    }
-
-    public void setDataValueAudits( List<DataValueAudit> dataValueAudits )
-    {
-        this.dataValueAudits = dataValueAudits;
-    }
-
-    public Integer getOrganisationUnitId()
-    {
-        return organisationUnitId;
-    }
-
-    public void setOrganisationUnitId( Integer organisationUnitId )
-    {
-        this.organisationUnitId = organisationUnitId;
-    }
-
-    public Integer getDataElementComboId()
-    {
-        return dataElementComboId;
-    }
-
-    public void setDataElementComboId( Integer dataElementComboId )
-    {
-        this.dataElementComboId = dataElementComboId;
-    }
-
-    public Integer getDataElementId()
-    {
-        return dataElementId;
-    }
-
-    public void setDataElementId( Integer dataElementId )
-    {
-        this.dataElementId = dataElementId;
-    }
-
-    public Integer getPeriodId()
-    {
-        return periodId;
-    }
-
-    public void setPeriodId( Integer periodId )
-    {
-        this.periodId = periodId;
-    }
-
-    public String execute()
-        throws Exception
-    {
-        dataElement = dataElementService.getDataElement( getDataElementId() );
-        organisationUnit = organisationUnitService.getOrganisationUnit( getOrganisationUnitId() );
-        period = periodService.getPeriod( getPeriodId() );
-        
-        dataElementCategoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( getDataElementComboId() );
-
-        dataValueAudits = (List<DataValueAudit>) dataValueService.getDataValueAudits( organisationUnit, period,
-            dataElement, dataElementCategoryOptionCombo );
-
-        return SUCCESS;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2009-10-26 15:39:29 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2009-11-25 08:19:22 +0000
@@ -285,19 +285,6 @@
 		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
 	</bean>
 
-	<!-- Audit -->
-
-	<bean id="org.hisp.dhis.de.action.ViewDataValueAuditPopupAction"
-		class="org.hisp.dhis.de.action.ViewDataValueAuditPopupAction">
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="organisationUnitService"
-			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
-	</bean>
-
 	<!-- Validate -->
 
 	<bean id="org.hisp.dhis.de.action.ValidationAction" class="org.hisp.dhis.de.action.ValidationAction">

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2009-08-20 08:30:11 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2009-11-25 08:19:22 +0000
@@ -198,12 +198,6 @@
       <result name="success" type="velocity-xml">/dhis-web-dataentry/responseSuccess.vm</result>
       <result name="none" type="velocity-xml">/dhis-web-dataentry/responseNone.vm</result>
     </action>
-  
-      <!-- Audit for DataValue Action-->
-	<action name="viewDataValuePopupForm"
-	  class="org.hisp.dhis.de.action.ViewDataValueAuditPopupAction">
-	  <result name="success" type="velocity">/dhis-web-dataentry/auditResponseSuccess.vm</result>				
-	</action>
-		  
+	
   </package>
 </struts>

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/auditResponseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/auditResponseSuccess.vm	2009-05-22 22:55:18 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/auditResponseSuccess.vm	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-<html> 
-<head>
-<style type="text/css">
-h4 {
-    font-family: arial, sans-serif;
-    font-size: 12px;
-    margin: 15px 0 5px 0;
-    }
-</style>
-</head>
-<h3>$i18n.getString( 'audit' )</h3><br>
-	<strong >
-			$dataElement.name &nbsp; $dataElementCategoryOptionCombo.name<br>
-			$organisationUnit.name<br>	
-	</strong>
-$i18n.getString( 'audit_from' ) $period.startDate $i18n.getString( 'audit_to' ) $period.EndDate <br>	
-	<table border=1><td>$i18n.getString( 'audit_value' )</td><td>$i18n.getString( 'audit_stored_by' )</td><td>$i18n.getString( 'audit_time' )</td><td>$i18n.getString( 'audit_operation' )</td>
-#foreach( $dataValueAudit in $dataValueAudits )
-		<tr>
-			<td> $dataValueAudit.value </td>
-			<td> $dataValueAudit.storedBy </td>
-			<td> $dataValueAudit.timestamp </td>
-			<td> $i18n.getString( $dataValueAudit.revisionType ) </td>
-		</tr>
-#end
-</table>
-</html>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2009-05-22 22:53:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2009-11-25 08:19:22 +0000
@@ -181,22 +181,10 @@
     	    barHeight = Math.round( maxBarHeight * historyPoints[i][1] / maxValue );
     		g.drawStringRect( historyPoints[i][1].toFixed(), cellWidth * ( i - 1 ) + cellWidth / 2, barBase - barHeight - verticalPadding - fontSizePixels, cellWidth * 2, 'center' );
         }
-var qstr = '<a href="javascript:openAuditForm(';
-qstr = qstr+ ouid;
-qstr = qstr+ ',';
-qstr = qstr +  coid;
-qstr = qstr+ ',';
-qstr = qstr +  deid;
-qstr = qstr+ ',';
-qstr = qstr +  historyPoints[i][3];
-qstr = qstr +');">';
-qstr = qstr + historyPoints[i][0];
-qstr = qstr + '</a>';
 
-//        g.drawStringRect( "<a href='javascript:openAuditForm(" + ouid, coid, deid, historyPoints[i][3], historyPoints[i][4], historyPoints[i][5] + ");'>" + historyPoints[i][0] + "</a>", cellWidth * i, barBase + verticalPadding, cellWidth, 'center' );
-        g.drawStringRect( qstr , cellWidth * i, barBase + verticalPadding, cellWidth, 'center' );
+        g.drawStringRect( historyPoints[i][0], cellWidth * i, barBase + verticalPadding, cellWidth, 'center' );
     }
-    
+
     g.paint();
 }
 
@@ -282,11 +270,6 @@
     }
 }
 
-function openAuditForm (idou, idco, idde, psd)
-    {
-		window.open ('../dhis-web-dataentry/viewDataValuePopupForm.action?organisationUnitId=' + idou + '&dataElementComboId=' +idco + '&dataElementId=' + idde +'&periodId=' + psd + '&width=800,height=600,scrollbars=yes');
-    }
-
 function refreshWindow()
 {
     window.location.reload();