← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1714: Add data value audit function. Still working on.

 

------------------------------------------------------------
revno: 1714
committer: Quang <Quang@Quang-PC>
branch nick: dhis2
timestamp: Wed 2010-03-31 23:21:57 +0700
message:
  Add data value audit function. Still working on.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValueAudit.hbm.xml
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.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-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java	2010-03-31 16:21:57 +0000
@@ -0,0 +1,132 @@
+package org.hisp.dhis.datavalue;
+
+/*
+ * Copyright (c) 2004-2007, 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;
+
+/**
+ * @author Quang Nguyen
+ * @version Mar 30, 2010 9:13:36 PM
+ */
+
+public class DataValueAudit
+{
+    private int id;
+
+    private DataValue dataValue;
+
+    private String value;
+
+    private String storedBy;
+
+    private Date timeStamp;
+
+    private String comment;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+    public DataValueAudit()
+    {
+
+    }
+
+    public DataValueAudit( DataValue dataValue, String value, String storedBy, Date timeStamp, String comment )
+    {
+        this.dataValue = dataValue;
+        this.value = value;
+        this.storedBy = storedBy;
+        this.timeStamp = timeStamp;
+        this.comment = comment;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    public DataValue getDataValue()
+    {
+        return dataValue;
+    }
+
+    public void setDataValue( DataValue dataValue )
+    {
+        this.dataValue = dataValue;
+    }
+
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue( String value )
+    {
+        this.value = value;
+    }
+
+    public String getStoredBy()
+    {
+        return storedBy;
+    }
+
+    public void setStoredBy( String storedBy )
+    {
+        this.storedBy = storedBy;
+    }
+
+    public Date getTimeStamp()
+    {
+        return timeStamp;
+    }
+
+    public void setTimeStamp( Date timeStamp )
+    {
+        this.timeStamp = timeStamp;
+    }
+
+    public String getComment()
+    {
+        return comment;
+    }
+
+    public void setComment( String comment )
+    {
+        this.comment = comment;
+    }
+
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	2010-03-31 16:21:57 +0000
@@ -0,0 +1,50 @@
+package org.hisp.dhis.datavalue;
+
+/*
+ * Copyright (c) 2004-2007, 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.Collection;
+
+/**
+ * @author Quang Nguyen
+ * @version Mar 30, 2010 9:39:38 PM
+ */
+
+public interface DataValueAuditService
+{
+    String ID = DataValueAuditService.class.getName();
+
+    void addDataValueAudit( DataValueAudit dataValueAudit );
+
+    void deleteDataValueAudit( DataValueAudit dataValueAudit );
+
+    int deleteDataValuesByDataValue( DataValue dataValue );
+
+    Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue );
+
+    Collection<DataValueAudit> getAll();
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	2010-03-31 16:21:57 +0000
@@ -0,0 +1,49 @@
+package org.hisp.dhis.datavalue;
+
+/*
+ * Copyright (c) 2004-2007, 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.Collection;
+
+/**
+ * @author Quang Nguyen
+ * @version Mar 30, 2010 10:32:19 PM
+ */
+public interface DataValueAuditStore
+{
+    String ID = DataValueAuditStore.class.getName();
+
+    void addDataValueAudit( DataValueAudit dataValueAudit );
+
+    void deleteDataValueAudit( DataValueAudit dataValueAudit );
+
+    int deleteDataValuesByDataValue( DataValue dataValue );
+
+    Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue );
+
+    Collection<DataValueAudit> getAll();
+}

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	2010-03-31 16:21:57 +0000
@@ -0,0 +1,83 @@
+package org.hisp.dhis.datavalue;
+
+/*
+ * Copyright (c) 2004-2007, 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.Collection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Quang Nguyen
+ * @version Mar 30, 2010 9:45:56 PM
+ */
+
+public class DefaultDataValueAuditService
+    implements DataValueAuditService
+{
+    private static final Log log = LogFactory.getLog( DefaultDataValueAuditService.class );
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataValueAuditStore dataValueAuditStore;
+
+    public void setDataValueAuditStore( DataValueAuditStore dataValueAuditStore )
+    {
+        this.dataValueAuditStore = dataValueAuditStore;
+    }
+
+    public void addDataValueAudit( DataValueAudit dataValueAudit )
+    {
+        if ( dataValueAudit != null )
+        {
+            dataValueAuditStore.addDataValueAudit( dataValueAudit );
+        }
+    }
+
+    public void deleteDataValueAudit( DataValueAudit dataValueAudit )
+    {
+        dataValueAuditStore.deleteDataValueAudit( dataValueAudit );
+    }
+
+    public int deleteDataValuesByDataValue( DataValue dataValue )
+    {
+        return dataValueAuditStore.deleteDataValuesByDataValue( dataValue );
+    }
+
+    public Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue )
+    {
+        return dataValueAuditStore.getDataValueAuditByDataValue( dataValue );
+    }
+
+    public Collection<DataValueAudit> getAll()
+    {
+        return dataValueAuditStore.getAll();
+    }
+}

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	2010-03-31 16:21:57 +0000
@@ -0,0 +1,106 @@
+package org.hisp.dhis.datavalue.hibernate;
+
+/*
+ * Copyright (c) 2004-2007, 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.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueAudit;
+import org.hisp.dhis.datavalue.DataValueAuditStore;
+
+/**
+ * @author Quang Nguyen
+ * @version Mar 30, 2010 10:42:16 PM
+ */
+public class HibernateDataValueAuditStore
+    implements DataValueAuditStore
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    public void addDataValueAudit( DataValueAudit dataValueAudit )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.save( dataValueAudit );
+        session.flush();
+    }
+
+    public void deleteDataValueAudit( DataValueAudit dataValueAudit )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.delete( dataValueAudit );
+    }
+
+    public int deleteDataValuesByDataValue( DataValue dataValue )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Query query = session.createQuery( "delete DataValueAudit where dataValue = :dataValue" );
+        query.setEntity( "dataValue", dataValue );
+
+        return query.executeUpdate();
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( DataValueAudit.class );
+        criteria.add( Restrictions.eq( "dataValue", dataValue ) );
+
+        return criteria.list();
+    }
+
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public Collection<DataValueAudit> getAll()
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( DataValueAudit.class );
+
+        return criteria.list();
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-02-25 12:33:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-03-31 16:21:57 +0000
@@ -180,7 +180,12 @@
     <property name="statementManager" ref="statementManager"/>
     <property name="statementBuilder" ref="statementBuilder"/>
   </bean>
-    
+  
+  <bean id="org.hisp.dhis.datavalue.DataValueAuditStore"
+    class="org.hisp.dhis.datavalue.hibernate.HibernateDataValueAuditStore">
+    <property name="sessionFactory" ref="sessionFactory"/>
+  </bean>
+  
   <!-- Service definitions -->
 
   <bean id="org.hisp.dhis.customvalue.CustomValueService"
@@ -194,6 +199,12 @@
     <property name="dataValueStore"
       ref="org.hisp.dhis.datavalue.DataValueStore"/>
   </bean>
+
+  <bean id="org.hisp.dhis.datavalue.DataValueAuditService"
+    class="org.hisp.dhis.datavalue.DefaultDataValueAuditService">
+    <property name="dataValueAuditStore"
+      ref="org.hisp.dhis.datavalue.DataValueAuditStore"/>
+  </bean>
   
   <bean id="org.hisp.dhis.dataelement.DataElementService"
     class="org.hisp.dhis.dataelement.DefaultDataElementService">

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValueAudit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValueAudit.hbm.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValueAudit.hbm.xml	2010-03-31 16:21:57 +0000
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
+
+<hibernate-mapping>
+	<class name="org.hisp.dhis.datavalue.DataValueAudit" table="datavalueaudit">
+		<id name="id">
+			<generator class="native" />
+		</id>
+
+		<many-to-one name="dataValue" class="org.hisp.dhis.datavalue.DataValue">
+			
+			<column name="dataelementid" />
+			<column name="periodid" />
+			<column name="sourceid" />
+			<column name="categoryoptioncomboid" />
+		</many-to-one>
+
+		<property name="value" />
+		<property name="storedBy" column="storedby" length="31" />
+		<property name="timeStamp" column="lastupdated" type="date" />
+		<property name="comment" length="360" />
+	</class>
+</hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java	2009-10-18 22:44:41 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java	2010-03-31 16:21:57 +0000
@@ -36,6 +36,8 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueAudit;
+import org.hisp.dhis.datavalue.DataValueAuditService;
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.de.state.SelectedStateManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -79,6 +81,14 @@
         this.dataValueService = dataValueService;
     }
 
+    private DataValueAuditService dataValueAuditService;
+
+    public void setDataValueAuditService( DataValueAuditService dataValueAuditService )
+    {
+        this.dataValueAuditService = dataValueAuditService;
+    }
+    
+    
     private SelectedStateManager selectedStateManager;
 
     public void setSelectedStateManager( SelectedStateManager selectedStateManager )
@@ -194,6 +204,12 @@
             dataValue.setStoredBy( storedBy );
 
             dataValueService.updateDataValue( dataValue );
+            
+            /*
+             * Add DataValueAudit
+             */
+            DataValueAudit audit = new DataValueAudit(dataValue, "", storedBy, new Date(), "");
+            dataValueAuditService.addDataValueAudit( audit );
         }
 
         if ( dataValue != null )

=== 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	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2010-03-31 16:21:57 +0000
@@ -129,6 +129,7 @@
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="dataValueAuditService" ref="org.hisp.dhis.datavalue.DataValueAuditService" />
 		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
 		<property name="categoryService"
 			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />