← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20443: Moved Counter.java to import-export. Removed CompositeCounter.java. Added javadoc.

 

------------------------------------------------------------
revno: 20443
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-01 16:39:13 +0200
message:
  Moved Counter.java to import-export. Removed CompositeCounter.java. Added javadoc.
removed:
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/CompositeCounter.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/Counter.java
added:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/Counter.java
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryCategoryOptionAssociationConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/DaysBetweenSqlFunction.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.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
=== added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/Counter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/Counter.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/Counter.java	2015-10-01 14:39:13 +0000
@@ -0,0 +1,77 @@
+package org.hisp.dhis.importexport;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Class which can count occurrences of a given key.
+ * 
+ * @author Lars Helge Overland
+ */
+public class Counter<T>
+{
+    private Map<T, Integer> map;
+    
+    public Counter()
+    {
+        map = new HashMap<>();
+    }
+    
+    public int count( T key )
+    {
+        if ( !map.containsKey( key ) )
+        {
+            map.put( key, 0 );
+        }
+        
+        int count = map.get( key );
+        
+        map.put( key, ++count );
+        
+        return count;
+    }
+    
+    public Map<T, Integer> getCount()
+    {
+        return map;
+    }
+    
+    public Integer getCount( T key )
+    {
+        return map != null && map.containsKey( key ) ? map.get( key ) : 0;
+    }
+ 
+    @Override
+    public String toString()
+    {
+        return "[" + map.toString() + "]";
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryCategoryOptionAssociationConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryCategoryOptionAssociationConverter.java	2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryCategoryOptionAssociationConverter.java	2015-10-01 14:39:13 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.importexport.AssociationType;
+import org.hisp.dhis.importexport.Counter;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.GroupMemberAssociation;
 import org.hisp.dhis.importexport.GroupMemberType;
@@ -46,7 +47,6 @@
 import org.hisp.dhis.importexport.Importer;
 import org.hisp.dhis.importexport.XMLConverter;
 import org.hisp.dhis.importexport.importer.GroupMemberImporter;
-import org.hisp.dhis.commons.util.Counter;
 
 /**
  * @author Lars Helge Overland

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java	2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java	2015-10-01 14:39:13 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.importexport.AssociationType;
+import org.hisp.dhis.importexport.Counter;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.GroupMemberAssociation;
 import org.hisp.dhis.importexport.GroupMemberType;
@@ -46,7 +47,6 @@
 import org.hisp.dhis.importexport.Importer;
 import org.hisp.dhis.importexport.XMLConverter;
 import org.hisp.dhis.importexport.importer.GroupMemberImporter;
-import org.hisp.dhis.commons.util.Counter;
 
 /**
  * @author Lars Helge Overland

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/DaysBetweenSqlFunction.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/DaysBetweenSqlFunction.java	2015-09-24 19:18:20 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/DaysBetweenSqlFunction.java	2015-10-01 14:39:13 +0000
@@ -29,6 +29,8 @@
  */
 
 /**
+ * Function which evaluates to the number of days between two given dates.
+ * 
  * @author Lars Helge Overland
  */
 public class DaysBetweenSqlFunction

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java	2015-09-24 19:18:20 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java	2015-10-01 14:39:13 +0000
@@ -29,6 +29,8 @@
  */
 
 /**
+ * Functional interface for SQL operations.
+ * 
  * @author Lars Helge Overland
  */
 public interface SqlFunction

=== removed file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/CompositeCounter.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/CompositeCounter.java	2015-07-03 20:43:24 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/CompositeCounter.java	1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-package org.hisp.dhis.commons.util;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * Class which can count occurrences of a given composite key.
- * 
- * @author Lars Helge Overland
- */
-public class CompositeCounter
-    extends Counter<String>
-{
-    private static final char SEPARATOR = '-';
-    
-    public CompositeCounter()
-    {
-        super();
-    }
-    
-    public int count( Object... objects )
-    {
-        String key = getKey( objects );
-        
-        return super.count( key );
-    }
-    
-    public Integer getCount( Object... objects )
-    {
-        return super.getCount( getKey( objects ) );
-    }
-    
-    private String getKey( Object... objects )
-    {
-        StringBuilder builder = new StringBuilder();
-        
-        for ( Object o : objects )
-        {
-            builder.append( o.hashCode() ).append( SEPARATOR );
-        }
-        
-        return builder.toString();
-    }
-}

=== removed file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/Counter.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/Counter.java	2015-07-03 20:43:24 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/Counter.java	1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-package org.hisp.dhis.commons.util;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Class which can count occurrences of a given key.
- * 
- * @author Lars Helge Overland
- */
-public class Counter<T>
-{
-    private Map<T, Integer> map;
-    
-    public Counter()
-    {
-        map = new HashMap<>();
-    }
-    
-    public int count( T key )
-    {
-        if ( !map.containsKey( key ) )
-        {
-            map.put( key, 0 );
-        }
-        
-        int count = map.get( key );
-        
-        map.put( key, ++count );
-        
-        return count;
-    }
-    
-    public Map<T, Integer> getCount()
-    {
-        return map;
-    }
-    
-    public Integer getCount( T key )
-    {
-        return map != null && map.containsKey( key ) ? map.get( key ) : 0;
-    }
- 
-    @Override
-    public String toString()
-    {
-        return "[" + map.toString() + "]";
-    }
-}

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java	2015-10-01 13:14:27 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java	2015-10-01 14:39:13 +0000
@@ -33,6 +33,8 @@
 import java.util.Date;
 
 /**
+ * Class for functions to be used in JEXL expression evaluation.
+ * 
  * @author Lars Helge Overland
  */
 public class ExpressionFunctions

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java	2015-10-01 13:14:27 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java	2015-10-01 14:39:13 +0000
@@ -107,7 +107,7 @@
 
     /**
      * Replaces common newline characters like \n, \r, \r\n to the HTML line
-     * break tag <br>.
+     * break tag br.
      * 
      * @param text the text to substitute.
      * @return the substituted text.