← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8715: Applied some generics in dhis-dxf2

 

------------------------------------------------------------
revno: 8715
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-25 18:44:59 +0200
message:
  Applied some generics in dhis-dxf2
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapStore.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapStore.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/mapping/MapStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapStore.java	2012-10-25 12:38:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapStore.java	2012-10-25 16:44:59 +0000
@@ -1,10 +1,40 @@
 package org.hisp.dhis.mapping;
 
+/*
+ * Copyright (c) 2004-2005, 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 <ORGANIZATION> 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.Collection;
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.user.User;
 
+/**
+ * @author Lars Helge Overland
+ */
 public interface MapStore
     extends GenericIdentifiableObjectStore<Map>
 {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2012-06-25 20:14:42 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2012-10-25 16:44:59 +0000
@@ -510,7 +510,7 @@
 
     private <T> boolean _shortNameUnique( T object )
     {
-        for ( Class clazz : shortNameNotUnique )
+        for ( Class<?> clazz : shortNameNotUnique )
         {
             if ( clazz.isAssignableFrom( object.getClass() ) )
             {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java	2012-06-26 12:06:43 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java	2012-10-25 16:44:59 +0000
@@ -7,10 +7,9 @@
  */
 public class ObjectHandlerUtils
 {
-    @SuppressWarnings( "unchecked" )
-    public static <T> void preObjectHandlers( T object, List<ObjectHandler> objectHandlers )
+    public static <T> void preObjectHandlers( T object, List<ObjectHandler<T>> objectHandlers )
     {
-        for ( ObjectHandler objectHandler : objectHandlers )
+        for ( ObjectHandler<T> objectHandler : objectHandlers )
         {
             if ( objectHandler.canHandle( object.getClass() ) )
             {
@@ -19,10 +18,9 @@
         }
     }
 
-    @SuppressWarnings( "unchecked" )
-    public static <T> void postObjectHandlers( T object, List<ObjectHandler> objectHandlers )
+    public static <T> void postObjectHandlers( T object, List<ObjectHandler<T>> objectHandlers )
     {
-        for ( ObjectHandler objectHandler : objectHandlers )
+        for ( ObjectHandler<T> objectHandler : objectHandlers )
         {
             if ( objectHandler.canHandle( object.getClass() ) )
             {
@@ -31,12 +29,11 @@
         }
     }
 
-    @SuppressWarnings( "unchecked" )
-    public static <T> void preObjectsHandlers( List<T> objects, List<ObjectHandler> objectHandlers )
+    public static <T> void preObjectsHandlers( List<T> objects, List<ObjectHandler<T>> objectHandlers )
     {
         if ( objects.size() > 0 )
         {
-            for ( ObjectHandler objectHandler : objectHandlers )
+            for ( ObjectHandler<T> objectHandler : objectHandlers )
             {
                 if ( objectHandler.canHandle( objects.get( 0 ).getClass() ) )
                 {
@@ -46,12 +43,11 @@
         }
     }
 
-    @SuppressWarnings( "unchecked" )
-    public static <T> void postObjectsHandlers( List<T> objects, List<ObjectHandler> objectHandlers )
+    public static <T> void postObjectsHandlers( List<T> objects, List<ObjectHandler<T>> objectHandlers )
     {
         if ( objects.size() > 0 )
         {
-            for ( ObjectHandler objectHandler : objectHandlers )
+            for ( ObjectHandler<T> objectHandler : objectHandlers )
             {
                 if ( objectHandler.canHandle( objects.get( 0 ).getClass() ) )
                 {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2012-08-22 12:45:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2012-10-25 16:44:59 +0000
@@ -92,7 +92,7 @@
     private SessionFactory sessionFactory;
 
     @Autowired( required = false )
-    private List<ObjectHandler> objectHandlers;
+    private List<ObjectHandler<T>> objectHandlers;
 
     //-------------------------------------------------------------------------------------------------------
     // Constructor

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java	2012-09-26 08:46:31 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java	2012-10-25 16:44:59 +0000
@@ -27,25 +27,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dxf2.metadata.ImportOptions;
 import org.hisp.dhis.dxf2.metadata.ImportService;
 import org.hisp.dhis.dxf2.metadata.MetaData;
-import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.scheduling.TaskId;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public class ImportMetaDataTask
     implements Runnable
 {
-    private static final Log log = LogFactory.getLog( ImportMetaDataTask.class );
-
     private ImportService importService;
 
     private ImportOptions importOptions;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapStore.java	2012-10-25 12:38:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapStore.java	2012-10-25 16:44:59 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.mapping.hibernate;
 
+/*
+ * Copyright (c) 2004-2005, 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 <ORGANIZATION> 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.Collection;
 
 import org.hibernate.criterion.Restrictions;
@@ -8,6 +35,9 @@
 import org.hisp.dhis.mapping.MapStore;
 import org.hisp.dhis.user.User;
 
+/**
+ * @author Lars Helge Overland
+ */
 public class HibernateMapStore
     extends HibernateIdentifiableObjectStore<Map> implements MapStore
 {