← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12138: Inerpration, added method to get type

 

------------------------------------------------------------
revno: 12138
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-18 12:30:31 +0200
message:
  Inerpration, added method to get type
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.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/interpretation/Interpretation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2013-09-18 10:30:31 +0000
@@ -59,6 +59,11 @@
 public class Interpretation
     extends BaseIdentifiableObject
 {
+    public static final String TYPE_CHART = "chart";
+    public static final String TYPE_MAP = "map";
+    public static final String TYPE_REPORT_TABLE = "reportTable";
+    public static final String TYPE_DATASET_REPORT = "dataSetReport";
+    
     private Chart chart;
 
     private Map map;
@@ -121,7 +126,31 @@
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
-
+    
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public String getType()
+    {
+        if ( chart != null )
+        {
+            return TYPE_CHART;
+        }
+        else if ( map != null )
+        {
+            return TYPE_MAP;
+        }
+        else if ( reportTable != null )
+        {
+            return TYPE_REPORT_TABLE;
+        }
+        else if ( dataSet != null )
+        {
+            return TYPE_DATASET_REPORT;
+        }
+        
+        return null;
+    }
+    
     public void addComment( InterpretationComment comment )
     {
         this.comments.add( comment );