← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21926: minor fixes

 

------------------------------------------------------------
revno: 21926
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-10 15:22:47 +0700
message:
  minor fixes
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatValidation.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.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/preheat/PreheatService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatService.java	2016-02-10 07:58:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatService.java	2016-02-10 08:22:47 +0000
@@ -80,12 +80,11 @@
 
     /**
      * Checks but does not connect any references, returns check report
-     *
-     * @param objects    Object to check
+     *  @param objects    Object to check
      * @param preheat    Preheat Cache to use
      * @param identifier Use this identifier type to check references
      */
-    Map<String, PreheatValidation> checkReferences( List<IdentifiableObject> objects, Preheat preheat, PreheatIdentifier identifier );
+    List<PreheatValidation> checkReferences( List<IdentifiableObject> objects, Preheat preheat, PreheatIdentifier identifier );
 
     /**
      * Checks but does not connect any references, returns check report

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatValidation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatValidation.java	2016-02-10 03:08:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatValidation.java	2016-02-10 08:22:47 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.base.MoreObjects;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.schema.Property;
 
@@ -54,4 +55,13 @@
     {
         return invalidReferences;
     }
+
+
+    @Override
+    public String toString()
+    {
+        return MoreObjects.toStringHelper( this )
+            .add( "invalidReferences", invalidReferences )
+            .toString();
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java	2016-02-10 07:58:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java	2016-02-10 08:22:47 +0000
@@ -41,6 +41,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -249,12 +250,12 @@
     }
 
     @Override
-    public Map<String, PreheatValidation> checkReferences( List<IdentifiableObject> objects, Preheat preheat, PreheatIdentifier identifier )
+    public List<PreheatValidation> checkReferences( List<IdentifiableObject> objects, Preheat preheat, PreheatIdentifier identifier )
     {
-        Map<String, PreheatValidation> preheatValidationMap = new HashMap<>();
-        objects.forEach( o -> preheatValidationMap.put( identifier.getIdentifier( o ), checkReferences( o, preheat, identifier ) ) );
+        List<PreheatValidation> preheatValidations = new ArrayList<>();
+        objects.forEach( object -> preheatValidations.add( checkReferences( object, preheat, identifier ) ) );
 
-        return preheatValidationMap;
+        return preheatValidations;
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java	2016-02-10 06:31:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java	2016-02-10 08:22:47 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.preheat.PreheatValidation;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -39,18 +40,18 @@
  */
 public class ObjectBundleValidation
 {
-    private Map<Class<? extends IdentifiableObject>, Map<String, PreheatValidation>> preheatValidations = new HashMap<>();
+    private Map<Class<? extends IdentifiableObject>, List<PreheatValidation>> preheatValidations = new HashMap<>();
 
     public ObjectBundleValidation()
     {
     }
 
-    public void addInvalidReferences( Class<? extends IdentifiableObject> klass, Map<String, PreheatValidation> preheatValidations )
+    public void addInvalidReferences( Class<? extends IdentifiableObject> klass, List<PreheatValidation> preheatValidations )
     {
         this.preheatValidations.put( klass, preheatValidations );
     }
 
-    public Map<Class<? extends IdentifiableObject>, Map<String, PreheatValidation>> getPreheatValidations()
+    public Map<Class<? extends IdentifiableObject>, List<PreheatValidation>> getPreheatValidations()
     {
         return preheatValidations;
     }