dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41648
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21231: auditing for TEAV
------------------------------------------------------------
revno: 21231
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-11-30 09:50:28 +0700
message:
auditing for TEAV
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueAuditService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueAuditStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValueAudit.hbm.xml
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueAudit.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java
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/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java 2015-11-30 00:40:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java 2015-11-30 02:50:28 +0000
@@ -66,6 +66,7 @@
this.attribute = trackedEntityAttributeValue.getAttribute();
this.entityInstance = trackedEntityAttributeValue.getEntityInstance();
+ this.timestamp = new Date();
this.value = value;
this.modifiedBy = modifiedBy;
this.auditType = auditType;
@@ -74,7 +75,7 @@
@Override
public int hashCode()
{
- return Objects.hash( id, attribute, entityInstance, timestamp, value, modifiedBy, auditType );
+ return Objects.hash( attribute, entityInstance, timestamp, value, modifiedBy, auditType );
}
@Override
@@ -92,8 +93,7 @@
final TrackedEntityAttributeValueAudit other = (TrackedEntityAttributeValueAudit) obj;
- return Objects.equals( this.id, other.id )
- && Objects.equals( this.attribute, other.attribute )
+ return Objects.equals( this.attribute, other.attribute )
&& Objects.equals( this.entityInstance, other.entityInstance )
&& Objects.equals( this.timestamp, other.timestamp )
&& Objects.equals( this.value, other.value )
@@ -137,6 +137,18 @@
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public Date getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp( Date timestamp )
+ {
+ this.timestamp = timestamp;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getValue()
{
return value;
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditService.java 2015-11-30 02:50:28 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.trackedentityattributevalue;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface TrackedEntityAttributeValueAuditService
+{
+ void addTrackedEntityAttributeValueAudit( TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit );
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAuditStore.java 2015-11-30 02:50:28 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.trackedentityattributevalue;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface TrackedEntityAttributeValueAuditStore
+{
+ void addTrackedEntityAttributeValueAudit( TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit );
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueAudit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueAudit.java 2015-11-30 00:34:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueAudit.java 2015-11-30 02:50:28 +0000
@@ -67,15 +67,15 @@
// Constructors
// -------------------------------------------------------------------------
- public TrackedEntityDataValueAudit( TrackedEntityDataValue trackedEntityDataValue, String value, String modifiedBy, Date timestamp, AuditType auditType )
+ public TrackedEntityDataValueAudit( TrackedEntityDataValue trackedEntityDataValue, String value, String modifiedBy, AuditType auditType )
{
this.dataElement = trackedEntityDataValue.getDataElement();
this.programStageInstance = trackedEntityDataValue.getProgramStageInstance();
this.providedElsewhere = trackedEntityDataValue.getProvidedElsewhere();
+ this.timestamp = new Date();
this.value = value;
this.modifiedBy = modifiedBy;
- this.timestamp = timestamp;
this.auditType = auditType;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-11-27 16:04:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-11-30 02:50:28 +0000
@@ -804,6 +804,7 @@
executeSql( "alter table datavalue alter column comment type varchar(50000)" );
executeSql( "alter table datavalueaudit alter column value type varchar(50000)" );
executeSql( "alter table trackedentitydatavalue alter column value type varchar(50000)" );
+ executeSql( "alter table trackedentityattributevalue alter column value type varchar(50000)" );
executeSql( "update trackedentitydatavalue set providedelsewhere=false where providedelsewhere is null" );
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueAuditService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueAuditService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueAuditService.java 2015-11-30 02:50:28 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.trackedentityattributevalue;
+
+/*
+ * Copyright (c) 2004-2015, 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.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class DefaultTrackedEntityAttributeValueAuditService
+ implements TrackedEntityAttributeValueAuditService
+{
+ @Autowired
+ private TrackedEntityAttributeValueAuditStore trackedEntityAttributeValueAuditStore;
+
+ @Override
+ public void addTrackedEntityAttributeValueAudit( TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit )
+ {
+ trackedEntityAttributeValueAuditStore.addTrackedEntityAttributeValueAudit( trackedEntityAttributeValueAudit );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java 2015-09-13 17:45:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java 2015-11-30 02:50:28 +0000
@@ -28,12 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-import java.util.List;
-
+import org.hisp.dhis.common.AuditType;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.Collection;
+import java.util.List;
/**
* @author Abyot Asalefew
@@ -53,6 +57,12 @@
this.attributeValueStore = attributeValueStore;
}
+ @Autowired
+ private TrackedEntityAttributeValueAuditService trackedEntityAttributeValueAuditService;
+
+ @Autowired
+ private CurrentUserService currentUserService;
+
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
@@ -60,6 +70,10 @@
@Override
public void deleteTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue )
{
+ TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit = new TrackedEntityAttributeValueAudit( attributeValue,
+ attributeValue.getValue(), currentUserService.getCurrentUsername(), AuditType.DELETE );
+
+ trackedEntityAttributeValueAuditService.addTrackedEntityAttributeValueAudit( trackedEntityAttributeValueAudit );
attributeValueStore.delete( attributeValue );
}
@@ -87,7 +101,10 @@
Collection<TrackedEntityInstance> instances )
{
if ( instances != null && instances.size() > 0 )
+ {
return attributeValueStore.get( instances );
+ }
+
return null;
}
@@ -103,12 +120,16 @@
@Override
public void updateTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue )
{
- if ( attributeValue.getValue() == null )
+ if ( StringUtils.isEmpty( attributeValue.getValue() ) )
{
attributeValueStore.delete( attributeValue );
}
else
{
+ TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit = new TrackedEntityAttributeValueAudit( attributeValue,
+ attributeValue.getValue(), currentUserService.getCurrentUsername(), AuditType.UPDATE );
+
+ trackedEntityAttributeValueAuditService.addTrackedEntityAttributeValueAudit( trackedEntityAttributeValueAudit );
attributeValueStore.update( attributeValue );
}
}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueAuditStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueAuditStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueAuditStore.java 2015-11-30 02:50:28 +0000
@@ -0,0 +1,63 @@
+package org.hisp.dhis.trackedentityattributevalue.hibernate;
+
+/*
+ * Copyright (c) 2004-2015, 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.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueAudit;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueAuditStore;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class HibernateTrackedEntityAttributeValueAuditStore
+ implements TrackedEntityAttributeValueAuditStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void addTrackedEntityAttributeValueAudit( TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ session.save( trackedEntityAttributeValueAudit );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java 2015-11-30 00:55:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java 2015-11-30 02:50:28 +0000
@@ -93,8 +93,7 @@
dataValue.setStoredBy( currentUserService.getCurrentUsername() );
}
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), dataValue.getStoredBy(),
- new Date(), AuditType.UPDATE );
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), dataValue.getStoredBy(), AuditType.UPDATE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
dataValueStore.update( dataValue );
@@ -104,8 +103,8 @@
@Override
public void deleteTrackedEntityDataValue( TrackedEntityDataValue dataValue )
{
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), currentUserService.getCurrentUsername(),
- new Date(), AuditType.DELETE );
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(),
+ currentUserService.getCurrentUsername(), AuditType.DELETE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
dataValueStore.delete( dataValue );
@@ -119,7 +118,7 @@
for ( TrackedEntityDataValue dataValue : dataValues )
{
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), username, new Date(), AuditType.DELETE );
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), username, AuditType.DELETE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
}
=== 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 2015-11-27 08:42:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-11-30 02:50:28 +0000
@@ -524,9 +524,17 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
+ <bean id="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueAuditStore"
+ class="org.hisp.dhis.trackedentityattributevalue.hibernate.HibernateTrackedEntityAttributeValueAuditStore">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
<bean id="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueAuditService"
class="org.hisp.dhis.trackedentitydatavalue.DefaultTrackedEntityDataValueAuditService" />
+ <bean id="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueAuditService"
+ class="org.hisp.dhis.trackedentityattributevalue.DefaultTrackedEntityAttributeValueAuditService" />
+
<bean id="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupStore"
class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml 2015-11-30 02:50:28 +0000
@@ -10,10 +10,10 @@
<key-many-to-one name="entityInstance" class="org.hisp.dhis.trackedentity.TrackedEntityInstance" column="trackedentityinstanceid"
foreign-key="fk_attributevalue_trackedentityinstanceid" />
<key-many-to-one name="attribute" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute" column="trackedentityattributeid"
- foreign-key="fk_attributevalue_trackedentityattributeid" />
+ foreign-key="fk_attributevalue_trackedentityattributeid" />
</composite-id>
- <property name="value" />
+ <property name="value" length="50000" />
</class>
</hibernate-mapping>
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValueAudit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValueAudit.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValueAudit.hbm.xml 2015-11-30 02:50:28 +0000
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueAudit" table="trackedentityattributevalueaudit">
+
+ <id name="id" column="trackedentityattributevalueauditid">
+ <generator class="native" />
+ </id>
+
+ <many-to-one name="entityInstance" class="org.hisp.dhis.trackedentity.TrackedEntityInstance" column="trackedentityinstanceid"
+ foreign-key="fk_attributevalue_trackedentityinstanceid" />
+
+ <many-to-one name="attribute" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute" column="trackedentityattributeid"
+ foreign-key="fk_attributevalue_trackedentityattributeid" />
+
+ <property name="value" length="50000" />
+
+ <property name="timestamp" type="timestamp" />
+
+ <property name="modifiedBy" />
+
+ <property name="auditType" column="audittype" length="100" not-null="true">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.common.AuditType</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
+ </class>
+</hibernate-mapping>