← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20265: Moved constants from DimensionalObjectUtils to DimensionalObject to keep them in the same place

 

------------------------------------------------------------
revno: 20265
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 15:36:12 +0200
message:
  Moved constants from DimensionalObjectUtils to DimensionalObject to keep them in the same place
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObjectUtils.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.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/BaseDimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java	2015-08-02 14:59:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java	2015-09-21 13:36:12 +0000
@@ -203,7 +203,7 @@
 
         String filterItems = filter.substring( opLen, filter.length() );
 
-        return new ArrayList<>( Arrays.asList( filterItems.split( DimensionalObjectUtils.OPTION_SEP ) ) );
+        return new ArrayList<>( Arrays.asList( filterItems.split( DimensionalObject.OPTION_SEP ) ) );
     }
 
     //--------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java	2015-09-16 14:49:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java	2015-09-21 13:36:12 +0000
@@ -71,7 +71,11 @@
 
     String LONGITUDE_DIM_ID = "longitude";
     String LATITUDE_DIM_ID = "latitude";
-   
+
+    String DIMENSION_NAME_SEP = ":";
+    String OPTION_SEP = ";";
+    String ITEM_SEP = "-";
+        
     List<String> STATIC_DIMS = Arrays.asList( 
         LONGITUDE_DIM_ID, LATITUDE_DIM_ID );
     

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObjectUtils.java	2015-08-10 21:57:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObjectUtils.java	2015-09-21 13:36:12 +0000
@@ -28,6 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.common.DimensionalObject.DIMENSION_NAME_SEP;
+import static org.hisp.dhis.common.DimensionalObject.ITEM_SEP;
+import static org.hisp.dhis.common.DimensionalObject.OPTION_SEP;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -50,10 +54,6 @@
  */
 public class DimensionalObjectUtils
 {
-    public static final String DIMENSION_NAME_SEP = ":";
-    public static final String OPTION_SEP = ";";
-    public static final String ITEM_SEP = "-";
-    
     private static final Pattern INT_PATTERN = Pattern.compile( "^(0|-?[1-9]\\d*)$" );
     private static final Pattern DIMENSIONAL_OPERAND_PATTERN = Pattern.compile( "([a-zA-Z]\\w{10})\\.([a-zA-Z]\\w{10})" );
     

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-09-08 18:09:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-09-21 13:36:12 +0000
@@ -1088,11 +1088,11 @@
         
         Map<MeasureFilter, Double> map = new HashMap<>();
         
-        String[] criteria = param.split( DimensionalObjectUtils.OPTION_SEP );
+        String[] criteria = param.split( DimensionalObject.OPTION_SEP );
         
         for ( String c : criteria )
         {
-            String[] criterion = c.split( DimensionalObjectUtils.DIMENSION_NAME_SEP );
+            String[] criterion = c.split( DimensionalObject.DIMENSION_NAME_SEP );
             
             if ( criterion != null && criterion.length == 2 && MathUtils.isNumeric( criterion[1] ) )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-17 16:41:41 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-21 13:36:12 +0000
@@ -33,8 +33,8 @@
 import static org.hisp.dhis.analytics.AnalyticsService.OU_NAME_HIERARCHY_KEY;
 import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
 import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
-import static org.hisp.dhis.common.DimensionalObjectUtils.DIMENSION_NAME_SEP;
-import static org.hisp.dhis.common.DimensionalObjectUtils.ITEM_SEP;
+import static org.hisp.dhis.common.DimensionalObject.DIMENSION_NAME_SEP;
+import static org.hisp.dhis.common.DimensionalObject.ITEM_SEP;
 import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensionFromParam;
 import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensionItemsFromParam;
 import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-09-21 13:36:12 +0000
@@ -50,7 +50,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.DimensionalObjectUtils;
+import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.common.IllegalQueryException;
@@ -464,7 +464,7 @@
      */
     private QueryItem getQueryItem( String item )
     {
-        String[] split = item.split( DimensionalObjectUtils.DIMENSION_NAME_SEP );
+        String[] split = item.split( DimensionalObject.DIMENSION_NAME_SEP );
 
         if ( split == null || (split.length % 2 != 1) )
         {
@@ -509,13 +509,13 @@
             return null;
         }
 
-        if ( !query.contains( DimensionalObjectUtils.DIMENSION_NAME_SEP ) )
+        if ( !query.contains( DimensionalObject.DIMENSION_NAME_SEP ) )
         {
             return new QueryFilter( QueryOperator.EQ, query );
         }
         else
         {
-            String[] split = query.split( DimensionalObjectUtils.DIMENSION_NAME_SEP );
+            String[] split = query.split( DimensionalObject.DIMENSION_NAME_SEP );
 
             if ( split == null || split.length != 2 )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2015-07-15 15:49:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2015-09-21 13:36:12 +0000
@@ -28,8 +28,25 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.apache.commons.lang3.StringUtils.trimToNull;
+import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_CACHE_STRATEGY;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.io.IOUtils;
-import org.hisp.dhis.common.DimensionalObjectUtils;
+import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObjectUtils;
 import org.hisp.dhis.common.cache.CacheStrategy;
@@ -41,22 +58,6 @@
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static org.apache.commons.lang3.StringUtils.trimToNull;
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_CACHE_STRATEGY;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
-
 /**
  * @author Lars Helge Overland
  */
@@ -271,7 +272,7 @@
 
         for ( String dim : dimensions )
         {
-            String[] dims = dim.split( DimensionalObjectUtils.DIMENSION_NAME_SEP );
+            String[] dims = dim.split( DimensionalObject.DIMENSION_NAME_SEP );
 
             if ( dims.length == 2 && dims[0] != null && dims[1] != null )
             {