dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20982
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9820: Translation for Validation Criteria.
------------------------------------------------------------
revno: 9820
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-18 10:55:08 +0700
message:
Translation for Validation Criteria.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationCriteriaService.java
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/org/hisp/dhis/validation/hibernate/ValidationCriteria.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm
--
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/validation/ValidationCriteria.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2013-02-13 06:42:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2013-02-18 03:55:08 +0000
@@ -31,6 +31,8 @@
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
@@ -39,8 +41,9 @@
* @author Lars Helge Overland
* @version $Id$
*/
-@JacksonXmlRootElement(localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0)
+@JacksonXmlRootElement( localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0 )
public class ValidationCriteria
+ extends BaseIdentifiableObject
{
public static final int OPERATOR_LESS_THAN = -1;
@@ -52,10 +55,6 @@
// Fields
// -------------------------------------------------------------------------
- private int id;
-
- private String name;
-
private String description;
private String property;
@@ -104,29 +103,6 @@
// Getters && Setters
// -------------------------------------------------------------------------
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationCriteriaService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationCriteriaService.java 2010-05-28 19:17:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationCriteriaService.java 2013-02-18 03:55:08 +0000
@@ -27,9 +27,12 @@
package org.hisp.dhis.validation;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
import java.util.Collection;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
+import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -44,13 +47,20 @@
// Dependency
// -------------------------------------------------------------------------
- private GenericIdentifiableObjectStore<ValidationCriteria> validationCriteriaStore;
+ private GenericNameableObjectStore<ValidationCriteria> validationCriteriaStore;
- public void setValidationCriteriaStore( GenericIdentifiableObjectStore<ValidationCriteria> validationCriteriaStore )
+ public void setValidationCriteriaStore( GenericNameableObjectStore<ValidationCriteria> validationCriteriaStore )
{
this.validationCriteriaStore = validationCriteriaStore;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
// -------------------------------------------------------------------------
// ValidationCriteria implementation
// -------------------------------------------------------------------------
@@ -58,13 +68,13 @@
public int saveValidationCriteria( ValidationCriteria validationCriteria )
{
return validationCriteriaStore.save( validationCriteria );
- }
+ }
public void updateValidationCriteria( ValidationCriteria validationCriteria )
{
validationCriteriaStore.update( validationCriteria );
}
-
+
public void deleteValidationCriteria( ValidationCriteria validationCriteria )
{
validationCriteriaStore.delete( validationCriteria );
@@ -72,17 +82,17 @@
public ValidationCriteria getValidationCriteria( int id )
{
- return validationCriteriaStore.get( id );
+ return i18n( i18nService, validationCriteriaStore.get( id ) );
}
public Collection<ValidationCriteria> getAllValidationCriterias()
{
- return validationCriteriaStore.getAll();
+ return i18n( i18nService, validationCriteriaStore.getAll() );
}
-
+
public ValidationCriteria getValidationCriteria( String name )
{
- return validationCriteriaStore.getByName( name );
+ return i18n( i18nService, validationCriteriaStore.getByName( name ) );
}
}
=== 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 2013-01-28 06:59:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-02-18 03:55:08 +0000
@@ -224,7 +224,7 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
- <bean id="org.hisp.dhis.validation.ValidationCriteriaStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+ <bean id="org.hisp.dhis.validation.ValidationCriteriaStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.validation.ValidationCriteria" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
@@ -506,6 +506,7 @@
<bean id="org.hisp.dhis.validation.ValidationCriteriaService" class="org.hisp.dhis.validation.DefaultValidationCriteriaService">
<property name="validationCriteriaStore" ref="org.hisp.dhis.validation.ValidationCriteriaStore" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
</bean>
<bean id="org.hisp.dhis.translation.TranslationService" class="org.hisp.dhis.translation.DefaultTranslationService">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationCriteria.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationCriteria.hbm.xml 2011-12-10 22:36:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationCriteria.hbm.xml 2013-02-18 03:55:08 +0000
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
<hibernate-mapping>
<class name="org.hisp.dhis.validation.ValidationCriteria" table="validationcriteria">
@@ -10,9 +12,7 @@
<generator class="native" />
</id>
- <property name="name">
- <column name="name" not-null="true" unique="true" length="230" />
- </property>
+ <property name="name" column="name" not-null="true" unique="true" length="230" />
<property name="description" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm 2012-10-22 04:00:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm 2013-02-18 03:55:08 +0000
@@ -24,11 +24,12 @@
<tbody id="list">
#foreach($criteria in $criterias)
<tr id="tr${criteria.id}">
- <td>$criteria.name</td>
+ <td>$criteria.displayName</td>
<td>
<a href="showProgramsForValidationCriteriaForm.action?criteriaId=$criteria.id" title="$i18n.getString( 'assign_validation_for_programs' )"><img src="../images/assign.png" alt="$i18n.getString( 'assign_validation_for_programs' )"></a>
<a href="showUpdateValidationCriteriaForm.action?id=$criteria.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.getName() )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:translate( 'ValidationCriteria', '$criteria.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.displayName )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
<a href="javascript:showValidationCriteriaDetails( '$criteria.id' )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
</td>
</tr>