← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21942: minor

 

------------------------------------------------------------
revno: 21942
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-02-11 14:16:09 +0700
message:
  minor
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.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/DefaultObjectBundleService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-02-10 08:50:32 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-02-11 07:16:09 +0000
@@ -29,14 +29,18 @@
  */
 
 import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dxf2.schema.SchemaValidator;
 import org.hisp.dhis.preheat.PreheatMode;
 import org.hisp.dhis.preheat.PreheatParams;
 import org.hisp.dhis.preheat.PreheatService;
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaService;
+import org.hisp.dhis.validation.ValidationViolation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -49,6 +53,9 @@
     @Autowired
     private PreheatService preheatService;
 
+    @Autowired
+    private SchemaValidator schemaValidator;
+
     @Override
     public ObjectBundle create( ObjectBundleParams params )
     {
@@ -74,9 +81,13 @@
 
         for ( Class<? extends IdentifiableObject> klass : bundle.getObjects().keySet() )
         {
-            Schema schema = schemaService.getDynamicSchema( klass );
             objectBundleValidation.addInvalidReferences( klass, preheatService.checkReferences(
                 bundle.getObjects().get( klass ), bundle.getPreheat(), bundle.getPreheatIdentifier() ) );
+
+            for ( IdentifiableObject object : bundle.getObjects().get( klass ) )
+            {
+                List<ValidationViolation> validationViolations = schemaValidator.validate( object );
+            }
         }
 
         return objectBundleValidation;