dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40802
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20758: Minor fixes, doc updates + lambda updates
------------------------------------------------------------
revno: 20758
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-19 16:45:24 +0700
message:
Minor fixes, doc updates + lambda updates
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java 2015-06-10 03:15:14 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java 2015-10-19 09:45:24 +0000
@@ -40,11 +40,12 @@
{
/**
* Import a single object, return null or a ImportConflict is there is a conflict.
- * <p/>
+ * <p>
* This is meant to be a one-off import of a single object, if you want to import multiple
* objects, then use importObjects..
*
- * @param object Object to import
+ * @param user User User who is importing
+ * @param objects Objects to import
* @param options Import options
* @return ImportConflict instance if a conflict occurred, if not null
*/
@@ -53,7 +54,8 @@
/**
* Import a collection of objects.
*
- * @param objects The collection to import
+ * @param user User User who is importing
+ * @param object The object to import
* @param options Import options
* @return List of all the ImportConflicts encountered
*/
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/handlers/ObjectHandlerUtils.java 2015-10-19 09:45:24 +0000
@@ -37,52 +37,46 @@
{
public static <T> void preObjectHandlers( T object, List<ObjectHandler<T>> objectHandlers )
{
- for ( ObjectHandler<T> objectHandler : objectHandlers )
+ if ( objectHandlers.isEmpty() )
{
- if ( objectHandler.canHandle( object.getClass() ) )
- {
- objectHandler.preImportObject( object );
- }
+ return;
}
+
+ objectHandlers.stream().filter( objectHandler -> objectHandler.canHandle( object.getClass() ) )
+ .forEach( objectHandler -> objectHandler.preImportObject( object ) );
}
public static <T> void postObjectHandlers( T object, List<ObjectHandler<T>> objectHandlers )
{
- for ( ObjectHandler<T> objectHandler : objectHandlers )
+ if ( objectHandlers.isEmpty() )
{
- if ( objectHandler.canHandle( object.getClass() ) )
- {
- objectHandler.postImportObject( object );
- }
+ return;
}
+
+ objectHandlers.stream().filter( objectHandler -> objectHandler.canHandle( object.getClass() ) )
+ .forEach( objectHandler -> objectHandler.postImportObject( object ) );
}
public static <T> void preObjectsHandlers( List<T> objects, List<ObjectHandler<T>> objectHandlers )
{
- if ( !objects.isEmpty() )
+ if ( objectHandlers.isEmpty() )
{
- for ( ObjectHandler<T> objectHandler : objectHandlers )
- {
- if ( objectHandler.canHandle( objects.get( 0 ).getClass() ) )
- {
- objectHandler.preImportObjects( objects );
- }
- }
+ return;
}
+
+ objectHandlers.stream().filter( objectHandler -> objectHandler.canHandle( objects.get( 0 ).getClass() ) )
+ .forEach( objectHandler -> objectHandler.preImportObjects( objects ) );
}
public static <T> void postObjectsHandlers( List<T> objects, List<ObjectHandler<T>> objectHandlers )
{
- if ( !objects.isEmpty() )
+ if ( objectHandlers.isEmpty() )
{
- for ( ObjectHandler<T> objectHandler : objectHandlers )
- {
- if ( objectHandler.canHandle( objects.get( 0 ).getClass() ) )
- {
- objectHandler.postImportObjects( objects );
- }
- }
+ return;
}
+
+ objectHandlers.stream().filter( objectHandler -> objectHandler.canHandle( objects.get( 0 ).getClass() ) )
+ .forEach( objectHandler -> objectHandler.postImportObjects( objects ) );
}
private ObjectHandlerUtils()