dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40237
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20385: Added annotated method getDataDimensionItemType to DataDimensionItem
------------------------------------------------------------
revno: 20385
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-28 11:25:45 +0200
message:
Added annotated method getDataDimensionItemType to DataDimensionItem
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionItem.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/common/DataDimensionItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionItem.java 2015-09-28 09:07:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionItem.java 2015-09-28 09:25:45 +0000
@@ -160,6 +160,46 @@
return null;
}
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public DataDimensionItemType getDataDimensionItemType()
+ {
+ if ( indicator != null )
+ {
+ return DataDimensionItemType.INDICATOR;
+ }
+ else if ( dataElement != null )
+ {
+ if ( DataElementDomain.TRACKER.equals( dataElement.getDomainType() ) )
+ {
+ return DataDimensionItemType.PROGRAM_DATA_ELEMENT;
+ }
+ else
+ {
+ return DataDimensionItemType.AGGREGATE_DATA_ELEMENT;
+ }
+ }
+ else if ( dataElementOperand != null )
+ {
+ return DataDimensionItemType.DATA_ELEMENT_OPERAND;
+ }
+ else if ( dataSet != null )
+ {
+ return DataDimensionItemType.DATA_SET;
+ }
+ else if ( programIndicator != null )
+ {
+ return DataDimensionItemType.PROGRAM_INDICATOR;
+ }
+ else if ( trackedEntityAttribute != null )
+ {
+ return DataDimensionItemType.PROGRAM_ATTRIBUTE;
+ }
+
+ return null;
+ }
// -------------------------------------------------------------------------
// Get and set methods