← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18014: disable validation in importer for now, causes too many issues with old dbs

 

------------------------------------------------------------
revno: 18014
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-16 12:41:13 +0700
message:
  disable validation in importer for now, causes too many issues with old dbs
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/StAXNodeSerializer.java
  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-core/src/main/java/org/hisp/dhis/node/serializers/StAXNodeSerializer.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/StAXNodeSerializer.java	2014-08-21 09:10:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/StAXNodeSerializer.java	2015-01-16 05:41:13 +0000
@@ -111,7 +111,7 @@
     {
         String value = String.format( "%s", simpleNode.getValue() );
 
-        if ( Date.class.isAssignableFrom( simpleNode.getValue().getClass() ) )
+        if ( simpleNode.getValue() != null && Date.class.isAssignableFrom( simpleNode.getValue().getClass() ) )
         {
             SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSZ" );
             dateFormat.setTimeZone( TimeZone.getTimeZone("UTC") );

=== 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-01-16 04:39:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2015-01-16 05:41:13 +0000
@@ -64,6 +64,7 @@
 import org.hisp.dhis.eventreport.EventReport;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
@@ -291,6 +292,7 @@
 
         List<ValidationViolation> validationViolations = schemaValidator.validate( object );
 
+        /*
         if ( !validationViolations.isEmpty() )
         {
             summaryType.getImportConflicts().add(
@@ -298,6 +300,7 @@
 
             return false;
         }
+        */
 
         // make sure that the internalId is 0, so that the system will generate a ID
         object.setId( 0 );
@@ -405,6 +408,7 @@
 
         List<ValidationViolation> validationViolations = schemaValidator.validate( object );
 
+        /*
         if ( !validationViolations.isEmpty() )
         {
             summaryType.getImportConflicts().add(
@@ -412,6 +416,7 @@
 
             return false;
         }
+        */
 
         NonIdentifiableObjects nonIdentifiableObjects = new NonIdentifiableObjects( user );
         nonIdentifiableObjects.extract( object );
@@ -464,7 +469,7 @@
             {
                 Map<Field, Collection<Object>> collectionFieldsUserCredentials = detachCollectionFields( userCredentials );
 
-                if ( userCredentials != null && userCredentials.getPassword() != null )
+                if ( userCredentials.getPassword() != null )
                 {
                     userService.encodeAndSetPassword( userCredentials, userCredentials.getPassword() );
                 }