dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35661
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18246: TEI query, reduced logging
------------------------------------------------------------
revno: 18246
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-12 21:21:56 +0100
message:
TEI query, reduced logging
modified:
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.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-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 2015-01-28 10:50:56 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2015-02-12 20:21:56 +0000
@@ -49,6 +49,8 @@
import java.util.Map;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
@@ -65,7 +67,6 @@
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramStatus;
import org.hisp.dhis.system.util.SqlHelper;
-import org.hisp.dhis.util.Timer;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceQueryParams;
@@ -82,6 +83,8 @@
extends HibernateIdentifiableObjectStore<TrackedEntityInstance>
implements TrackedEntityInstanceStore
{
+ private static final Log log = LogFactory.getLog( HibernateTrackedEntityInstanceStore.class );
+
private static final Map<ProgramStatus, Integer> PROGRAM_STATUS_MAP = new HashMap<ProgramStatus, Integer>()
{
{
@@ -147,11 +150,9 @@
// Query
// ---------------------------------------------------------------------
- Timer t = new Timer().start();
-
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
- t.getTime( "Tracked entity instance query SQL: " + sql );
+ log.debug( "Tracked entity instance query SQL: " + sql );
List<Map<String, String>> list = new ArrayList<>();
@@ -197,11 +198,9 @@
// Query
// ---------------------------------------------------------------------
- Timer t = new Timer().start();
-
Integer count = jdbcTemplate.queryForObject( sql, Integer.class );
- t.getTime( "Tracked entity instance count SQL: " + sql );
+ log.debug( "Tracked entity instance count SQL: " + sql );
return count;
}
@@ -388,9 +387,9 @@
public String validate( TrackedEntityInstance instance, TrackedEntityAttributeValue attributeValue, Program program )
{
TrackedEntityAttribute attribute = attributeValue.getAttribute();
+
try
{
-
if ( attribute.isUnique() )
{
Criteria criteria = getCriteria();