=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2012-01-22 08:38:11 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.hisp.dhis.i18n.I18nUtils.i18n; import static org.hisp.dhis.system.util.MathUtils.expressionIsTrue; import static org.hisp.dhis.system.util.MathUtils.getRounded; @@ -36,6 +37,7 @@ import java.util.List; import java.util.Set; +import org.apache.commons.lang.StringUtils; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.common.Grid; import org.hisp.dhis.dataelement.DataElement; @@ -43,6 +45,7 @@ import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.expression.ExpressionService; +import org.hisp.dhis.i18n.I18nService; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; @@ -76,8 +79,7 @@ private GenericIdentifiableObjectStore validationRuleGroupStore; - public void setValidationRuleGroupStore( - GenericIdentifiableObjectStore validationRuleGroupStore ) + public void setValidationRuleGroupStore( GenericIdentifiableObjectStore validationRuleGroupStore ) { this.validationRuleGroupStore = validationRuleGroupStore; } @@ -110,6 +112,13 @@ this.dataElementService = dataElementService; } + private I18nService i18nService; + + public void setI18nService( I18nService service ) + { + i18nService = service; + } + // ------------------------------------------------------------------------- // ValidationRule business logic // ------------------------------------------------------------------------- @@ -129,7 +138,7 @@ } grid.addRow(); - grid.addValue( "" ); + grid.addValue( StringUtils.EMPTY ); for ( Period period : periods ) { @@ -392,22 +401,22 @@ public ValidationRule getValidationRule( int id ) { - return validationRuleStore.get( id ); + return i18n( i18nService, validationRuleStore.get( id ) ); } public ValidationRule getValidationRule( String uid ) { - return validationRuleStore.getByUid( uid ); + return i18n( i18nService, validationRuleStore.getByUid( uid ) ); } public ValidationRule getValidationRuleByName( String name ) { - return validationRuleStore.getByName( name ); + return i18n( i18nService, validationRuleStore.getByName( name ) ); } public Collection getAllValidationRules() { - return validationRuleStore.getAll(); + return i18n( i18nService, validationRuleStore.getAll() ); } public Collection getValidationRules( final Collection identifiers ) @@ -425,12 +434,32 @@ public Collection getValidationRulesByName( String name ) { - return validationRuleStore.getLikeName( name ); + return i18n( i18nService, validationRuleStore.getLikeName( name ) ); } public Collection getValidationRulesByDataElements( Collection dataElements ) { - return validationRuleStore.getValidationRulesByDataElements( dataElements ); + return i18n( i18nService, validationRuleStore.getValidationRulesByDataElements( dataElements ) ); + } + + public int getValidationRuleCount() + { + return validationRuleStore.getCount(); + } + + public int getValidationRuleCountByName( String name ) + { + return validationRuleStore.getCountByName( name ); + } + + public Collection getValidationRulesBetween( int first, int max ) + { + return i18n( i18nService, validationRuleStore.getBetween( first, max ) ); + } + + public Collection getValidationRulesBetweenByName( String name, int first, int max ) + { + return i18n( i18nService, validationRuleStore.getBetweenByName( name, first, max ) ); } // ------------------------------------------------------------------------- @@ -454,42 +483,22 @@ public ValidationRuleGroup getValidationRuleGroup( int id ) { - return validationRuleGroupStore.get( id ); + return i18n( i18nService, validationRuleGroupStore.get( id ) ); } public ValidationRuleGroup getValidationRuleGroup( String uid ) { - return validationRuleGroupStore.getByUid( uid ); + return i18n( i18nService, validationRuleGroupStore.getByUid( uid ) ); } public Collection getAllValidationRuleGroups() { - return validationRuleGroupStore.getAll(); + return i18n( i18nService, validationRuleGroupStore.getAll() ); } public ValidationRuleGroup getValidationRuleGroupByName( String name ) { - return validationRuleGroupStore.getByName( name ); - } - - public int getValidationRuleCount() - { - return validationRuleStore.getCount(); - } - - public int getValidationRuleCountByName( String name ) - { - return validationRuleStore.getCountByName( name ); - } - - public Collection getValidationRulesBetween( int first, int max ) - { - return validationRuleStore.getBetween( first, max ); - } - - public Collection getValidationRulesBetweenByName( String name, int first, int max ) - { - return validationRuleStore.getBetweenByName( name, first, max ); + return i18n( i18nService, validationRuleGroupStore.getByName( name ) ); } public int getValidationRuleGroupCount() @@ -504,12 +513,11 @@ public Collection getValidationRuleGroupsBetween( int first, int max ) { - return validationRuleGroupStore.getBetween( first, max ); + return i18n( i18nService, validationRuleGroupStore.getBetween( first, max ) ); } public Collection getValidationRuleGroupsBetweenByName( String name, int first, int max ) { - return validationRuleGroupStore.getBetweenByName( name, first, max ); + return i18n( i18nService, validationRuleGroupStore.getBetweenByName( name, first, max ) ); } - } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-01-22 08:21:22 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-01-22 08:38:11 +0000 @@ -343,7 +343,8 @@ - + + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm 2011-09-26 09:31:56 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm 2012-01-22 08:38:11 +0000 @@ -37,7 +37,7 @@ - + @@ -48,12 +48,13 @@ #foreach( $validationRule in $validationRulesList ) - + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRuleGroup.vm' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRuleGroup.vm 2011-03-18 14:58:26 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRuleGroup.vm 2012-01-22 08:38:11 +0000 @@ -20,7 +20,7 @@
$i18n.getString( "name" )
$!encoder.htmlEncode( $validationRule.name )$!encoder.htmlEncode( $validationRule.displayName ) $i18n.getString($!validationRule.periodType.name) $i18n.getString( 'edit' ) + $i18n.getString( 'translation_translate' ) #if( $auth.hasAccess( "dhis-web-validationrule", "removeValidationRule" ) ) - $i18n.getString( 'remove' ) + $i18n.getString( 'remove' ) #else #end $i18n.getString( 'show_details' )
- + @@ -30,11 +30,12 @@ #foreach( $group in $validationRuleGroups ) - +
$i18n.getString( "name" )
$!encoder.htmlEncode( $group.name )$!encoder.htmlEncode( $group.displayName ) $i18n.getString( + $i18n.getString( 'translation_translate' ) #if( $auth.hasAccess( "dhis-web-validationrule", "removeValidationRuleGroup" ) ) - $i18n.getString( + $i18n.getString( #else #end $i18n.getString(