dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30225
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15326: Tracker, removed method from TrackedEntityStore/Service
------------------------------------------------------------
revno: 15326
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-05-21 09:51:28 +0200
message:
Tracker, removed method from TrackedEntityStore/Service
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.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/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-05-20 16:55:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-05-21 07:51:28 +0000
@@ -38,7 +38,6 @@
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.event.EventStatus;
import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStatus;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
@@ -193,18 +192,6 @@
TrackedEntityInstance getTrackedEntityInstance( String uid );
/**
- * Retrieve entityInstances base on organization unit with result limited
- *
- * @param organisationUnit organisationUnit
- * @param min
- * @param max
- *
- * @return TrackedEntityInstance List
- */
- Collection<TrackedEntityInstance> getTrackedEntityInstances( OrganisationUnit organisationUnit, Integer min,
- Integer max );
-
- /**
* Get entityInstances who has the same representative
*
* @params entityInstance The representatives
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-05-20 16:53:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-05-21 07:51:28 +0000
@@ -33,7 +33,6 @@
import java.util.Map;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
@@ -53,18 +52,6 @@
int getTrackedEntityInstanceCount( TrackedEntityInstanceQueryParams params );
/**
- * Search entityInstances who registered in a certain organisation unit
- *
- * @param organisationUnit Organisation unit where entityInstances
- * registered
- * @param min
- * @param max
- *
- * @return List of entityInstances
- */
- Collection<TrackedEntityInstance> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max );
-
- /**
* Search instances who has the same representative
*
* @param instances Representative
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-05-21 07:08:14 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-05-21 07:51:28 +0000
@@ -41,7 +41,6 @@
import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Program;
-import org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramInstance;
import org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship;
import org.hisp.dhis.organisationunit.OrganisationUnit;
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-05-20 16:55:16 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-05-21 07:51:28 +0000
@@ -526,13 +526,6 @@
}
@Override
- public Collection<TrackedEntityInstance> getTrackedEntityInstances( OrganisationUnit organisationUnit, Integer min,
- Integer max )
- {
- return trackedEntityInstanceStore.getByOrgUnit( organisationUnit, min, max );
- }
-
- @Override
public void updateTrackedEntityInstance( TrackedEntityInstance instance, String representativeId,
Integer relationshipTypeId, List<TrackedEntityAttributeValue> valuesForSave,
List<TrackedEntityAttributeValue> valuesForUpdate, Collection<TrackedEntityAttributeValue> valuesForDelete )
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java 2014-05-20 16:30:51 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java 2014-05-21 07:51:28 +0000
@@ -30,6 +30,7 @@
import java.util.Collection;
+import org.hisp.dhis.common.Grid;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.system.deletion.DeletionHandler;
import org.springframework.beans.factory.annotation.Autowired;
@@ -77,7 +78,11 @@
@Override
public String allowDeleteOrganisationUnit( OrganisationUnit unit )
{
- return instanceService.getTrackedEntityInstances( unit, 0, Integer.MAX_VALUE ).size() == 0 ? null : ERROR;
+ TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
+ params.addOrganisationUnit( unit );
+ Grid grid = instanceService.getTrackedEntityInstances( params );
+
+ return grid.getHeight() == 0 ? null : ERROR;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-05-20 16:56:12 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-05-21 07:51:28 +0000
@@ -41,7 +41,8 @@
import static org.hisp.dhis.trackedentity.TrackedEntityInstanceQueryParams.ORG_UNIT_ID;
import static org.hisp.dhis.trackedentity.TrackedEntityInstanceQueryParams.TRACKED_ENTITY_ID;
import static org.hisp.dhis.trackedentity.TrackedEntityInstanceQueryParams.TRACKED_ENTITY_INSTANCE_ID;
-import static org.hisp.dhis.trackedentity.TrackedEntityInstanceService.*;
+import static org.hisp.dhis.trackedentity.TrackedEntityInstanceService.ERROR_DUPLICATE_IDENTIFIER;
+import static org.hisp.dhis.trackedentity.TrackedEntityInstanceService.SEPARATOR;
import java.util.ArrayList;
import java.util.Collection;
@@ -51,7 +52,6 @@
import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
-import org.hibernate.Query;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
@@ -394,23 +394,6 @@
@Override
@SuppressWarnings( "unchecked" )
- public Collection<TrackedEntityInstance> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max )
- {
- String hql = "select p from TrackedEntityInstance p where p.organisationUnit = :organisationUnit order by p.id DESC";
-
- Query query = getQuery( hql );
- query.setEntity( "organisationUnit", organisationUnit );
-
- if ( min != null && max != null )
- {
- query.setFirstResult( min ).setMaxResults( max );
- }
-
- return query.list();
- }
-
- @Override
- @SuppressWarnings( "unchecked" )
public Collection<TrackedEntityInstance> getRepresentatives( TrackedEntityInstance instance )
{
String hql = "select distinct p from TrackedEntityInstance p where p.representative = :representative order by p.id DESC";
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java 2014-05-16 15:26:10 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java 2014-05-21 07:51:28 +0000
@@ -31,10 +31,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -182,20 +180,6 @@
}
@Test
- public void testGetTrackedEntityInstancesByOu()
- {
- entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
- entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
- entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
-
- Collection<TrackedEntityInstance> entityInstances = entityInstanceService.getTrackedEntityInstances(
- organisationUnit, null, null );
- assertEquals( 2, entityInstances.size() );
- assertTrue( entityInstances.contains( entityInstanceA1 ) );
- assertTrue( entityInstances.contains( entityInstanceA3 ) );
- }
-
- @Test
public void testGetRepresentatives()
{
entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );