← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21429: DimensionService, renamed method

 

------------------------------------------------------------
revno: 21429
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-12-12 12:49:26 +0100
message:
  DimensionService, renamed method
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.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/DimensionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java	2015-12-08 22:49:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java	2015-12-12 11:49:26 +0000
@@ -56,10 +56,11 @@
     void mergeEventAnalyticalObject( EventAnalyticalObject object );
 
     /**
-     * Gets a dimension item object which are among the data dimension item objects.
+     * Gets a dimension item object which are among the data dimension item 
+     * objects. The composite dimensional items will be saved if not existing.
      * 
      * @param dimensionItem the dimension item identifier.
      * @return a dimensional item object.
      */
-    DimensionalItemObject getDataDimensionalItemObject( String dimensionItem );
+    DimensionalItemObject getOrAddDataDimensionalItemObject( String dimensionItem );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java	2015-12-08 22:49:42 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java	2015-12-12 11:49:26 +0000
@@ -248,7 +248,7 @@
                 }
                 else
                 {
-                    DimensionalItemObject dimItemObject = dimensionService.getDataDimensionalItemObject( uid );
+                    DimensionalItemObject dimItemObject = dimensionService.getOrAddDataDimensionalItemObject( uid );
                     
                     if ( dimItemObject != null )
                     {
@@ -265,8 +265,6 @@
             DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.DATA_X, null, DISPLAY_NAME_DATA_X, dataDimensionItems );
             
             return object;
-            
-            //TODO proper handling of operands and option combinations
         }
         
         else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java	2015-12-08 22:49:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java	2015-12-12 11:49:26 +0000
@@ -348,7 +348,7 @@
     }
 
     @Override
-    public DimensionalItemObject getDataDimensionalItemObject( String dimensionItem )
+    public DimensionalItemObject getOrAddDataDimensionalItemObject( String dimensionItem )
     {
         if ( DimensionalObjectUtils.isCompositeDimensionalObject( dimensionItem ) )
         {
@@ -424,7 +424,7 @@
                 {
                     for ( String uid : uids )
                     {
-                        DimensionalItemObject dimItemObject = getDataDimensionalItemObject( uid );
+                        DimensionalItemObject dimItemObject = getOrAddDataDimensionalItemObject( uid );
                         
                         if ( dimItemObject != null )
                         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2015-12-10 12:39:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2015-12-12 11:49:26 +0000
@@ -382,7 +382,7 @@
         {
             String dimensionItem = matcher.group( 2 );
             
-            DimensionalItemObject dimensionItemObject = dimensionService.getDataDimensionalItemObject( dimensionItem );
+            DimensionalItemObject dimensionItemObject = dimensionService.getOrAddDataDimensionalItemObject( dimensionItem );
             
             if ( dimensionItemObject != null )
             {
@@ -489,7 +489,7 @@
         {
             String dimensionItem = matcher.group( 2 );
             
-            if ( dimensionService.getDataDimensionalItemObject( dimensionItem ) == null )
+            if ( dimensionService.getOrAddDataDimensionalItemObject( dimensionItem ) == null )
             {
                 return ExpressionValidationOutcome.DIMENSIONAL_ITEM_OBJECT_DOES_NOT_EXIST;
             }
@@ -579,7 +579,7 @@
         {
             String dimensionItem = matcher.group( 2 );
             
-            DimensionalItemObject dimensionItemObject = dimensionService.getDataDimensionalItemObject( dimensionItem );
+            DimensionalItemObject dimensionItemObject = dimensionService.getOrAddDataDimensionalItemObject( dimensionItem );
             
             if ( dimensionItemObject == null )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java	2015-12-08 22:49:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java	2015-12-12 11:49:26 +0000
@@ -267,10 +267,10 @@
         String idB = prA.getUid() + DimensionalObjectUtils.COMPOSITE_DIM_OBJECT_PLAIN_SEP + deA.getUid();
         String idC = prA.getUid() + DimensionalObjectUtils.COMPOSITE_DIM_OBJECT_PLAIN_SEP + atA.getUid();
         
-        assertNotNull( dimensionService.getDataDimensionalItemObject( idA ) );
-        assertNotNull( dimensionService.getDataDimensionalItemObject( idB ) );
-        assertNotNull( dimensionService.getDataDimensionalItemObject( idC ) );
+        assertNotNull( dimensionService.getOrAddDataDimensionalItemObject( idA ) );
+        assertNotNull( dimensionService.getOrAddDataDimensionalItemObject( idB ) );
+        assertNotNull( dimensionService.getOrAddDataDimensionalItemObject( idC ) );
         
-        assertEquals( deA, dimensionService.getDataDimensionalItemObject( idA ) );
+        assertEquals( deA, dimensionService.getOrAddDataDimensionalItemObject( idA ) );
     }
 }