dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12013
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3552: [DHISMobile] Fix bug "Failed to lazily initialize PatientMobileSetting.PatientAttributes" while u...
------------------------------------------------------------
revno: 3552
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Tue 2011-05-10 15:37:38 +0700
message:
[DHISMobile] Fix bug "Failed to lazily initialize PatientMobileSetting.PatientAttributes" while using "Searching by Identifier".
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.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-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java 2011-04-06 03:19:11 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java 2011-05-10 08:37:38 +0000
@@ -30,6 +30,7 @@
import java.util.Collection;
import org.hibernate.Criteria;
+import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.patient.PatientMobileSetting;
@@ -45,10 +46,8 @@
public Collection<PatientMobileSetting> getCurrentSetting()
{
Session session = sessionFactory.getCurrentSession();
-
Criteria criteria = session.createCriteria( PatientMobileSetting.class );
criteria.setCacheable( true );
-
return criteria.list();
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-04-28 07:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-05-10 08:37:38 +0000
@@ -117,8 +117,6 @@
List<Activity> items = new ArrayList<Activity>();
- this.setSetting( getSettings() );
-
this.setGroupByAttribute( patientAttService.getPatientAttributeByGroupBy( true ) );
Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService
@@ -142,19 +140,20 @@
return new ActivityPlan( items );
}
-
+
@Override
public ActivityPlan getActivitiesByIdentifier( String keyword )
{
-
- long time = PeriodType.createCalendarInstance().getTime().getTime();
+
+ long time = PeriodType.createCalendarInstance().getTime().getTime();
Calendar expiredDate = Calendar.getInstance();
List<Activity> items = new ArrayList<Activity>();
-
- Collection<Patient> patients = patientIdentifierService.getPatientsByIdentifier( keyword, 0, patientIdentifierService.countGetPatientsByIdentifier( keyword ) );
-
+
+ Collection<Patient> patients = patientIdentifierService.getPatientsByIdentifier( keyword, 0,
+ patientIdentifierService.countGetPatientsByIdentifier( keyword ) );
+
if ( patients != null )
{
Iterator<Patient> iterator = patients.iterator();
@@ -162,7 +161,7 @@
while ( iterator.hasNext() )
{
Patient patient = iterator.next();
-
+
List<ProgramStageInstance> programStageInstances = programStageInstanceService
.getProgramStageInstances( patient, false );
@@ -287,6 +286,8 @@
Period period = new Period( new DateTime( patient.getBirthDate() ), new DateTime() );
beneficiary.setAge( period.getYears() );
+ this.setSetting( getSettings() );
+
if ( setting != null )
{
if ( setting.getGender() )
@@ -502,13 +503,11 @@
{
return patientIdentifierService;
}
-
+
@Required
public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
{
this.patientIdentifierService = patientIdentifierService;
}
-
-
}