dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32574
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16613: Data element, trimming of form names
------------------------------------------------------------
revno: 16613
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-09-02 11:24:29 -0400
message:
Data element, trimming of form names
modified:
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
--
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-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 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2014-09-02 15:24:29 +0000
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -248,21 +249,11 @@
// Prepare values
// ---------------------------------------------------------------------
- if ( alternativeName != null && alternativeName.trim().length() == 0 )
- {
- alternativeName = null;
- }
-
- if ( code != null && code.trim().length() == 0 )
- {
- code = null;
- }
-
- if ( description != null && description.trim().length() == 0 )
- {
- description = null;
- }
-
+ alternativeName = StringUtils.trimToNull( alternativeName );
+ code = StringUtils.trimToNull( code );
+ description = StringUtils.trimToNull( description );
+ formName = StringUtils.trimToNull( formName );
+
// ---------------------------------------------------------------------
// Create data element
// ---------------------------------------------------------------------
=== 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 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2014-09-02 15:24:29 +0000
@@ -33,6 +33,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.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -272,26 +273,11 @@
// Prepare values
// ---------------------------------------------------------------------
- if ( alternativeName != null && alternativeName.trim().length() == 0 )
- {
- alternativeName = null;
- }
-
- if ( code != null && code.trim().length() == 0 )
- {
- code = null;
- }
-
- if ( description != null && description.trim().length() == 0 )
- {
- description = null;
- }
-
- if ( formName != null && formName.trim().length() == 0 )
- {
- formName = null;
- }
-
+ alternativeName = StringUtils.trimToNull( alternativeName );
+ code = StringUtils.trimToNull( code );
+ description = StringUtils.trimToNull( description );
+ formName = StringUtils.trimToNull( formName );
+
// ---------------------------------------------------------------------
// Update data element
// ---------------------------------------------------------------------