=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2014-12-17 14:17:16 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2015-02-13 13:17:36 +0000 @@ -908,6 +908,8 @@ value_not_bool=Data value is not a boolean value_not_true_only=Data value is not true value_not_valid_date=Data value is not a valid date +stored_by_length_greater_than_max_length=Stored by is greater than max length +comment_length_greater_than_max_length=Comment is greater than max length #-- calendars -----------------------------------------------------------------# === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2015-02-13 13:17:36 +0000 @@ -805,14 +805,21 @@ internalValue.setAttributeOptionCombo( attrOptionCombo ); internalValue.setValue( trimToNull( dataValue.getValue() ) ); + String storedByValid = ValidationUtils.storedByIsValid( dataValue.getStoredBy() ); + if ( dataValue.getStoredBy() == null || dataValue.getStoredBy().trim().isEmpty() ) { internalValue.setStoredBy( currentUser ); } - else + else if ( storedByValid == null ) { internalValue.setStoredBy( dataValue.getStoredBy() ); } + else + { + summary.getConflicts().add( new ImportConflict( dataValue.getStoredBy(), i18n.getString( storedByValid ) ) ); + continue; + } internalValue.setCreated( dataValue.hasCreated() ? parseDate( dataValue.getCreated() ) : now ); internalValue.setLastUpdated( dataValue.hasLastUpdated() ? parseDate( dataValue.getLastUpdated() ) : now ); === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2015-02-13 13:17:36 +0000 @@ -374,6 +374,32 @@ } /** + * Checks if the given stored by value is valid. Returns null if valid and a string + * if invalid, possible values are: + *

+ * + * + * @param storedBy the stored by value. + * @return null if the stored by value is valid, a string if not. + */ + public static String storedByIsValid( String storedBy ) + { + if ( storedBy == null || storedBy.trim().isEmpty() ) + { + return null; + } + + if ( storedBy.length() > 31 ) + { + return "stored_by_length_greater_than_max_length"; + } + + return null; + } + + /** * Checks to see if given parameter is a valid hex color string (#xxx and #xxxxxx, xxx, xxxxxx). * * @param value Value to check against