[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18386: enable validation in dxf2 import create/update

revision-diff.txt (2.85 KB)

Morten,

Can you explain what this validating dxf2 change means, in normal english?

Regards

Calle

···

On 24 February 2015 at 13:38, noreply@launchpad.net wrote:


revno: 18386

committer: Morten Olav Hansen mortenoh@gmail.com

branch nick: dhis2

timestamp: Tue 2015-02-24 18:37:53 +0700

message:

enable validation in dxf2 import create/update

modified:

dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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/metadata/importers/DefaultIdentifiableObjectImporter.java’

— dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2015-02-20 12:35:55 +0000

+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2015-02-24 11:37:53 +0000

@@ -28,18 +28,9 @@

  • SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

-import static org.hisp.dhis.system.util.PredicateUtils.idObjectCollectionsWithScanned;

-import static org.hisp.dhis.system.util.PredicateUtils.idObjects;

-import java.lang.reflect.Field;

-import java.lang.reflect.Method;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.HashSet;

-import java.util.List;

-import java.util.Map;

-import java.util.Set;

+import com.google.common.collect.Lists;

+import com.google.common.collect.Maps;

+import com.google.common.collect.Sets;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.hibernate.SessionFactory;

@@ -92,9 +83,17 @@

import org.hisp.dhis.validation.ValidationRule;

import org.springframework.beans.factory.annotation.Autowired;

-import com.google.common.collect.Lists;

-import com.google.common.collect.Maps;

-import com.google.common.collect.Sets;

+import java.lang.reflect.Field;

+import java.lang.reflect.Method;

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.HashSet;

+import java.util.List;

+import java.util.Map;

+import java.util.Set;

+import static org.hisp.dhis.system.util.PredicateUtils.idObjectCollectionsWithScanned;

+import static org.hisp.dhis.system.util.PredicateUtils.idObjects;

/**

  • Importer that can handle IdentifiableObject and NameableObject.

@@ -291,7 +290,6 @@

     List<ValidationViolation> validationViolations = schemaValidator.validate( object );
  •    /* disabled for 2.18 release
    
       if ( !validationViolations.isEmpty() )
    
       {
    
           summaryType.getImportConflicts().add(
    

@@ -299,7 +297,6 @@

         return false;

     }
  •    */
    
    
    
       // make sure that the internalId is 0, so that the system will generate a ID
    
       object.setId( 0 );
    

@@ -408,7 +405,6 @@

     List<ValidationViolation> validationViolations = schemaValidator.validate( object );
  •    /* disabled for 2.18 release
    
       if ( !validationViolations.isEmpty() )
    
       {
    
           summaryType.getImportConflicts().add(
    

@@ -416,7 +412,6 @@

         return false;

     }
  •    */
    
    
    
       NonIdentifiableObjects nonIdentifiableObjects = new NonIdentifiableObjects( user );
    
       nonIdentifiableObjects.extract( object );
    

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19274

Email: calle.hedberg@gmail.com

Skype: calle_hedberg