dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41563
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21183: Updated handling of attribute value import in dxf2 importer
------------------------------------------------------------
revno: 21183
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-24 14:06:45 +0700
message:
Updated handling of attribute value import in dxf2 importer
removed:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolation.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolations.java
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolation.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolations.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
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/schema/DefaultSchemaValidator.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/SchemaValidator.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ValidationViolationsWebMessageResponse.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebMessageUtils.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-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-11-24 02:56:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-11-24 07:06:45 +0000
@@ -30,6 +30,7 @@
import org.hisp.dhis.attribute.exception.NonUniqueAttributeValueException;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.validation.ValidationViolation;
import java.util.List;
import java.util.Set;
@@ -182,6 +183,8 @@
*/
int getAttributeValueCount();
+ <T extends IdentifiableObject> List<ValidationViolation> validateAttributeValues( T object, Set<AttributeValue> attributeValues );
+
<T extends IdentifiableObject> void updateAttributeValues( T object, List<String> jsonAttributeValues ) throws Exception;
<T extends IdentifiableObject> void updateAttributeValues( T object, Set<AttributeValue> attributeValues ) throws Exception;
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolation.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolation.java 2015-11-24 07:06:45 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.validation;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JsonPropertyOrder( {
+ "message"
+} )
+@JacksonXmlRootElement( localName = "validationViolation", namespace = DxfNamespaces.DXF_2_0 )
+public class ValidationViolation
+{
+ private String property;
+
+ private String message;
+
+ private Object value;
+
+ public ValidationViolation( String property, String message )
+ {
+ this.property = property;
+ this.message = message;
+ }
+
+ public ValidationViolation( String property, String message, Object value )
+ {
+ this.property = property;
+ this.message = message;
+ this.value = value;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getProperty()
+ {
+ return property;
+ }
+
+ public void setProperty( String property )
+ {
+ this.property = property;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage( String message )
+ {
+ this.message = message;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Object value )
+ {
+ this.value = value;
+ }
+
+ @Override public String toString()
+ {
+ final StringBuilder sb = new StringBuilder( "ValidationViolation{" );
+ sb.append( "property='" ).append( property ).append( '\'' );
+ sb.append( ", message='" ).append( message ).append( '\'' );
+ sb.append( ", value=" ).append( value );
+ sb.append( '}' );
+ return sb.toString();
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolations.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolations.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationViolations.java 2015-11-24 07:06:45 +0000
@@ -0,0 +1,71 @@
+package org.hisp.dhis.validation;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Temporary wrapper for ValidationViolation
+ *
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "validationViolations", namespace = DxfNamespaces.DXF_2_0 )
+public class ValidationViolations
+{
+ private List<ValidationViolation> validationViolations = new ArrayList<>();
+
+ public ValidationViolations()
+ {
+ }
+
+ public ValidationViolations( List<ValidationViolation> validationViolations )
+ {
+ this.validationViolations = validationViolations;
+ }
+
+ @JsonProperty
+ @JacksonXmlElementWrapper( localName = "validationViolations", namespace = DxfNamespaces.DXF_2_0, useWrapping = false )
+ @JacksonXmlProperty( localName = "validationViolation", namespace = DxfNamespaces.DXF_2_0 )
+ public List<ValidationViolation> getValidationViolations()
+ {
+ return validationViolations;
+ }
+
+ public void setValidationViolations( List<ValidationViolation> validationViolations )
+ {
+ this.validationViolations = validationViolations;
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-11-24 02:56:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-11-24 07:06:45 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.validation.ValidationViolation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
@@ -273,6 +274,53 @@
}
@Override
+ public <T extends IdentifiableObject> List<ValidationViolation> validateAttributeValues( T object, Set<AttributeValue> attributeValues )
+ {
+ List<ValidationViolation> validationViolations = new ArrayList<>();
+
+ Map<String, AttributeValue> attributeValueMap = attributeValues.stream()
+ .collect( Collectors.toMap( av -> av.getAttribute().getUid(), av -> av ) );
+
+ Iterator<AttributeValue> iterator = object.getAttributeValues().iterator();
+ List<Attribute> mandatoryAttributes = getMandatoryAttributes( object.getClass() );
+
+ while ( iterator.hasNext() )
+ {
+ AttributeValue attributeValue = iterator.next();
+
+ if ( attributeValueMap.containsKey( attributeValue.getAttribute().getUid() ) )
+ {
+ AttributeValue av = attributeValueMap.get( attributeValue.getAttribute().getUid() );
+
+ if ( attributeValue.isUnique() )
+ {
+ if ( !manager.isAttributeValueUnique( object.getClass(), object, attributeValue.getAttribute(), av.getValue() ) )
+ {
+ validationViolations.add( new ValidationViolation( attributeValue.getAttribute().getUid(),
+ "Value '" + av.getValue() + "' already exists for attribute '"
+ + attributeValue.getAttribute().getName() + "' (" + attributeValue.getAttribute().getUid() + ")" ) );
+ }
+ }
+
+ attributeValueMap.remove( attributeValue.getAttribute().getUid() );
+ mandatoryAttributes.remove( attributeValue.getAttribute() );
+ }
+ }
+
+ for ( String uid : attributeValueMap.keySet() )
+ {
+ AttributeValue attributeValue = attributeValueMap.get( uid );
+ mandatoryAttributes.remove( attributeValue.getAttribute() );
+ }
+
+ mandatoryAttributes.stream()
+ .forEach( att -> validationViolations.add(
+ new ValidationViolation( att.getUid(), "Missing mandatory attribute '" + att.getDisplayName() + "' (" + att.getUid() + ")" ) ) );
+
+ return validationViolations;
+ }
+
+ @Override
public <T extends IdentifiableObject> void updateAttributeValues( T object, List<String> jsonAttributeValues ) throws Exception
{
updateAttributeValues( object, getJsonAttributeValues( jsonAttributeValues ) );
=== 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-11-24 06:16:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2015-11-24 07:06:45 +0000
@@ -60,7 +60,6 @@
import org.hisp.dhis.dxf2.metadata.handlers.ObjectHandler;
import org.hisp.dhis.dxf2.metadata.handlers.ObjectHandlerUtils;
import org.hisp.dhis.dxf2.schema.SchemaValidator;
-import org.hisp.dhis.dxf2.schema.ValidationViolation;
import org.hisp.dhis.eventchart.EventChart;
import org.hisp.dhis.eventreport.EventReport;
import org.hisp.dhis.expression.Expression;
@@ -83,6 +82,7 @@
import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.validation.ValidationRule;
+import org.hisp.dhis.validation.ValidationViolation;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Field;
@@ -302,6 +302,16 @@
}
NonIdentifiableObjects nonIdentifiableObjects = new NonIdentifiableObjects( user );
+ validationViolations = nonIdentifiableObjects.validate( object, object );
+
+ if ( !validationViolations.isEmpty() )
+ {
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "Validation Violations: " + validationViolations ) );
+
+ return false;
+ }
+
nonIdentifiableObjects.extract( object );
UserCredentials userCredentials = null;
@@ -409,6 +419,16 @@
}
NonIdentifiableObjects nonIdentifiableObjects = new NonIdentifiableObjects( user );
+ validationViolations = nonIdentifiableObjects.validate( persistedObject, object );
+
+ if ( !validationViolations.isEmpty() )
+ {
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "Validation Violations: " + validationViolations ) );
+
+ return false;
+ }
+
nonIdentifiableObjects.extract( object );
nonIdentifiableObjects.delete( persistedObject );
@@ -945,6 +965,32 @@
this.user = user;
}
+ public List<ValidationViolation> validate( T persistedObject, T object )
+ {
+ schema = schemaService.getDynamicSchema( object.getClass() );
+ List<ValidationViolation> validationViolations = new ArrayList<>();
+
+ if ( schema.havePersistedProperty( "attributeValues" ) )
+ {
+ for ( AttributeValue attributeValue : object.getAttributeValues() )
+ {
+ Attribute attribute = objectBridge.getObject( attributeValue.getAttribute() );
+
+ if ( attribute == null )
+ {
+ validationViolations.add( new ValidationViolation( attributeValue.getAttribute().getUid(),
+ "Unknown reference to " + attributeValue.getAttribute() + " on object " + attributeValue ) );
+ }
+
+ attributeValue.setAttribute( attribute );
+ }
+
+ validationViolations.addAll( attributeService.validateAttributeValues( persistedObject, object.getAttributeValues() ) );
+ }
+
+ return validationViolations;
+ }
+
public void extract( T object )
{
schema = schemaService.getDynamicSchema( object.getClass() );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java 2015-05-30 13:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java 2015-11-24 07:06:45 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.schema.SchemaService;
import org.hisp.dhis.system.util.ReflectionUtils;
import org.hisp.dhis.system.util.ValidationUtils;
+import org.hisp.dhis.validation.ValidationViolation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/SchemaValidator.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/SchemaValidator.java 2015-03-30 09:25:24 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/SchemaValidator.java 2015-11-24 07:06:45 +0000
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.validation.ValidationViolation;
+
import java.util.List;
/**
=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolation.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolation.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolation.java 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-package org.hisp.dhis.dxf2.schema;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.hisp.dhis.common.DxfNamespaces;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@JsonPropertyOrder( {
- "message"
-} )
-@JacksonXmlRootElement( localName = "validationViolation", namespace = DxfNamespaces.DXF_2_0 )
-public class ValidationViolation
-{
- private String property;
-
- private String message;
-
- private Object value;
-
- public ValidationViolation( String property, String message )
- {
- this.property = property;
- this.message = message;
- }
-
- public ValidationViolation( String property, String message, Object value )
- {
- this.property = property;
- this.message = message;
- this.value = value;
- }
-
- @JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getProperty()
- {
- return property;
- }
-
- public void setProperty( String property )
- {
- this.property = property;
- }
-
- @JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getMessage()
- {
- return message;
- }
-
- public void setMessage( String message )
- {
- this.message = message;
- }
-
- @JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public Object getValue()
- {
- return value;
- }
-
- public void setValue( Object value )
- {
- this.value = value;
- }
-
- @Override public String toString()
- {
- final StringBuilder sb = new StringBuilder( "ValidationViolation{" );
- sb.append( "property='" ).append( property ).append( '\'' );
- sb.append( ", message='" ).append( message ).append( '\'' );
- sb.append( ", value=" ).append( value );
- sb.append( '}' );
- return sb.toString();
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolations.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolations.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/ValidationViolations.java 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-package org.hisp.dhis.dxf2.schema;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.hisp.dhis.common.DxfNamespaces;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Temporary wrapper for ValidationViolation
- *
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@JacksonXmlRootElement( localName = "validationViolations", namespace = DxfNamespaces.DXF_2_0 )
-public class ValidationViolations
-{
- private List<ValidationViolation> validationViolations = new ArrayList<>();
-
- public ValidationViolations()
- {
- }
-
- public ValidationViolations( List<ValidationViolation> validationViolations )
- {
- this.validationViolations = validationViolations;
- }
-
- @JsonProperty
- @JacksonXmlElementWrapper( localName = "validationViolations", namespace = DxfNamespaces.DXF_2_0, useWrapping = false )
- @JacksonXmlProperty( localName = "validationViolation", namespace = DxfNamespaces.DXF_2_0 )
- public List<ValidationViolation> getValidationViolations()
- {
- return validationViolations;
- }
-
- public void setValidationViolations( List<ValidationViolation> validationViolations )
- {
- this.validationViolations = validationViolations;
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ValidationViolationsWebMessageResponse.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ValidationViolationsWebMessageResponse.java 2015-10-13 08:24:58 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ValidationViolationsWebMessageResponse.java 2015-11-24 07:06:45 +0000
@@ -32,7 +32,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.dxf2.schema.ValidationViolation;
+import org.hisp.dhis.validation.ValidationViolation;
import org.hisp.dhis.dxf2.webmessage.AbstractWebMessageResponse;
import java.util.ArrayList;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java 2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java 2015-11-24 07:06:45 +0000
@@ -37,7 +37,7 @@
import org.hisp.dhis.dxf2.metadata.MetaData;
import org.hisp.dhis.dxf2.render.RenderService;
import org.hisp.dhis.dxf2.schema.SchemaValidator;
-import org.hisp.dhis.dxf2.schema.ValidationViolation;
+import org.hisp.dhis.validation.ValidationViolation;
import org.hisp.dhis.maintenance.MaintenanceService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.resourcetable.ResourceTableService;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java 2015-10-20 03:28:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java 2015-11-24 07:06:45 +0000
@@ -31,7 +31,7 @@
import com.google.common.collect.Lists;
import org.hisp.dhis.dxf2.render.RenderService;
import org.hisp.dhis.dxf2.schema.SchemaValidator;
-import org.hisp.dhis.dxf2.schema.ValidationViolation;
+import org.hisp.dhis.validation.ValidationViolation;
import org.hisp.dhis.dxf2.webmessage.WebMessage;
import org.hisp.dhis.fieldfilter.FieldFilterService;
import org.hisp.dhis.node.NodeUtils;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebMessageUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebMessageUtils.java 2015-10-13 08:24:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebMessageUtils.java 2015-11-24 07:06:45 +0000
@@ -32,7 +32,7 @@
import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.dxf2.metadata.ImportTypeSummary;
-import org.hisp.dhis.dxf2.schema.ValidationViolation;
+import org.hisp.dhis.validation.ValidationViolation;
import org.hisp.dhis.dxf2.webmessage.WebMessage;
import org.hisp.dhis.dxf2.webmessage.WebMessageStatus;
import org.hisp.dhis.dxf2.webmessage.responses.ValidationViolationsWebMessageResponse;