=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java 2012-07-25 13:18:48 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java 2013-06-26 12:31:29 +0000 @@ -51,7 +51,7 @@ * @param dataElement the DataElement. * @param categoryOptionCombo the DataElementCategoryOptionCombo. * @param organisationUnit the OrganisationUnit. - * @return the standard deviation. + * @return a mapping between organisation unit identifier and its standard deviation. */ Map getStandardDeviation( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, Set organisationUnits ); @@ -62,10 +62,20 @@ * @param dataElement the DataElement. * @param categoryOptionCombo the DataElementCategoryOptionCombo. * @param organisationUnit the OrganisationUnit. - * @return the average. + * @return a mapping between organisation unit identifier and its average data value. */ Map getAverage( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, Set organisationUnits ); + /** + * Generates a collection of data value violations of min-max predefined values. + * + * @param dataElements the data elements. + * @param categoryOptionCombos the category option combos. + * @param periods the periods. + * @param organisationUnits the organisation units. + * @param limit the max limit of violations to return. + * @return a collection of data value violations. + */ Collection getMinMaxViolations( Collection dataElements, Collection categoryOptionCombos, Collection periods, Collection organisationUnits, int limit ); === modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2013-06-23 18:19:54 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2013-06-26 12:31:29 +0000 @@ -374,6 +374,14 @@ summary.getConflicts().add( new ImportConflict( DataValue.class.getSimpleName(), valueValid ) ); continue; } + + String commentValid = ValidationUtils.commentIsValid( dataValue.getComment() ); + + if ( commentValid != null ) + { + summary.getConflicts().add( new ImportConflict( DataValue.class.getSimpleName(), commentValid ) ); + continue; + } if ( periodMap.containsKey( dataValue.getPeriod() ) ) { === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml 2012-11-07 08:12:06 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml 2013-06-26 12:31:29 +0000 @@ -13,7 +13,7 @@ - + === 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 2013-05-17 06:44:41 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2013-06-26 12:31:29 +0000 @@ -217,7 +217,6 @@ * values are: *

*

    - *
  • value_null_or_empty
  • *
  • data_element_or_type_null_or_empty
  • *
  • value_length_greater_than_max_length
  • *
  • value_not_numeric
  • @@ -280,4 +279,30 @@ return null; } + + /** + * Checks if the given comment is valid. Returns null if valid and a string + * if invalid, possible values are: + *

    + *
      + *
    • comment_too_long
    • + *
    + * + * @param comment the comment. + * @return null if the comment is valid, a string if not. + */ + public static String commentIsValid( String comment ) + { + if ( comment == null || comment.trim().isEmpty() ) + { + return null; + } + + if ( comment.length() > 360 ) + { + return "comment_too_long"; + } + + return null; + } } === modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-05-30 11:20:45 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-06-26 12:31:29 +0000 @@ -316,4 +316,12 @@ dxf2=DXF2 metadata_import=Meta-Data Import metadata_export=Meta-Data Export -gml_import=GML Import \ No newline at end of file +gml_import=GML Import +data_element_or_type_null_or_empty=Data element or type is null or empty +value_length_greater_than_max_length=Value is greater than max length +value_not_numeric=Value is not numeric +value_not_integer=Value is not a valid integer +value_not_positive_integer=Value is not a valid positive integer +value_not_negative_integer=Value is not a valid negative integer +value_is_zero_and_not_zero_significant=Value is zero and not zero-significant +comment_too_long=Comment is too long \ No newline at end of file