← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19548: Fix to allow legacy dxf-style catoptcombos

 

------------------------------------------------------------
revno: 19548
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-07-06 09:54:27 +0100
message:
  Fix to allow legacy dxf-style catoptcombos
  
  (see https://github.com/dhis2/adx/blob/master/IHE/dhis/dxf_style.xml)
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java	2015-07-04 16:43:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java	2015-07-06 08:54:27 +0000
@@ -249,12 +249,17 @@
 
         dxfWriter.writeStartElement( "dataValue" );
 
-        DataElement dataElement = identifiableObjectManager.getObject( DataElement.class, dataElementIdScheme,
-            dvAttributes.get( ADXConstants.DATAELEMENT ) );
-        DataElementCategoryCombo categoryCombo = dataElement.getCategoryCombo();
-
-        attributesToDXF( ADXConstants.CATOPTCOMBO, categoryCombo, dvAttributes, dataElementIdScheme );
-
+        DataElement dataElement = identifiableObjectManager.getObject( DataElement.class, dataElementIdScheme,dvAttributes.get( ADXConstants.DATAELEMENT));
+            
+        // process adx group attributes
+        if ( !dvAttributes.containsKey( ADXConstants.CATOPTCOMBO )
+            && dvAttributes.containsKey( ADXConstants.DATASET ) )
+        {
+            log.debug( "No attributeOptionCombo present.  Check dataSet for attribute categorycombo" );
+            DataElementCategoryCombo categoryCombo = dataElement.getCategoryCombo();
+
+            attributesToDXF( ADXConstants.CATOPTCOMBO, categoryCombo, dvAttributes, dataElementIdScheme );
+        }
         // if dataelement type is string we need to pick out the 'annotation' element
         if ( dataElement.getType().equals( DataElement.VALUE_TYPE_STRING ) )
         {