← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19335: Trim all strings to null for all object in program maintenance web module

 

------------------------------------------------------------
revno: 19335
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-06-10 17:20:38 +0700
message:
  Trim all strings to null for all object in program maintenance web module
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/AddCaseAggregationConditionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/UpdateCaseAggregationConditionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/AddRelationshipTypeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/UpdateRelationshipTypeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddProgramValidationAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddValidationCriteriaAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateProgramValidationAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateValidationCriteriaAction.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/AddCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/AddCaseAggregationConditionAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/AddCaseAggregationConditionAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang.StringUtils;
+
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
 import org.hisp.dhis.dataelement.DataElement;
@@ -140,9 +142,14 @@
         DataElementCategoryOptionCombo optionCombo = dataElementCategoryService
             .getDataElementCategoryOptionCombo( Integer.parseInt( ids[1] ) );
 
-        CaseAggregationCondition condition = new CaseAggregationCondition( name, operator, aggregationCondition,
-            aggregationDataElement, optionCombo );
+        CaseAggregationCondition condition = new CaseAggregationCondition();
 
+        condition.setName( StringUtils.trimToNull( name ) );
+        condition.setAggregationExpression( aggregationCondition );
+        condition.setOperator(  operator );
+        condition.setAggregationDataElement( aggregationDataElement );
+        condition.setOptionCombo( optionCombo );
+        
         if ( deSumId != null )
         {
             DataElement deSum = dataElementService.getDataElement( deSumId );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/UpdateCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/UpdateCaseAggregationConditionAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/UpdateCaseAggregationConditionAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
 import org.hisp.dhis.dataelement.DataElement;
@@ -148,11 +149,12 @@
 
         CaseAggregationCondition expression = aggregationConditionService.getCaseAggregationCondition( id );
 
+        expression.setName( StringUtils.trimToNull( name ) );
+        expression.setAggregationExpression( aggregationCondition );
         expression.setOperator( operator );
-        expression.setAggregationExpression( aggregationCondition );
-        expression.setName( name );
         expression.setAggregationDataElement( aggregationDataElement );
         expression.setOptionCombo( optionCombo );
+        
         if ( deSumId != null )
         {
             DataElement deSum = dataElementService.getDataElement( deSumId );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveDataEntryFormAction.java	2015-02-18 14:35:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveDataEntryFormAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.program.Program;
@@ -145,16 +146,15 @@
         {
             program.increaseVersion();
             
-            dataEntryForm = new DataEntryForm( name, designTextarea );
+            dataEntryForm = new DataEntryForm( StringUtils.trimToNull( name ), designTextarea );
             dataEntryFormService.addDataEntryForm( dataEntryForm );
         }
         else
-        {
-            
-            dataEntryForm.setName( name );
+        {  
+            dataEntryForm.setName( StringUtils.trimToNull( name ) );
             dataEntryForm.setHtmlCode( designTextarea );
             dataEntryFormService.updateDataEntryForm( dataEntryForm );
-        }            
+        }          
 
         programStage.setDataEntryForm( dataEntryForm );
         programStageService.updateProgramStage( programStage );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java	2015-02-18 14:35:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.program.Program;
@@ -110,6 +111,9 @@
     public String execute()
         throws Exception
     {
+        name = StringUtils.trimToNull( name );
+        designTextarea = StringUtils.trimToNull( designTextarea );
+       
         TrackedEntityForm registrationForm = null;
 
         Program program = null;
@@ -127,7 +131,7 @@
         // ---------------------------------------------------------------------
         // Save data-entry-form
         // ---------------------------------------------------------------------
-
+        
         if ( registrationForm == null )
         {
             registrationForm = new TrackedEntityForm();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java	2015-03-31 16:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java	2015-06-10 10:20:38 +0000
@@ -367,11 +367,11 @@
         ProgramStage programStage = new ProgramStage();
         Program program = programService.getProgram( id );
 
-        programStage.setName( name );
-        programStage.setDescription( description );
+        programStage.setName( StringUtils.trimToNull( name ) );
+        programStage.setDescription( StringUtils.trimToNull( description ) );
         programStage.setProgram( program );
         programStage.setStandardInterval( standardInterval );
-        programStage.setReportDateDescription( reportDateDescription );
+        programStage.setReportDateDescription( StringUtils.trimToNull( reportDateDescription ) );
         programStage.setIrregular( irregular );
         programStage.setMinDaysFromStart( minDaysFromStart );
         programStage.setDisplayGenerateEventBox( displayGenerateEventBox );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java	2015-03-29 09:47:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java	2015-06-10 10:20:38 +0000
@@ -30,6 +30,7 @@
 
 import com.opensymphony.xwork2.Action;
 
+import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.program.ProgramIndicator;
@@ -140,7 +141,7 @@
             psDataElements.add( psDataElement );
         }
 
-        ProgramStageSection section = new ProgramStageSection( name, psDataElements, programStage
+        ProgramStageSection section = new ProgramStageSection( StringUtils.trimToNull( name ), psDataElements, programStage
             .getProgramStageSections().size() );
 
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-03-31 16:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-06-10 10:20:38 +0000
@@ -357,10 +357,10 @@
 
         ProgramStage programStage = programStageService.getProgramStage( id );
 
-        programStage.setName( name );
-        programStage.setDescription( description );
+        programStage.setName( StringUtils.trimToNull( name ) );
+        programStage.setDescription( StringUtils.trimToNull( description ) );
         programStage.setStandardInterval( standardInterval );
-        programStage.setReportDateDescription( reportDateDescription );
+        programStage.setReportDateDescription( StringUtils.trimToNull( reportDateDescription ) );
         programStage.setMinDaysFromStart( minDaysFromStart );
         programStage.setIrregular( irregular );
         programStage.setMinDaysFromStart( minDaysFromStart );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java	2015-03-31 09:57:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java	2015-06-10 10:20:38 +0000
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.program.ProgramIndicator;
@@ -147,7 +148,7 @@
         // ---------------------------------------------------------------------
 
         ProgramStageSection section = programStageSectionService.getProgramStageSection( id );
-        section.setName( name );
+        section.setName( StringUtils.trimToNull( name ) );
         
         List<ProgramStageDataElement> psDataElements = new ArrayList<>();
         for ( Integer id : dataElementIds )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/AddRelationshipTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/AddRelationshipTypeAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/AddRelationshipTypeAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.relationship.RelationshipTypeService;
 
@@ -87,9 +88,9 @@
 
         RelationshipType relationshipType = new RelationshipType();
 
-        relationshipType.setaIsToB( aIsToB );
-        relationshipType.setbIsToA( bIsToA );
-        relationshipType.setName( name );
+        relationshipType.setaIsToB( StringUtils.trimToNull( aIsToB ) );
+        relationshipType.setbIsToA( StringUtils.trimToNull( bIsToA ) );
+        relationshipType.setName(StringUtils.trimToNull( name ) );
 
         relationshipTypeService.addRelationshipType( relationshipType );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/UpdateRelationshipTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/UpdateRelationshipTypeAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/relationship/UpdateRelationshipTypeAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.relationship.RelationshipTypeService;
 
@@ -93,9 +94,9 @@
     {
         RelationshipType relationshipType = relationshipTypeService.getRelationshipType( id );
 
-        relationshipType.setaIsToB( aIsToB );
-        relationshipType.setbIsToA( bIsToA );
-        relationshipType.setName( name );
+        relationshipType.setaIsToB( StringUtils.trimToNull( aIsToB ) );
+        relationshipType.setbIsToA( StringUtils.trimToNull( bIsToA ) );
+        relationshipType.setName(StringUtils.trimToNull( name ) );
 
         relationshipTypeService.updateRelationshipType( relationshipType );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-04-08 04:43:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-06-10 10:20:38 +0000
@@ -193,10 +193,10 @@
     {
         TrackedEntityAttribute trackedEntityAttribute = new TrackedEntityAttribute();
 
-        trackedEntityAttribute.setName( name );
-        trackedEntityAttribute.setShortName( shortName );
-        trackedEntityAttribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
-        trackedEntityAttribute.setDescription( description );
+        trackedEntityAttribute.setName( StringUtils.trimToNull( name ) );
+        trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
+        trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
+        trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
         trackedEntityAttribute.setValueType( valueType );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-04-08 04:43:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-06-10 10:20:38 +0000
@@ -200,10 +200,10 @@
     {
         TrackedEntityAttribute trackedEntityAttribute = trackedEntityAttributeService.getTrackedEntityAttribute( id );
 
-        trackedEntityAttribute.setName( name );
-        trackedEntityAttribute.setShortName( shortName );
-        trackedEntityAttribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
-        trackedEntityAttribute.setDescription( description );
+        trackedEntityAttribute.setName( StringUtils.trimToNull( name ) );
+        trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
+        trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
+        trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
         trackedEntityAttribute.setValueType( valueType );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java	2015-06-10 10:20:38 +0000
@@ -29,6 +29,8 @@
  */
 
 import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService;
@@ -101,8 +103,8 @@
     {
         TrackedEntityAttributeGroup attributeGroup = new TrackedEntityAttributeGroup();
 
-        attributeGroup.setName( name );
-        attributeGroup.setDescription( description );
+        attributeGroup.setName( StringUtils.trimToNull( name ) );
+        attributeGroup.setDescription( StringUtils.trimToNull( description ) );
 
         List<TrackedEntityAttribute> attributes = new ArrayList<>();
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java	2015-06-10 10:20:38 +0000
@@ -29,6 +29,8 @@
  */
 
 import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService;
@@ -108,8 +110,8 @@
     {
         TrackedEntityAttributeGroup attributeGroup = attributeGroupService.getTrackedEntityAttributeGroup( id );
 
-        attributeGroup.setName( name );
-        attributeGroup.setDescription( description );
+        attributeGroup.setName( StringUtils.trimToNull( name ) );
+        attributeGroup.setDescription( StringUtils.trimToNull( description ) );
 
         List<TrackedEntityAttribute> attributes = new ArrayList<>();
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
@@ -144,7 +145,7 @@
     {
         Program program = programService.getProgram( programId );
 
-        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( name, daysAllowedSendMessage, templateMessage );
+        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( StringUtils.trimToNull( name ), daysAllowedSendMessage, StringUtils.trimToNull( templateMessage ) );
         reminder.setDateToCompare( datesToCompare );
         reminder.setSendTo( sendTo );
         reminder.setWhenToSend( whenToSend );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
@@ -144,8 +145,8 @@
     {
         ProgramStage programStage = programStageService.getProgramStage( programStageId );
 
-        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( name, daysAllowedSendMessage,
-            templateMessage );
+        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( StringUtils.trimToNull( name ), daysAllowedSendMessage,
+            StringUtils.trimToNull( templateMessage ) );
         reminder.setDateToCompare( datesToCompare );
         reminder.setSendTo( sendTo );
         reminder.setWhenToSend( whenToSend );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramReminderAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramReminderAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
@@ -160,9 +161,9 @@
         Program program = programService.getProgram( programId );
 
         TrackedEntityInstanceReminder reminder = reminderService.getReminder( id );
-        reminder.setName( name );
+        reminder.setName( StringUtils.trimToNull( name ) );
         reminder.setDaysAllowedSendMessage( daysAllowedSendMessage );
-        reminder.setTemplateMessage( templateMessage );
+        reminder.setTemplateMessage( StringUtils.trimToNull( templateMessage ) );
         reminder.setDateToCompare( datesToCompare );
         reminder.setSendTo( sendTo );
         reminder.setWhenToSend( whenToSend );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
@@ -160,9 +161,9 @@
         ProgramStage programStage = programStageService.getProgramStage( programStageId );
 
         TrackedEntityInstanceReminder reminder = reminderService.getReminder( id );
-        reminder.setName( name );
+        reminder.setName( StringUtils.trimToNull( name ) );
         reminder.setDaysAllowedSendMessage( daysAllowedSendMessage );
-        reminder.setTemplateMessage( templateMessage );
+        reminder.setTemplateMessage( StringUtils.trimToNull( templateMessage ) );
         reminder.setDateToCompare( datesToCompare );
         reminder.setSendTo( sendTo );
         reminder.setWhenToSend( whenToSend );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddProgramValidationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddProgramValidationAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddProgramValidationAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramExpression;
@@ -128,11 +129,11 @@
     public String execute()
         throws Exception
     {
-        ProgramExpression leftExpression = new ProgramExpression( leftSideExpression, leftSideDescription );
-        ProgramExpression rightExpression = new ProgramExpression( rightSideExpression, rightSideDescription );
+        ProgramExpression leftExpression = new ProgramExpression( leftSideExpression, StringUtils.trimToNull( leftSideDescription ) );
+        ProgramExpression rightExpression = new ProgramExpression( rightSideExpression, StringUtils.trimToNull( rightSideDescription ) );
 
         ProgramValidation validation = new ProgramValidation();
-        validation.setName( name.trim() );
+        validation.setName( StringUtils.trimToNull( name ) );
         validation.setOperator( Operator.valueOf( operator ) );
         validation.setLeftSide( leftExpression );
         validation.setRightSide( rightExpression );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddValidationCriteriaAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/AddValidationCriteriaAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.validation.ValidationCriteria;
@@ -125,8 +126,8 @@
     {
         ValidationCriteria criteria = new ValidationCriteria();
 
-        criteria.setName( name );
-        criteria.setDescription( description );
+        criteria.setName( StringUtils.trimToNull( name ) );
+        criteria.setDescription( StringUtils.trimToNull( description ) );
         criteria.setProperty( property );
         criteria.setOperator( operator );
         criteria.setValue( value );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateProgramValidationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateProgramValidationAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateProgramValidationAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramExpression;
@@ -136,10 +137,10 @@
     {
         ProgramValidation validation = programValidationService.getProgramValidation( id );
 
-        ProgramExpression leftExpression = new ProgramExpression( leftSideExpression, leftSideDescription );
-        ProgramExpression rightExpression = new ProgramExpression( rightSideExpression, rightSideDescription );
+        ProgramExpression leftExpression = new ProgramExpression( leftSideExpression, StringUtils.trimToNull( leftSideDescription ) );
+        ProgramExpression rightExpression = new ProgramExpression( rightSideExpression, StringUtils.trimToNull( rightSideDescription ) );
 
-        validation.setName( name.trim() );
+        validation.setName( StringUtils.trimToNull( name ) );
         validation.setOperator( Operator.valueOf( operator ) );
         validation.setLeftSide( leftExpression );
         validation.setRightSide( rightExpression );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateValidationCriteriaAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/validation/UpdateValidationCriteriaAction.java	2015-06-10 10:20:38 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.hisp.dhis.validation.ValidationCriteriaService;
 
@@ -123,11 +124,11 @@
     {
         ValidationCriteria criteria = validationCriteriaService.getValidationCriteria( id );
 
-        criteria.setName( name );
-        criteria.setDescription( description );
+        criteria.setName( StringUtils.trimToNull( name ) );
+        criteria.setDescription( StringUtils.trimToNull( description ) );
         criteria.setProperty( property );
         criteria.setOperator( operator );
-        criteria.setValue( value );
+        criteria.setValue( StringUtils.trimToNull( value ) );
 
         validationCriteriaService.updateValidationCriteria( criteria );