dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37785
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19299: Program indicator, trim strings to null
------------------------------------------------------------
revno: 19299
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-06-07 14:18:59 +0200
message:
Program indicator, trim strings to null
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.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/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java 2015-05-21 16:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java 2015-06-07 12:18:59 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
@@ -253,11 +255,11 @@
Program program = new Program();
- program.setName( name );
- program.setDescription( description );
+ program.setName( StringUtils.trimToNull( name ) );
+ program.setDescription( StringUtils.trimToNull( description ) );
program.setVersion( 1 );
- program.setDateOfEnrollmentDescription( dateOfEnrollmentDescription );
- program.setDateOfIncidentDescription( dateOfIncidentDescription );
+ program.setDateOfEnrollmentDescription( StringUtils.trimToNull( dateOfEnrollmentDescription ) );
+ program.setDateOfIncidentDescription( StringUtils.trimToNull( dateOfIncidentDescription ) );
program.setType( type );
program.setDisplayIncidentDate( displayIncidentDate );
program.setOnlyEnrollOnce( onlyEnrollOnce );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java 2015-05-21 16:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java 2015-06-07 12:18:59 +0000
@@ -29,6 +29,8 @@
*/
import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
@@ -277,10 +279,10 @@
dataEntryMethod = (dataEntryMethod == null) ? false : dataEntryMethod;
Program program = programService.getProgram( id );
- program.setName( name );
- program.setDescription( description );
- program.setDateOfEnrollmentDescription( dateOfEnrollmentDescription );
- program.setDateOfIncidentDescription( dateOfIncidentDescription );
+ program.setName( StringUtils.trimToNull( name ) );
+ program.setDescription( StringUtils.trimToNull( description ) );
+ program.setDateOfEnrollmentDescription( StringUtils.trimToNull( dateOfEnrollmentDescription ) );
+ program.setDateOfIncidentDescription( StringUtils.trimToNull( dateOfIncidentDescription ) );
program.setType( type );
program.setDisplayIncidentDate( displayIncidentDate );
program.setOnlyEnrollOnce( onlyEnrollOnce );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java 2015-06-02 16:33:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java 2015-06-07 12:18:59 +0000
@@ -31,6 +31,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramIndicator;
import org.hisp.dhis.program.ProgramIndicatorService;
@@ -160,15 +161,15 @@
Program program = programService.getProgram( programId );
ProgramIndicator indicator = new ProgramIndicator();
- 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.setProgram( program );
- indicator.setValueType( valueType );
- indicator.setExpression( expression );
- indicator.setFilter( filter );
- indicator.setRootDate( rootDate );
+ indicator.setValueType( StringUtils.trimToNull( valueType ) );
+ indicator.setExpression( StringUtils.trimToNull( expression ) );
+ indicator.setFilter( StringUtils.trimToNull( filter ) );
+ indicator.setRootDate( StringUtils.trimToNull( rootDate ) );
programIndicatorService.addProgramIndicator( indicator );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java 2015-06-02 16:33:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java 2015-06-07 12:18:59 +0000
@@ -31,6 +31,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.program.ProgramIndicator;
import org.hisp.dhis.program.ProgramIndicatorService;
@@ -152,14 +153,14 @@
ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
- indicator.setName( name );
- indicator.setShortName( shortName );
- indicator.setCode( code );
- indicator.setDescription( description );
- indicator.setValueType( valueType );
- indicator.setExpression( expression );
- indicator.setFilter( filter );
- indicator.setRootDate( rootDate );
+ indicator.setName( StringUtils.trimToNull( name ) );
+ indicator.setShortName( StringUtils.trimToNull( shortName ) );
+ indicator.setCode( StringUtils.trimToNull( code ) );
+ indicator.setDescription( StringUtils.trimToNull( description ) );
+ indicator.setValueType( StringUtils.trimToNull( valueType ) );
+ indicator.setExpression( StringUtils.trimToNull( expression ) );
+ indicator.setFilter( StringUtils.trimToNull( filter ) );
+ indicator.setRootDate( StringUtils.trimToNull( rootDate ) );
programIndicatorService.updateProgramIndicator( indicator );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java 2015-03-19 05:16:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java 2015-06-07 12:18:59 +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.attribute.AttributeService;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.trackedentity.TrackedEntity;
@@ -89,7 +90,9 @@
public String execute()
throws Exception
{
- TrackedEntity trackedEntity = new TrackedEntity( name, description );
+ TrackedEntity trackedEntity = new TrackedEntity();
+ trackedEntity.setName( StringUtils.trimToNull( name ) );
+ trackedEntity.setDescription( StringUtils.trimToNull( description ) );
if ( jsonAttributeValues != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java 2015-03-19 05:16:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java 2015-06-07 12:18:59 +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.attribute.AttributeService;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.trackedentity.TrackedEntity;
@@ -98,9 +99,8 @@
{
TrackedEntity trackedEntity = trackedEntityService.getTrackedEntity( id );
- trackedEntity.setName( name );
-
- trackedEntity.setDescription( description );
+ trackedEntity.setName( StringUtils.trimToNull( name ) );
+ trackedEntity.setDescription( StringUtils.trimToNull( description ) );
if ( jsonAttributeValues != null )
{