← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10988: Added data element operand to MapView

 

------------------------------------------------------------
revno: 10988
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-24 17:23:08 +0200
message:
  Added data element operand to MapView
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.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-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2013-05-24 15:23:08 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -85,6 +86,8 @@
 
     private DataElement dataElement;
 
+    private DataElementOperand dataElementOperand;
+    
     private Period period;
 
     private OrganisationUnit parentOrganisationUnit;
@@ -247,6 +250,20 @@
     }
 
     @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public DataElementOperand getDataElementOperand()
+    {
+        return dataElementOperand;
+    }
+
+    public void setDataElementOperand( DataElementOperand dataElementOperand )
+    {
+        this.dataElementOperand = dataElementOperand;
+    }
+
+    @JsonProperty
     @JsonSerialize( using = JacksonPeriodTypeSerializer.class )
     @JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
     @JsonView( { DetailedView.class, ExportView.class } )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2012-12-13 11:53:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2013-05-24 15:23:08 +0000
@@ -33,6 +33,9 @@
 
     <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
       foreign-key="fk_mapview_dataelementid" />
+      
+    <one-to-one name="dataElementOperand" class="org.hisp.dhis.dataelement.DataElementOperand" column="dataelementoperandid"
+      foreign-key="fk_mapview_dataelementoperandid" cascade="all-delete-orphan" />
 
     <many-to-one name="period" class="org.hisp.dhis.period.Period" column="periodid" foreign-key="fk_mapview_periodid" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2013-03-14 04:50:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2013-05-24 15:23:08 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.controller.AbstractCrudController;
 import org.hisp.dhis.api.utils.ContextUtils;
+import org.hisp.dhis.dataelement.DataElementOperandService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -81,6 +82,9 @@
     private DataElementService dataElementService;
 
     @Autowired
+    private DataElementOperandService operandService;
+    
+    @Autowired
     private PeriodService periodService;
 
     @Autowired
@@ -227,6 +231,11 @@
         {
             view.setDataElement( dataElementService.getDataElement( view.getDataElement().getUid() ) );
         }
+        
+        if ( view.getDataElementOperand() != null )
+        {
+            view.setDataElementOperand( operandService.getDataElementOperandByUid( view.getDataElementOperand().getUid() ) );
+        }        
 
         if ( view.getPeriod() != null )
         {