dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36274
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18579: Maintenance. Trimming values to null.
------------------------------------------------------------
revno: 18579
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-03-11 12:01:16 +0100
message:
Maintenance. Trimming values to null.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/AddDataElementGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/UpdateDataElementGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/AddIndicatorGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/UpdateIndicatorGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/UpdateUserGroupAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/AddValidationRuleGroupAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/UpdateValidationRuleGroupAction.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2015-03-06 15:02:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2015-03-11 11:01:16 +0000
@@ -136,10 +136,6 @@
"name" : {
"required" : true,
"rangelength" : [ 2, 160 ]
- },
- "description" : {
- "required" : true,
- "rangelength" : [ 2, 255 ]
}
},
"dataEntry" : {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -101,8 +102,8 @@
public String execute()
{
DataElementCategory dataElementCategory = new DataElementCategory();
- dataElementCategory.setName( name );
- dataElementCategory.setCode( code );
+ dataElementCategory.setName( StringUtils.trimToNull( name ) );
+ dataElementCategory.setCode( StringUtils.trimToNull( code ) );
dataElementCategory.setDataDimension( dataDimension );
dataElementCategory.setDataDimensionType( dimensionType );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java 2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java 2015-03-11 11:01:16 +0000
@@ -121,26 +121,24 @@
@Override
public String execute()
{
- code = StringUtils.trimToNull( code );
-
Date sDate = null;
Date eDate = null;
- if ( startDate != null && startDate.trim().length() != 0 )
+ if ( startDate != null && !startDate.isEmpty() )
{
DateTimeUnit isoStartDate = calendarService.getSystemCalendar().toIso( startDate );
sDate = isoStartDate.toJdkCalendar().getTime();
}
- if ( endDate != null && endDate.trim().length() != 0 )
+ if ( endDate != null && !endDate.isEmpty() )
{
DateTimeUnit isoEndDate = calendarService.getSystemCalendar().toIso( endDate );
eDate = isoEndDate.toJdkCalendar().getTime();
}
- dataElementCategoryOption = new DataElementCategoryOption( name );
- dataElementCategoryOption.setShortName( shortName );
- dataElementCategoryOption.setCode( code );
+ dataElementCategoryOption = new DataElementCategoryOption( StringUtils.trimToNull( name ) );
+ dataElementCategoryOption.setShortName( StringUtils.trimToNull( shortName ) );
+ dataElementCategoryOption.setCode( StringUtils.trimToNull( code ) );
dataElementCategoryOption.setStartDate( sDate );
dataElementCategoryOption.setEndDate( eDate );
dataElementCategoryOption.getOrganisationUnits().addAll ( selectionManager.getSelectedOrganisationUnits() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java 2015-03-11 11:01:16 +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.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -78,7 +79,8 @@
public String execute()
{
DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( id );
- optionCombo.setCode( code );
+
+ optionCombo.setCode( StringUtils.trimToNull( code ) );
categoryService.updateDataElementCategoryOptionCombo( optionCombo );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -101,8 +102,8 @@
public String execute()
{
DataElementCategory dataElementCategory = dataElementCategoryService.getDataElementCategory( id );
- dataElementCategory.setName( name );
- dataElementCategory.setCode( code );
+ dataElementCategory.setName( StringUtils.trimToNull( name ) );
+ dataElementCategory.setCode( StringUtils.trimToNull( code ) );
dataElementCategory.setDataDimension( dataDimension );
dataElementCategory.getCategoryOptions().clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2015-03-11 11:01:16 +0000
@@ -134,22 +134,22 @@
Date sDate = null;
Date eDate = null;
- if ( startDate != null && startDate.trim().length() != 0 )
+ if ( startDate != null && !startDate.isEmpty() )
{
DateTimeUnit isoStartDate = calendarService.getSystemCalendar().toIso( startDate );
sDate = isoStartDate.toJdkCalendar().getTime();
}
- if ( endDate != null && endDate.trim().length() != 0 )
+ if ( endDate != null && !endDate.isEmpty() )
{
DateTimeUnit isoEndDate = calendarService.getSystemCalendar().toIso( endDate );
eDate = isoEndDate.toJdkCalendar().getTime();
}
DataElementCategoryOption categoryOption = dataElementCategoryService.getDataElementCategoryOption( id );
- categoryOption.setName( name );
- categoryOption.setShortName( shortName );
- categoryOption.setCode( code );
+ categoryOption.setName( StringUtils.trimToNull( name ) );
+ categoryOption.setShortName( StringUtils.trimToNull( shortName ) );
+ categoryOption.setCode( StringUtils.trimToNull( code ) );
categoryOption.setStartDate( sDate );
categoryOption.setEndDate( eDate );
categoryOption.getOrganisationUnits().clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -101,8 +102,8 @@
public String execute()
{
DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo();
- categoryCombo.setName( name );
- categoryCombo.setCode( code );
+ categoryCombo.setName( StringUtils.trimToNull( name ) );
+ categoryCombo.setCode( StringUtils.trimToNull( code ) );
categoryCombo.setDimensionType( dimensionType );
categoryCombo.setSkipTotal( skipTotal );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -100,11 +101,10 @@
@Override
public String execute()
{
- DataElementCategoryCombo categoryCombo = dataElementCategoryService
- .getDataElementCategoryCombo( id );
+ DataElementCategoryCombo categoryCombo = dataElementCategoryService.getDataElementCategoryCombo( id );
- categoryCombo.setName( name );
- categoryCombo.setCode( code );
+ categoryCombo.setName( StringUtils.trimToNull( name ) );
+ categoryCombo.setCode( StringUtils.trimToNull( code ) );
categoryCombo.setSkipTotal( skipTotal );
List<DataElementCategory> updatedCategories = new ArrayList<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -89,9 +91,9 @@
public String execute()
throws Exception
{
- CategoryOptionGroup categoryOptionGroup = new CategoryOptionGroup( name );
- categoryOptionGroup.setShortName( shortName );
- categoryOptionGroup.setCode( code );
+ CategoryOptionGroup categoryOptionGroup = new CategoryOptionGroup( StringUtils.trimToNull( name ) );
+ categoryOptionGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ categoryOptionGroup.setCode( StringUtils.trimToNull( code ) );
for ( String id : coSelected )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -97,9 +99,9 @@
throws Exception
{
CategoryOptionGroup categoryOptionGroup = dataElementCategoryService.getCategoryOptionGroup( id );
- categoryOptionGroup.setName( name );
- categoryOptionGroup.setShortName( shortName );
- categoryOptionGroup.setCode( code );
+ categoryOptionGroup.setName( StringUtils.trimToNull( name ) );
+ categoryOptionGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ categoryOptionGroup.setCode( StringUtils.trimToNull( code ) );
categoryOptionGroup.getMembers().clear();
for ( String id : coSelected )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -92,8 +94,8 @@
public String execute()
throws Exception
{
- CategoryOptionGroupSet categoryOptionGroupSet = new CategoryOptionGroupSet( name );
- categoryOptionGroupSet.setDescription( description );
+ CategoryOptionGroupSet categoryOptionGroupSet = new CategoryOptionGroupSet( StringUtils.trimToNull( name ) );
+ categoryOptionGroupSet.setDescription( StringUtils.trimToNull( description ) );
categoryOptionGroupSet.setDataDimension( dataDimension );
List<CategoryOptionGroup> members = new ArrayList<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -97,8 +99,8 @@
throws Exception
{
CategoryOptionGroupSet categoryOptionGroupSet = dataElementCategoryService.getCategoryOptionGroupSet( id );
- categoryOptionGroupSet.setName( name );
- categoryOptionGroupSet.setDescription( description );
+ categoryOptionGroupSet.setName( StringUtils.trimToNull( name ) );
+ categoryOptionGroupSet.setDescription( StringUtils.trimToNull( description ) );
categoryOptionGroupSet.setDataDimension( dataDimension );
categoryOptionGroupSet.getMembers().clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-03-11 11:01:16 +0000
@@ -106,13 +106,6 @@
this.name = name;
}
- private String alternativeName;
-
- public void setAlternativeName( String alternativeName )
- {
- this.alternativeName = alternativeName;
- }
-
private String shortName;
public void setShortName( String shortName )
@@ -246,19 +239,6 @@
@Override
public String execute()
{
- // ---------------------------------------------------------------------
- // Prepare values
- // ---------------------------------------------------------------------
-
- alternativeName = StringUtils.trimToNull( alternativeName );
- code = StringUtils.trimToNull( code );
- description = StringUtils.trimToNull( description );
- formName = StringUtils.trimToNull( formName );
-
- // ---------------------------------------------------------------------
- // Create data element
- // ---------------------------------------------------------------------
-
DataElement dataElement = new DataElement();
DataElementCategoryCombo categoryCombo = dataElementCategoryService
@@ -268,11 +248,11 @@
OptionSet commentOptionSet = optionService.getOptionSet( selectedCommentOptionSetId );
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
- dataElement.setName( name );
- dataElement.setShortName( shortName );
- dataElement.setCode( code );
- dataElement.setDescription( description );
- dataElement.setFormName( formName );
+ dataElement.setName( StringUtils.trimToNull( name ) );
+ dataElement.setShortName( StringUtils.trimToNull( shortName ) );
+ dataElement.setCode( StringUtils.trimToNull( code ) );
+ dataElement.setDescription( StringUtils.trimToNull( description ) );
+ dataElement.setFormName( StringUtils.trimToNull( formName ) );
dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
dataElement.setType( valueType );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-03-11 11:01:16 +0000
@@ -123,13 +123,6 @@
this.name = name;
}
- private String alternativeName;
-
- public void setAlternativeName( String alternativeName )
- {
- this.alternativeName = alternativeName;
- }
-
private String shortName;
public void setShortName( String shortName )
@@ -270,19 +263,6 @@
@Override
public String execute()
{
- // ---------------------------------------------------------------------
- // Prepare values
- // ---------------------------------------------------------------------
-
- alternativeName = StringUtils.trimToNull( alternativeName );
- code = StringUtils.trimToNull( code );
- description = StringUtils.trimToNull( description );
- formName = StringUtils.trimToNull( formName );
-
- // ---------------------------------------------------------------------
- // Update data element
- // ---------------------------------------------------------------------
-
DataElement dataElement = dataElementService.getDataElement( id );
DataElementCategoryCombo categoryCombo = dataElementCategoryService
@@ -292,11 +272,11 @@
OptionSet commentOptionSet = optionService.getOptionSet( selectedCommentOptionSetId );
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
- dataElement.setName( name );
- dataElement.setShortName( shortName );
- dataElement.setCode( code );
- dataElement.setDescription( description );
- dataElement.setFormName( formName );
+ dataElement.setName( StringUtils.trimToNull( name ) );
+ dataElement.setShortName( StringUtils.trimToNull( shortName ) );
+ dataElement.setCode( StringUtils.trimToNull( code ) );
+ dataElement.setDescription( StringUtils.trimToNull( description ) );
+ dataElement.setFormName( StringUtils.trimToNull( formName ) );
dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
dataElement.setType( valueType );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,8 @@
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
@@ -120,11 +122,9 @@
@Override
public String execute()
{
- code = (code != null && code.trim().length() == 0) ? null : code;
-
- dataElementGroup = new DataElementGroup( name );
- dataElementGroup.setShortName( shortName );
- dataElementGroup.setCode( code );
+ dataElementGroup = new DataElementGroup( StringUtils.trimToNull( name ) );
+ dataElementGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ dataElementGroup.setCode( StringUtils.trimToNull( code ) );
for ( String id : deSelected )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,8 @@
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
@@ -130,16 +132,10 @@
@Override
public String execute()
{
- code = (code != null && code.trim().length() == 0) ? null : code;
-
dataElementGroup = dataElementService.getDataElementGroup( id );
- dataElementGroup.setShortName( shortName );
- dataElementGroup.setCode( code );
-
- if ( name != null && name.trim().length() > 0 )
- {
- dataElementGroup.setName( name );
- }
+ dataElementGroup.setName( StringUtils.trimToNull( name ) );
+ dataElementGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ dataElementGroup.setCode( StringUtils.trimToNull( code ) );
Set<DataElement> members = new HashSet<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/AddDataElementGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/AddDataElementGroupSetAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/AddDataElementGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
@@ -110,11 +111,11 @@
public String execute()
throws Exception
{
- DataElementGroupSet dataElementGroupSet = new DataElementGroupSet( name, description, compulsory, dataDimension );
+ DataElementGroupSet dataElementGroupSet = new DataElementGroupSet();
- dataElementGroupSet.setName( name );
- dataElementGroupSet.setDescription( description );
- dataElementGroupSet.setCode( code );
+ dataElementGroupSet.setName( StringUtils.trimToNull( name ) );
+ dataElementGroupSet.setCode( StringUtils.trimToNull( code ) );
+ dataElementGroupSet.setDescription( StringUtils.trimToNull( description ) );
dataElementGroupSet.setCompulsory( compulsory );
dataElementGroupSet.setDataDimension( dataDimension );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/UpdateDataElementGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/UpdateDataElementGroupSetAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/UpdateDataElementGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
@@ -116,9 +117,9 @@
{
DataElementGroupSet dataElementGroupSet = dataElementService.getDataElementGroupSet( id );
- dataElementGroupSet.setName( name );
- dataElementGroupSet.setDescription( description );
- dataElementGroupSet.setCode( code );
+ dataElementGroupSet.setName( StringUtils.trimToNull( name ) );
+ dataElementGroupSet.setCode( StringUtils.trimToNull( code ) );
+ dataElementGroupSet.setDescription( StringUtils.trimToNull( description ) );
dataElementGroupSet.setCompulsory( compulsory );
dataElementGroupSet.setDataDimension( dataDimension );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java 2015-03-11 11:01:16 +0000
@@ -193,26 +193,23 @@
{
IndicatorType indicatorType = indicatorService.getIndicatorType( indicatorTypeId );
- code = StringUtils.trimToNull( code );
- description = StringUtils.trimToNull( description );
-
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
Indicator indicator = new Indicator();
- indicator.setName( name );
- indicator.setShortName( shortName );
- indicator.setCode( code );
- indicator.setDescription( description );
+ indicator.setName( StringUtils.trimToNull( name ) );
+ indicator.setShortName( StringUtils.trimToNull( shortName ) );
+ indicator.setCode( StringUtils.trimToNull( code ) );
+ indicator.setDescription( StringUtils.trimToNull( description ) );
indicator.setAnnualized( annualized );
indicator.setDecimals( decimals );
indicator.setIndicatorType( indicatorType );
indicator.setLegendSet( legendSet );
- indicator.setUrl( url );
- indicator.setNumerator( numerator );
- indicator.setNumeratorDescription( numeratorDescription );
- indicator.setDenominator( denominator );
- indicator.setDenominatorDescription( denominatorDescription );
+ indicator.setUrl( StringUtils.trimToNull( url ) );
+ indicator.setNumerator( StringUtils.trimToNull( numerator ) );
+ indicator.setNumeratorDescription( StringUtils.trimToNull( numeratorDescription ) );
+ indicator.setDenominator( StringUtils.trimToNull( denominator ) );
+ indicator.setDenominatorDescription( StringUtils.trimToNull( denominatorDescription ) );
if ( jsonAttributeValues != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java 2015-03-11 11:01:16 +0000
@@ -211,22 +211,19 @@
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
- code = StringUtils.trimToNull( code );
- description = StringUtils.trimToNull( description );
-
- indicator.setName( name );
- indicator.setShortName( shortName );
- indicator.setCode( code );
- indicator.setDescription( description );
+ indicator.setName( StringUtils.trimToNull( name ) );
+ indicator.setShortName( StringUtils.trimToNull( shortName ) );
+ indicator.setCode( StringUtils.trimToNull( code ) );
+ indicator.setDescription( StringUtils.trimToNull( description ) );
indicator.setAnnualized( annualized );
indicator.setDecimals( decimals );
indicator.setIndicatorType( indicatorType );
indicator.setLegendSet( legendSet );
- indicator.setUrl( url );
- indicator.setNumerator( numerator );
- indicator.setNumeratorDescription( numeratorDescription );
- indicator.setDenominator( denominator );
- indicator.setDenominatorDescription( denominatorDescription );
+ indicator.setUrl( StringUtils.trimToNull( url ) );
+ indicator.setNumerator( StringUtils.trimToNull( numerator ) );
+ indicator.setNumeratorDescription( StringUtils.trimToNull( numeratorDescription ) );
+ indicator.setDenominator( StringUtils.trimToNull( denominator ) );
+ indicator.setDenominatorDescription( StringUtils.trimToNull( denominatorDescription ) );
for ( int i = 0; i < indicatorGroupSets.size(); i++ )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,8 @@
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
@@ -100,7 +102,7 @@
@Override
public String execute()
{
- indicatorGroup = new IndicatorGroup( name );
+ indicatorGroup = new IndicatorGroup( StringUtils.trimToNull( name ) );
indicatorService.addIndicatorGroup( indicatorGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,8 @@
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
@@ -112,11 +114,8 @@
{
indicatorGroup = indicatorService.getIndicatorGroup( id );
- if ( name != null && name.trim().length() > 0 )
- {
- indicatorGroup.setName( name );
- }
-
+ indicatorGroup.setName( StringUtils.trimToNull( name ) );
+
Set<Indicator> members = new HashSet<>();
for ( String id : inSelected )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/AddIndicatorGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/AddIndicatorGroupSetAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/AddIndicatorGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
@@ -92,7 +94,11 @@
@Override
public String execute()
{
- IndicatorGroupSet indicatorGroupSet = new IndicatorGroupSet( name, description, compulsory );
+ IndicatorGroupSet indicatorGroupSet = new IndicatorGroupSet();
+
+ indicatorGroupSet.setName( StringUtils.trimToNull( name ) );
+ indicatorGroupSet.setDescription( StringUtils.trimToNull( description ) );
+ indicatorGroupSet.setCompulsory( compulsory );
List<IndicatorGroup> indicatorGroups = new ArrayList<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/UpdateIndicatorGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/UpdateIndicatorGroupSetAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/UpdateIndicatorGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
@@ -102,8 +104,8 @@
{
IndicatorGroupSet indicatorGroupSet = indicatorService.getIndicatorGroupSet( id );
- indicatorGroupSet.setName( name.trim() );
- indicatorGroupSet.setDescription( description );
+ indicatorGroupSet.setName( StringUtils.trimToNull( name ) );
+ indicatorGroupSet.setDescription( StringUtils.trimToNull( description ) );
indicatorGroupSet.setCompulsory( compulsory );
indicatorGroupSet.getMembers().clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java 2015-03-11 11:01:16 +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.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -84,7 +85,11 @@
@Override
public String execute()
{
- IndicatorType indicatorType = new IndicatorType( name, factor, number );
+ IndicatorType indicatorType = new IndicatorType();
+
+ indicatorType.setName( StringUtils.trimToNull( name ) );
+ indicatorType.setFactor( factor );
+ indicatorType.setNumber( number );
indicatorService.addIndicatorType( indicatorType );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java 2015-03-11 11:01:16 +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.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -93,7 +94,7 @@
{
IndicatorType indicatorType = indicatorService.getIndicatorType( id );
- indicatorType.setName( name );
+ indicatorType.setName( StringUtils.trimToNull( name ) );
indicatorType.setFactor( factor );
indicatorType.setNumber( number );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm 2015-03-11 11:01:16 +0000
@@ -32,11 +32,11 @@
</tr>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name"/></td>
+ <td><input type="text" id="name" name="name" /></td>
</tr>
<tr>
<td><label for="code">$i18n.getString( "code" )</label></td>
- <td><input type="text" id="code" name="code" ></td>
+ <td><input type="text" id="code" name="code" /></td>
</tr>
<tr>
<td><label for="dataDimension">$i18n.getString( "use_as_data_dimension" )</label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2015-03-11 11:01:16 +0000
@@ -28,12 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
-
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
@@ -304,17 +303,14 @@
public String execute()
throws Exception
{
- // ---------------------------------------------------------------------
- // Prepare values
- // ---------------------------------------------------------------------
-
- code = nullIfEmpty( code );
- shortName = nullIfEmpty( shortName );
- description = nullIfEmpty( description );
-
PeriodType periodType = PeriodType.getPeriodTypeByName( frequencySelect );
- DataSet dataSet = new DataSet( name, shortName, code, periodType );
+ DataSet dataSet = new DataSet();
+
+ dataSet.setName( StringUtils.trimToNull( name ) );
+ dataSet.setShortName( StringUtils.trimToNull( shortName ) );
+ dataSet.setCode( StringUtils.trimToNull( code ) );
+ dataSet.setPeriodType( periodType );
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
@@ -339,7 +335,7 @@
dataSet.setCategoryCombo( categoryService.getDataElementCategoryCombo( categoryComboId ) );
}
- dataSet.setDescription( description );
+ dataSet.setDescription( StringUtils.trimToNull( description ) );
dataSet.setVersion( 1 );
dataSet.setMobile( false );
dataSet.setIndicators( indicators );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2015-03-11 11:01:16 +0000
@@ -29,12 +29,12 @@
*/
import static org.hisp.dhis.system.util.TextUtils.equalsNullSafe;
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -322,14 +322,6 @@
public String execute()
throws Exception
{
- // ---------------------------------------------------------------------
- // Prepare values
- // ---------------------------------------------------------------------
-
- code = nullIfEmpty( code );
- shortName = nullIfEmpty( shortName );
- description = nullIfEmpty( description );
-
Set<DataElement> dataElements = new HashSet<>();
LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
@@ -363,10 +355,10 @@
dataSet.increaseVersion(); // Check if version must be updated
}
- dataSet.setName( name );
- dataSet.setShortName( shortName );
- dataSet.setDescription( description );
- dataSet.setCode( code );
+ dataSet.setName( StringUtils.trimToNull( name ) );
+ dataSet.setShortName( StringUtils.trimToNull( shortName ) );
+ dataSet.setCode( StringUtils.trimToNull( code ) );
+ dataSet.setDescription( StringUtils.trimToNull( description ) );
dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
dataSet.updateDataElements( dataElements );
dataSet.setIndicators( indicators );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2015-02-18 13:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2015-03-11 11:01:16 +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.dataset.DataSet;
@@ -147,8 +148,8 @@
Section section = new Section();
section.setDataSet( dataSet );
- section.setName( sectionName );
- section.setDescription( description );
+ section.setName( StringUtils.trimToNull( sectionName ) );
+ section.setDescription( StringUtils.trimToNull( description ) );
section.setSortOrder( 0 );
List<DataElement> selectedDataElements = new ArrayList<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2015-02-18 13:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2015-03-11 11:01:16 +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.dataset.DataSet;
@@ -150,6 +151,9 @@
}
DataSet dataSet = section.getDataSet();
+
+ section.setName( StringUtils.trimToNull( sectionName ) );
+ section.setDescription( StringUtils.trimToNull( description ) );
if ( dataSet != null ) // Check if version must be updated
{
@@ -164,8 +168,6 @@
section.setDataElements( dataElements );
section.setIndicators( indicators );
- section.setName( sectionName );
- section.setDescription( description );
sectionService.updateSection( section );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2015-03-11 11:01:16 +0000
@@ -28,12 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.calendar.DateTimeUnit;
@@ -237,22 +236,6 @@
public String execute()
throws Exception
{
- code = nullIfEmpty( code );
- comment = nullIfEmpty( comment );
- description = nullIfEmpty( description );
- longitude = nullIfEmpty( longitude );
- latitude = nullIfEmpty( latitude );
- url = nullIfEmpty( url );
-
- contactPerson = nullIfEmpty( contactPerson );
- address = nullIfEmpty( address );
- email = nullIfEmpty( email );
- phoneNumber = nullIfEmpty( phoneNumber );
-
- // ---------------------------------------------------------------------
- // Get parent
- // ---------------------------------------------------------------------
-
OrganisationUnit parent = selectionManager.getSelectedOrganisationUnit();
if ( parent == null )
@@ -270,15 +253,20 @@
DateTimeUnit isoOpeningDate = calendarService.getSystemCalendar().toIso( openingDate );
- OrganisationUnit organisationUnit = new OrganisationUnit( name, shortName, code, isoOpeningDate.toJdkCalendar().getTime(), null, comment );
+ OrganisationUnit organisationUnit = new OrganisationUnit();
+ organisationUnit.setName( StringUtils.trimToNull( name ) );
+ organisationUnit.setShortName( StringUtils.trimToNull( shortName ) );
+ organisationUnit.setCode( StringUtils.trimToNull( code ) );
+ organisationUnit.setOpeningDate( isoOpeningDate.toJdkCalendar().getTime() );
organisationUnit.setDescription( description );
- organisationUnit.setUrl( url );
+ organisationUnit.setComment( StringUtils.trimToNull( comment ) );
+ organisationUnit.setUrl( StringUtils.trimToNull( url ) );
organisationUnit.setParent( parent );
- organisationUnit.setContactPerson( contactPerson );
- organisationUnit.setAddress( address );
- organisationUnit.setEmail( email );
- organisationUnit.setPhoneNumber( phoneNumber );
+ organisationUnit.setContactPerson( StringUtils.trimToNull( contactPerson ) );
+ organisationUnit.setAddress( StringUtils.trimToNull( address ) );
+ organisationUnit.setEmail( StringUtils.trimToNull( email ) );
+ organisationUnit.setPhoneNumber( StringUtils.trimToNull( phoneNumber ) );
if ( parent != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2015-03-11 11:01:16 +0000
@@ -28,7 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
import static org.hisp.dhis.system.util.ValidationUtils.coordinateIsValid;
import java.util.ArrayList;
@@ -38,6 +37,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.calendar.DateTimeUnit;
@@ -254,18 +254,6 @@
public String execute()
throws Exception
{
- code = nullIfEmpty( code );
- comment = nullIfEmpty( comment );
- description = nullIfEmpty( description );
- longitude = nullIfEmpty( longitude );
- latitude = nullIfEmpty( latitude );
- url = nullIfEmpty( url );
-
- contactPerson = nullIfEmpty( contactPerson );
- address = nullIfEmpty( address );
- email = nullIfEmpty( email );
- phoneNumber = nullIfEmpty( phoneNumber );
-
DateTimeUnit isoOpeningDate = calendarService.getSystemCalendar().toIso( openingDate );
Date oDate = isoOpeningDate.toJdkCalendar().getTime();
@@ -288,18 +276,18 @@
organisationUnitService.updateVersion();
}
- organisationUnit.setName( name );
- organisationUnit.setShortName( shortName );
- organisationUnit.setDescription( description );
- organisationUnit.setCode( code );
+ organisationUnit.setName( StringUtils.trimToNull( name ) );
+ organisationUnit.setShortName( StringUtils.trimToNull( shortName ) );
+ organisationUnit.setDescription( StringUtils.trimToNull( description ) );
+ organisationUnit.setCode( StringUtils.trimToNull( code ) );
organisationUnit.setOpeningDate( oDate );
organisationUnit.setClosedDate( cDate );
- organisationUnit.setComment( comment );
- organisationUnit.setUrl( url );
- organisationUnit.setContactPerson( contactPerson );
- organisationUnit.setAddress( address );
- organisationUnit.setEmail( email );
- organisationUnit.setPhoneNumber( phoneNumber );
+ organisationUnit.setComment( StringUtils.trimToNull( comment ) );
+ organisationUnit.setUrl( StringUtils.trimToNull( url ) );
+ organisationUnit.setContactPerson( StringUtils.trimToNull( contactPerson ) );
+ organisationUnit.setAddress( StringUtils.trimToNull( address ) );
+ organisationUnit.setEmail( StringUtils.trimToNull( email ) );
+ organisationUnit.setPhoneNumber( StringUtils.trimToNull( phoneNumber ) );
if ( jsonAttributeValues != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import java.util.Collection;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -121,10 +122,10 @@
code = (code != null && code.trim().length() == 0) ? null : code;
OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup();
- organisationUnitGroup.setName( name );
- organisationUnitGroup.setShortName( shortName );
- organisationUnitGroup.setCode( code );
- organisationUnitGroup.setSymbol( symbol );
+ organisationUnitGroup.setName( StringUtils.trimToNull( name ) );
+ organisationUnitGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ organisationUnitGroup.setCode( StringUtils.trimToNull( code ) );
+ organisationUnitGroup.setSymbol( StringUtils.trimToNull( symbol ) );
organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import java.util.Collection;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -130,10 +131,10 @@
OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( id );
- organisationUnitGroup.setName( name );
- organisationUnitGroup.setShortName( shortName );
- organisationUnitGroup.setCode( code );
- organisationUnitGroup.setSymbol( symbol );
+ organisationUnitGroup.setName( StringUtils.trimToNull( name ) );
+ organisationUnitGroup.setShortName( StringUtils.trimToNull( shortName ) );
+ organisationUnitGroup.setCode( StringUtils.trimToNull( code ) );
+ organisationUnitGroup.setSymbol( StringUtils.trimToNull( symbol ) );
Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager
.getReloadedSelectedOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -127,9 +128,13 @@
public String execute()
throws Exception
{
- OrganisationUnitGroupSet groupSet = new OrganisationUnitGroupSet( name, description, compulsory, dataDimension );
-
- groupSet.setCode( code );
+ OrganisationUnitGroupSet groupSet = new OrganisationUnitGroupSet();
+
+ groupSet.setName( StringUtils.trimToNull( name ) );
+ groupSet.setCode( StringUtils.trimToNull( code ) );
+ groupSet.setDescription( StringUtils.trimToNull( description ) );
+ groupSet.setCompulsory( compulsory );
+ groupSet.setDataDimension( dataDimension );
Set<OrganisationUnitGroup> selectedMembers = new HashSet<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -134,11 +135,10 @@
throws Exception
{
OrganisationUnitGroupSet organisationUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( id );
-
- organisationUnitGroupSet.setCode( code );
- organisationUnitGroupSet.setName( name );
- organisationUnitGroupSet.setDescription( description );
+ organisationUnitGroupSet.setName( StringUtils.trimToNull( name ) );
+ organisationUnitGroupSet.setCode( StringUtils.trimToNull( code ) );
+ organisationUnitGroupSet.setDescription( StringUtils.trimToNull( description ) );
organisationUnitGroupSet.setCompulsory( compulsory );
organisationUnitGroupSet.setDataDimension( dataDimension );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.user.UserAuthorityGroup;
@@ -104,8 +106,8 @@
{
UserAuthorityGroup group = new UserAuthorityGroup();
- group.setName( name );
- group.setDescription( description );
+ group.setName( StringUtils.trimToNull( name ) );
+ group.setDescription( StringUtils.trimToNull( description ) );
for ( String id : selectedList )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java 2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java 2015-03-11 11:01:16 +0000
@@ -280,11 +280,6 @@
{
//TODO: Allow user with F_USER_ADD_WITHIN_MANAGED_GROUP to add a user within managed groups.
- email = StringUtils.trimToNull( email );
- username = username.trim();
- inviteUsername = inviteUsername.trim();
- inviteEmail = inviteEmail.trim();
-
User currentUser = currentUserService.getCurrentUser();
// ---------------------------------------------------------------------
@@ -297,7 +292,7 @@
userCredentials.setUser( user );
user.setUserCredentials( userCredentials );
- userCredentials.setUsername( username );
+ userCredentials.setUsername( StringUtils.trimToNull( username ) );
if ( !StringUtils.isEmpty( openId ) )
{
@@ -306,20 +301,20 @@
if ( ACCOUNT_ACTION_INVITE.equals( accountAction ) )
{
- userCredentials.setUsername( inviteUsername );
+ userCredentials.setUsername( StringUtils.trimToNull( inviteUsername ) );
userCredentials.setInvitation( true );
- user.setEmail( inviteEmail );
+ user.setEmail( StringUtils.trimToNull( inviteEmail ) );
securityService.prepareUserForInvite( user );
}
else
{
- user.setSurname( surname );
- user.setFirstName( firstName );
- user.setEmail( email );
- user.setPhoneNumber( phoneNumber );
+ user.setSurname( StringUtils.trimToNull( surname ) );
+ user.setFirstName( StringUtils.trimToNull( firstName ) );
+ user.setEmail( StringUtils.trimToNull( email ) );
+ user.setPhoneNumber( StringUtils.trimToNull( phoneNumber ) );
- userService.encodeAndSetPassword( userCredentials, rawPassword );
+ userService.encodeAndSetPassword( userCredentials, StringUtils.trimToNull( rawPassword ) );
}
if ( jsonAttributeValues != null )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java 2015-03-11 11:01:16 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.user.UserAuthorityGroup;
@@ -118,8 +120,8 @@
{
UserAuthorityGroup group = userService.getUserAuthorityGroup( id );
- group.setName( name );
- group.setDescription( description );
+ group.setName( StringUtils.trimToNull( name ) );
+ group.setDescription( StringUtils.trimToNull( description ) );
group.getDataSets().clear();
group.getAuthorities().clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2015-03-11 11:01:16 +0000
@@ -238,9 +238,6 @@
{
//TODO: Allow user with F_USER_ADD_WITHIN_MANAGED_GROUP to update a user within managed groups.
- email = StringUtils.trimToNull( email );
- rawPassword = StringUtils.trimToNull( rawPassword );
-
User currentUser = currentUserService.getCurrentUser();
// ---------------------------------------------------------------------
@@ -248,16 +245,16 @@
// ---------------------------------------------------------------------
User user = userService.getUser( id );
- user.setSurname( surname );
- user.setFirstName( firstName );
- user.setEmail( email );
- user.setPhoneNumber( phoneNumber );
+ user.setSurname( StringUtils.trimToNull( surname ) );
+ user.setFirstName( StringUtils.trimToNull( firstName ) );
+ user.setEmail( StringUtils.trimToNull( email ) );
+ user.setPhoneNumber( StringUtils.trimToNull( phoneNumber ) );
UserCredentials userCredentials = userService.getUserCredentials( user );
if ( !StringUtils.isEmpty( openId ) )
{
- userCredentials.setOpenId( openId );
+ userCredentials.setOpenId( StringUtils.trimToNull( openId ) );
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupAction.java 2015-03-11 11:01:16 +0000
@@ -32,6 +32,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.UserGroup;
@@ -108,7 +109,7 @@
public String execute()
throws Exception
{
- UserGroup userGroup = new UserGroup( name );
+ UserGroup userGroup = new UserGroup( StringUtils.trimToNull( name ) );
for ( String uid : usersSelected )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/UpdateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/UpdateUserGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/UpdateUserGroupAction.java 2015-03-11 11:01:16 +0000
@@ -32,6 +32,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.User;
@@ -123,7 +124,7 @@
users.add( userService.getUser( uid ) );
}
- userGroup.setName( name );
+ userGroup.setName( StringUtils.trimToNull( name ) );
userGroup.updateUsers( users );
if ( jsonAttributeValues != null )
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import static org.hisp.dhis.expression.MissingValueStrategy.SKIP_IF_ANY_VALUE_MISSING;
import static org.hisp.dhis.expression.MissingValueStrategy.safeValueOf;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.expression.Operator;
@@ -229,12 +230,12 @@
ValidationRule validationRule = new ValidationRule();
- validationRule.setName( name );
- validationRule.setDescription( description );
- validationRule.setInstruction( instruction );
- validationRule.setImportance( importance );
- validationRule.setRuleType( ruleType );
- validationRule.setOperator( Operator.valueOf(operator) );
+ validationRule.setName( StringUtils.trimToNull( name ) );
+ validationRule.setDescription( StringUtils.trimToNull( description ) );
+ validationRule.setInstruction( StringUtils.trimToNull( instruction ) );
+ validationRule.setImportance( StringUtils.trimToNull( importance ) );
+ validationRule.setRuleType( StringUtils.trimToNull( ruleType ) );
+ validationRule.setOperator( Operator.valueOf( operator ) );
validationRule.setLeftSide( leftSide );
validationRule.setRightSide( rightSide );
validationRule.setOrganisationUnitLevel( organisationUnitLevel );
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java 2015-03-11 11:01:16 +0000
@@ -31,6 +31,7 @@
import static org.hisp.dhis.expression.MissingValueStrategy.SKIP_IF_ANY_VALUE_MISSING;
import static org.hisp.dhis.expression.MissingValueStrategy.safeValueOf;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.expression.Operator;
import org.hisp.dhis.period.PeriodService;
@@ -218,11 +219,11 @@
{
ValidationRule validationRule = validationRuleService.getValidationRule( id );
- validationRule.setName( name );
- validationRule.setDescription( description );
- validationRule.setInstruction( instruction );
- validationRule.setImportance( importance );
- validationRule.setRuleType( ruleType );
+ validationRule.setName( StringUtils.trimToNull( name ) );
+ validationRule.setDescription( StringUtils.trimToNull( description ) );
+ validationRule.setInstruction( StringUtils.trimToNull( instruction ) );
+ validationRule.setImportance( StringUtils.trimToNull( importance ) );
+ validationRule.setRuleType( StringUtils.trimToNull( ruleType ) );
validationRule.setOperator( Operator.valueOf( operator ) );
validationRule.getLeftSide().setExpression( leftSideExpression );
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/AddValidationRuleGroupAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/AddValidationRuleGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/AddValidationRuleGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.user.UserGroupService;
import org.hisp.dhis.validation.ValidationRuleGroup;
import org.hisp.dhis.validation.ValidationRuleService;
@@ -109,8 +110,8 @@
{
ValidationRuleGroup group = new ValidationRuleGroup();
- group.setName( name );
- group.setDescription( description );
+ group.setName( StringUtils.trimToNull( name ) );
+ group.setDescription( StringUtils.trimToNull( description ) );
if ( groupMembers != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/UpdateValidationRuleGroupAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/UpdateValidationRuleGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/UpdateValidationRuleGroupAction.java 2015-03-11 11:01:16 +0000
@@ -30,6 +30,7 @@
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.user.UserGroupService;
import org.hisp.dhis.validation.ValidationRuleGroup;
import org.hisp.dhis.validation.ValidationRuleService;
@@ -116,8 +117,8 @@
{
ValidationRuleGroup group = validationRuleService.getValidationRuleGroup( id );
- group.setName( name );
- group.setDescription( description );
+ group.setName( StringUtils.trimToNull( name ) );
+ group.setDescription( StringUtils.trimToNull( description ) );
group.getMembers().clear();
if ( groupMembers != null )