← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12641: minor fixes to meta-data importer, change from info to debug on log stmts

 

------------------------------------------------------------
revno: 12641
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 16:38:11 +0200
message:
  minor fixes to meta-data importer, change from info to debug on log stmts
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-09-25 18:09:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-10-14 14:38:11 +0000
@@ -33,7 +33,6 @@
 import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty;
 import org.hisp.dhis.common.NameableObject.NameableProperty;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -58,9 +57,6 @@
     private static final Log log = LogFactory.getLog( DefaultIdentifiableObjectManager.class );
 
     @Autowired
-    private CurrentUserService currentUserService;
-
-    @Autowired
     private Set<GenericIdentifiableObjectStore<IdentifiableObject>> identifiableObjectStores;
 
     @Autowired
@@ -132,13 +128,13 @@
         for ( GenericIdentifiableObjectStore<IdentifiableObject> store : identifiableObjectStores )
         {
             T object = (T) store.getByUid( uid );
-            
+
             if ( object != null )
             {
                 return object;
             }
         }
-        
+
         return null;
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2013-10-14 10:48:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2013-10-14 14:38:11 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.user.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
@@ -51,6 +52,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import static org.springframework.util.Assert.notNull;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -148,9 +151,6 @@
 
                         ImportTypeSummary importTypeSummary = doImport( user, objects, importOptions );
 
-                        // TODO do we need this?
-                        // sessionFactory.getCurrentSession().flush();
-
                         if ( importTypeSummary != null )
                         {
                             importSummary.getImportTypeSummaries().add( importTypeSummary );
@@ -196,6 +196,8 @@
 
     private <T> Importer<T> findImporterClass( List<?> clazzes )
     {
+        notNull( clazzes );
+
         if ( !clazzes.isEmpty() && clazzes.get( 0 ) != null )
         {
             return findImporterClass( clazzes.get( 0 ).getClass() );
@@ -232,7 +234,7 @@
             }
             else
             {
-                log.info( "Importer for object of type " + objects.get( 0 ).getClass().getSimpleName() + " not found." );
+                log.warn( "Importer for object of type " + objects.get( 0 ).getClass().getSimpleName() + " not found." );
             }
         }
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2013-10-04 15:11:46 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2013-10-14 14:38:11 +0000
@@ -116,10 +116,11 @@
         nameMap = new HashMap<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>>();
         usernameMap = new HashMap<String, UserCredentials>();
 
+        populatePeriodTypeMap( PeriodType.class );
+        populateUsernameMap( UserCredentials.class );
+
         for ( Class<?> type : registeredTypes )
         {
-            populateUsernameMap( type );
-            populatePeriodTypeMap( type );
             populateIdentifiableObjectMap( type );
             populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.UID );
             populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.CODE );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2013-10-14 13:55:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2013-10-14 14:38:11 +0000
@@ -317,7 +317,7 @@
 
                         if ( attribute == null )
                         {
-                            log.info( "Unknown reference to " + attributeValue.getAttribute() + " on object " + attributeValue );
+                            log.debug( "Unknown reference to " + attributeValue.getAttribute() + " on object " + attributeValue );
                             return;
                         }
 
@@ -395,7 +395,7 @@
             summaryType.getImportConflicts().add(
                 new ImportConflict( ImportUtils.getDisplayName( object ), "You do not have create access to class type." ) );
 
-            log.info( "You do not have create access to class type." );
+            log.debug( "You do not have create access to class type." );
 
             return false;
         }
@@ -918,7 +918,7 @@
         String logMsg = "Unknown reference to " + identifiableObjectToString( reference ) + " (" + referenceName + ")" +
             " on object " + identifiableObjectToString( object ) + " (" + objectName + ").";
 
-        log.info( logMsg );
+        log.debug( logMsg );
 
         ImportConflict importConflict = new ImportConflict( ImportUtils.getDisplayName( object ), logMsg );
         summaryType.getImportConflicts().add( importConflict );