← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16637: Removed method TrackedEntityAttributeValueStore.getTrackedEntityInstance. We want to use the exis...

 

------------------------------------------------------------
revno: 16637
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-05 11:57:19 -0400
message:
  Removed method TrackedEntityAttributeValueStore.getTrackedEntityInstance. We want to use the existing getTrackedEntityInstances( TrackedEntityInstanceQueryParams ) method for this as we only want to have one place to secure.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStore.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.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/trackedentityattributevalue/TrackedEntityAttributeValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueService.java	2014-05-16 15:26:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueService.java	2014-09-05 15:57:19 +0000
@@ -119,15 +119,4 @@
      * @param destination Destination instance
      */
     void copyTrackedEntityAttributeValues( TrackedEntityInstance source, TrackedEntityInstance destination );
-
-    /**
-     * Retrieve instances who have the same value on an attribute
-     * 
-     * @param attribute TrackedEntityAttribute
-     * @param value An attribute value for searching
-     * 
-     * @return TrackedEntityAttributeValue list
-     */
-    Collection<TrackedEntityInstance> getTrackedEntityInstance( TrackedEntityAttribute attribute, String value );
-
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStore.java	2014-05-16 15:26:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStore.java	2014-09-05 15:57:19 +0000
@@ -112,16 +112,6 @@
     Collection<TrackedEntityAttributeValue> searchByValue( TrackedEntityAttribute attribute, String searchText );
 
     /**
-     * Retrieve instances who have the same value on an attribute
-     * 
-     * @param attribute TrackedEntityAttribute
-     * @param value An attribute value for searching
-     * 
-     * @return TrackedEntityInstance list
-     */
-    Collection<TrackedEntityInstance> getTrackedEntityInstances( TrackedEntityAttribute attribute, String value );
-
-    /**
      * Retrieve attribute values of an instance by a program
      * 
      * @param instance TrackedEntityInstance

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2014-09-05 15:57:19 +0000
@@ -1524,8 +1524,10 @@
 
         for ( TrackedEntityAttribute displayAttribute : attributes )
         {
-            Collection<TrackedEntityInstance> resultPatients = attValueService.getTrackedEntityInstance(
-                displayAttribute, keyword );
+            Collection<TrackedEntityInstance> resultPatients = null; // attValueService.getTrackedEntityInstance( displayAttribute, keyword );
+                
+            //TODO re-implement using DefaultTrackedEntityInstanceService.getTrackedEntityInstances( TrackedEntityInstanceQueryParams )
+                
             // Search in specific OrgUnit
             if ( orgUnitId != 0 )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java	2014-05-16 15:26:10 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java	2014-09-05 15:57:19 +0000
@@ -133,11 +133,4 @@
             addTrackedEntityAttributeValue( _attributeValue );
         }
     }
-
-    @Override
-    public Collection<TrackedEntityInstance> getTrackedEntityInstance( TrackedEntityAttribute attribute, String value )
-    {
-        return attributeValueStore.getTrackedEntityInstances( attribute, value );
-    }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueStore.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentityattributevalue/hibernate/HibernateTrackedEntityAttributeValueStore.java	2014-09-05 15:57:19 +0000
@@ -32,7 +32,6 @@
 import java.util.Collection;
 
 import org.hibernate.Query;
-import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.program.Program;
@@ -112,16 +111,6 @@
 
     @Override
     @SuppressWarnings( "unchecked" )
-    public Collection<TrackedEntityInstance> getTrackedEntityInstances( TrackedEntityAttribute attribute, String value )
-    {
-        return getCriteria(
-            Restrictions.and( Restrictions.eq( "attribute", attribute ), 
-            Restrictions.eq( "value", value ) ) ).
-            setProjection( Projections.property( "entityInstance" ) ).list();
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
     public Collection<TrackedEntityAttributeValue> get( TrackedEntityInstance entityInstance, Program program )
     {
         return getCriteria(

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java	2014-09-05 15:57:19 +0000
@@ -248,17 +248,4 @@
         attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstanceB, attributeA );
         assertNull( attributeValue );
     }
-
-    @Test
-    public void testGetEntityInstances()
-    {
-        attributeValueService.addTrackedEntityAttributeValue( attributeValueA );
-        attributeValueService.addTrackedEntityAttributeValue( attributeValueB );
-        attributeValueService.addTrackedEntityAttributeValue( attributeValueC );
-
-        Collection<TrackedEntityInstance> entityInstances = attributeValueService.getTrackedEntityInstance( attributeA, "A" );
-        assertEquals( 1, entityInstances.size() );
-        assertTrue( entityInstances.contains( entityInstanceA ) );
-    }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java	2014-09-05 15:57:19 +0000
@@ -202,17 +202,4 @@
         Collection<TrackedEntityAttributeValue> attributeValues = attributeValueStore.searchByValue( attributeA, "A" );
         assertTrue( equals( attributeValues, attributeValueA ) );
     }
-
-    @Test
-    public void testGetEntityInstances()
-    {
-        attributeValueStore.saveVoid( attributeValueA );
-        attributeValueStore.saveVoid( attributeValueB );
-        attributeValueStore.saveVoid( attributeValueC );
-
-        Collection<TrackedEntityInstance> entityInstances = attributeValueStore.getTrackedEntityInstances( attributeA, "A" );
-        assertEquals( 1, entityInstances.size() );
-        assertTrue( entityInstances.contains( entityInstanceA ) );
-    }
-
 }