dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35090
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18011: minor fixes, report validation errors back as conflicts, if not a sharing import.. clear out sharing
------------------------------------------------------------
revno: 18011
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-16 11:15:14 +0700
message:
minor fixes, report validation errors back as conflicts, if not a sharing import.. clear out sharing
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-01-15 09:50:45 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2015-01-16 04:15:14 +0000
@@ -64,7 +64,6 @@
import org.hisp.dhis.eventreport.EventReport;
import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
@@ -290,17 +289,23 @@
return false;
}
- List<ValidationViolation> validate = schemaValidator.validate( object );
+ List<ValidationViolation> validationViolations = schemaValidator.validate( object );
- if ( !validate.isEmpty() )
+ if ( !validationViolations.isEmpty() )
{
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "Validation Violations: " + validationViolations ) );
+
return false;
}
// make sure that the internalId is 0, so that the system will generate a ID
object.setId( 0 );
- // object.setUser( user );
- // object.setUser( null );
+
+ if ( !options.isSharing() )
+ {
+ object.clearSharing( true );
+ }
NonIdentifiableObjects nonIdentifiableObjects = new NonIdentifiableObjects( user );
nonIdentifiableObjects.extract( object );
@@ -398,10 +403,13 @@
return true;
}
- List<ValidationViolation> validate = schemaValidator.validate( object );
+ List<ValidationViolation> validationViolations = schemaValidator.validate( object );
- if ( !validate.isEmpty() )
+ if ( !validationViolations.isEmpty() )
{
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "Validation Violations: " + validationViolations ) );
+
return false;
}