← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22224: minor fixes to validation rule hook

 

------------------------------------------------------------
revno: 22224
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-03-10 13:48:51 +0700
message:
  minor fixes to validation rule hook
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/ValidationRuleObjectBundleHook.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/ValidationRuleObjectBundleHook.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/ValidationRuleObjectBundleHook.java	2016-03-10 06:38:17 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/ValidationRuleObjectBundleHook.java	2016-03-10 06:48:51 +0000
@@ -30,7 +30,6 @@
 
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.dxf2.metadata2.objectbundle.ObjectBundle;
-import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.validation.ValidationRule;
 import org.springframework.stereotype.Component;
 
@@ -46,17 +45,11 @@
         if ( !ValidationRule.class.isInstance( identifiableObject ) ) return;
         ValidationRule validationRule = (ValidationRule) identifiableObject;
 
-        Expression leftSide = validationRule.getLeftSide();
-        Expression rightSide = validationRule.getRightSide();
-
-        preheatService.connectReferences( leftSide, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
-        preheatService.connectReferences( rightSide, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
-
-        sessionFactory.getCurrentSession().save( leftSide );
-        sessionFactory.getCurrentSession().save( rightSide );
-
-        validationRule.setLeftSide( leftSide );
-        validationRule.setRightSide( rightSide );
+        preheatService.connectReferences( validationRule.getLeftSide(), objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
+        preheatService.connectReferences( validationRule.getRightSide(), objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
+
+        sessionFactory.getCurrentSession().save( validationRule.getLeftSide() );
+        sessionFactory.getCurrentSession().save( validationRule.getRightSide() );
     }
 
     @Override
@@ -65,16 +58,10 @@
         if ( !ValidationRule.class.isInstance( identifiableObject ) ) return;
         ValidationRule validationRule = (ValidationRule) identifiableObject;
 
-        Expression leftSide = validationRule.getLeftSide();
-        Expression rightSide = validationRule.getRightSide();
-
-        preheatService.connectReferences( leftSide, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
-        preheatService.connectReferences( rightSide, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
-
-        sessionFactory.getCurrentSession().save( leftSide );
-        sessionFactory.getCurrentSession().save( rightSide );
-
-        validationRule.setLeftSide( leftSide );
-        validationRule.setRightSide( rightSide );
+        preheatService.connectReferences( validationRule.getLeftSide(), objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
+        preheatService.connectReferences( validationRule.getRightSide(), objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
+
+        sessionFactory.getCurrentSession().save( validationRule.getLeftSide() );
+        sessionFactory.getCurrentSession().save( validationRule.getRightSide() );
     }
 }