← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21712: Fixed how TEAVAudit gets previous TEAV value; Encryption works for both TEAV and TEAVAudit now; T...

 

------------------------------------------------------------
revno: 21712
committer: Stian Sandvold <stian.sandvold@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-01-13 14:38:09 +0100
message:
  Fixed how TEAVAudit gets previous TEAV value; Encryption works for both TEAV and TEAVAudit now; TEAVAudit gets previous value not new value when changes happen
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java


--
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/common/ValueType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2016-01-13 13:38:09 +0000
@@ -28,14 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import com.google.common.collect.Sets;
+import org.hisp.dhis.trackedentity.TrackedEntityInstance;
+
 import java.util.Date;
 import java.util.Set;
 
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-
-import com.google.common.collect.Sets;
-
 /**
  * @author Lars Helge Overland
  */

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java	2016-01-13 11:05:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java	2016-01-13 13:38:09 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
+import org.hisp.dhis.setting.SystemSetting;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 
@@ -245,6 +246,11 @@
     public void setEncryptedValue( String encryptedValue )
     {
         this.encryptedValue = encryptedValue;
+
+        if(getAttribute().getConfidential()) {
+            auditValue = encryptedValue;
+            auditValueIsSet = true;
+        }
     }
 
     /**
@@ -263,6 +269,11 @@
     public void setPlainValue( String plainValue )
     {
         this.plainValue = plainValue;
+
+        if(!getAttribute().getConfidential()) {
+            auditValue = plainValue;
+            auditValueIsSet = true;
+        }
     }
 
     /**

=== 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	2016-01-07 12:15:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueAudit.java	2016-01-13 13:38:09 +0000
@@ -80,7 +80,7 @@
         this.entityInstance = trackedEntityAttributeValue.getEntityInstance();
 
         this.created = new Date();
-        setValue( value );
+        this.value = value;
         this.modifiedBy = modifiedBy;
         this.auditType = auditType;
     }