← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2291: Using alternative name for data elements and short name for data sets as name

 

------------------------------------------------------------
revno: 2291
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-12-06 11:49:53 +0530
message:
  Using alternative name for data elements and short name for data sets as name 
  (both with fallback to name if empty).
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ModelMapping.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-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java	2010-12-02 11:58:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java	2010-12-06 06:19:53 +0000
@@ -133,7 +133,14 @@
         DataSet ds = new DataSet();
 
         ds.setId( dataSet.getId() );
-        ds.setName( dataSet.getName() );
+
+        // Name defaults to short name with fallback to name if empty
+        String name = dataSet.getShortName();
+        if (name == null || name.trim().isEmpty()) {
+            name = dataSet.getName();
+        }
+        
+        ds.setName( name );
 //        ds.setVersionDataSet( dataSet.getVersionDataSet() );
         ds.setPeriodType( dataSet.getPeriodType().getName() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ModelMapping.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ModelMapping.java	2010-12-02 11:58:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ModelMapping.java	2010-12-06 06:19:53 +0000
@@ -43,7 +43,13 @@
     {
         DataElement de = new DataElement();
         de.setId( dataElement.getId() );
-        de.setName( dataElement.getName() );
+
+        // Name defaults to alternative name with fallback to name if empty
+        String name = dataElement.getAlternativeName();
+        if (name == null || name.trim().isEmpty()) {
+            name = dataElement.getName();
+        }
+        de.setName( name );
         de.setType( dataElement.getType() );
         
         de.setCategoryOptionCombos( getCategoryOptionCombos( dataElement ) );