← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4028: Fixed issue, showing informative message when trying to load custom data entry screen with refere...

 

------------------------------------------------------------
revno: 4028
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-06-27 13:06:03 +0200
message:
  Fixed issue, showing informative message when trying to load custom data entry screen with reference to non-existing data element/category option combo/indicator, this time properly
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-06-16 09:27:03 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-06-27 11:06:03 +0000
@@ -185,16 +185,17 @@
                 DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
                 int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) );
-                DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
-                String optionComboName = optionCombo != null ? optionCombo.getName() : "";
+                DataElementCategoryOptionCombo categegoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+                String optionComboName = categegoryOptionCombo != null ? categegoryOptionCombo.getName() : "[ Category option combo does not exist ]";
 
                 // -------------------------------------------------------------
                 // Insert name of data element operand as value and title
                 // -------------------------------------------------------------
 
-                StringBuilder title = new StringBuilder( "title=\"" ).append( dataElement.getId() ).append( " - " ).
+                StringBuilder title = dataElement != null ? 
+                    new StringBuilder( "title=\"" ).append( dataElement.getId() ).append( " - " ).
                     append( dataElement.getName() ).append( " - " ).append( optionComboId ).append( " - " ).
-                    append( optionComboName ).append( " - " ).append( dataElement.getType() ).append( "\"" );
+                    append( optionComboName ).append( " - " ).append( dataElement.getType() ).append( "\"" ) : new StringBuilder();
                 
                 String displayValue = dataElement != null ? "value=\"[ " + dataElement.getName() + " " + optionComboName + " ]\"" : "[ Data element does not exist ]";
                 String displayTitle = dataElement != null ? title.toString() : "[ Data element does not exist ]";