← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8078: Remove the old activity plan function and clear up related code (Done).

 

------------------------------------------------------------
revno: 8078
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-09-14 09:43:21 +0700
message:
  Remove the old activity plan function and clear up related code (Done).
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/Activity.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml


--
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
=== removed directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan'
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/Activity.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/Activity.java	2011-11-25 18:32:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/Activity.java	1970-01-01 00:00:00 +0000
@@ -1,113 +0,0 @@
-/**
- * 
- */
-package org.hisp.dhis.activityplan;
-
-import java.util.Date;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.program.ProgramStageInstance;
-
-/**
- * @author abyotag_adm
- */
-public class Activity
-{
-    private OrganisationUnit provider;
-
-    private Patient beneficiary;
-
-    private ProgramStageInstance task;
-
-    private Date dueDate;
-    
-    private boolean completed;
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public Activity()
-    {
-    }
-
-    /**
-     * @return the provider
-     */
-    public OrganisationUnit getProvider()
-    {
-        return provider;
-    }
-
-    /**
-     * @param provider the provider to set
-     */
-    public void setProvider( OrganisationUnit provider )
-    {
-        this.provider = provider;
-    }
-
-    /**
-     * @return the beneficiary
-     */
-    public Patient getBeneficiary()
-    {
-        return beneficiary;
-    }
-
-    /**
-     * @param beneficiary the beneficiary to set
-     */
-    public void setBeneficiary( Patient beneficiary )
-    {
-        this.beneficiary = beneficiary;
-    }
-
-    /**
-     * @return the task
-     */
-    public ProgramStageInstance getTask()
-    {
-        return task;
-    }
-
-    /**
-     * @param task the task to set
-     */
-    public void setTask( ProgramStageInstance task )
-    {
-        this.task = task;
-    }
-    
-    /**
-     * @param dueDate the dueDate to set
-     */
-    public void setDueDate( Date dueDate )
-    {
-        this.dueDate = dueDate;
-    }
-
-    /**
-     * @return the dueDate
-     */
-    public Date getDueDate()
-    {
-        return dueDate;
-    }
-
-	/**
-	 * @param completed the completed to set
-	 */
-	public void setCompleted(boolean completed) {
-		this.completed = completed;
-	}
-
-	/**
-	 * @return the completed
-	 */
-	public boolean isCompleted() {
-		return completed;
-	}
-
-}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanService.java	2011-05-23 06:10:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanService.java	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-/**
- * 
- */
-package org.hisp.dhis.activityplan;
-
-import java.util.Collection;
-import java.util.Date;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramStageInstance;
-
-/**
- * @author abyotag_adm
- * 
- */
-public interface ActivityPlanService
-{
-    String ID = ActivityPlanService.class.getName();
-
-    Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit );
-    
-    Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit, int min, int max );
-
-    Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit, Collection<Program> programs );
-
-    Collection<Activity> getActivitiesByProgram( Collection<Program> programs );
-
-    Collection<Activity> getActivitiesByBeneficiary( Patient beneficiary );
-
-    Collection<Activity> getActivitiesByTask( ProgramStageInstance task );
-
-    Collection<Activity> getActivitiesByDueDate( Date dueDate );
-
-    Collection<Activity> getActivitiesWithInDate( Date startDate, Date endDate );
-
-    Collection<Activity> getCurrentActivitiesByProvider( OrganisationUnit organisationUnit );
-    
-    int countActivitiesByProvider ( OrganisationUnit organisationUnit );
-
-}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanStore.java	2011-05-23 06:10:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/activityplan/ActivityPlanStore.java	1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
-/**
- * 
- */
-package org.hisp.dhis.activityplan;
-
-import java.util.Collection;
-
-/**
- * @author abyotag_adm
- * 
- */
-public interface ActivityPlanStore
-{
-    String ID = ActivityPlanStore.class.getName();
-
-    Collection<Integer> getActivitiesByProvider( Integer orgunitId, int max, int min );
-    
-    int countActivitiesByProvider ( Integer orgunitId );
-}

=== 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	2012-06-15 04:30:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-09-14 02:43:21 +0000
@@ -40,7 +40,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.activityplan.ActivityPlanService;
 import org.hisp.dhis.api.mobile.ActivityReportingService;
 import org.hisp.dhis.api.mobile.NotAllowedException;
 import org.hisp.dhis.api.mobile.PatientMobileSettingService;
@@ -89,7 +88,7 @@
 
     private ProgramStageInstanceService programStageInstanceService;
 
-    private ActivityPlanService activityPlanService;
+//    private ActivityPlanService activityPlanService;
 
     private PatientAttributeValueService patientAttValueService;
 
@@ -118,20 +117,20 @@
 
         this.setGroupByAttribute( patientAttService.getPatientAttributeByGroupBy( true ) );
 
-        Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService
-            .getCurrentActivitiesByProvider( unit );
-
-        for ( org.hisp.dhis.activityplan.Activity activity : activities )
-        {
-            items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
-        }
-
-        if ( items.isEmpty() )
-        {
-            return null;
-        }
-
-        Collections.sort( items, activityComparator );
+//        Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService
+//            .getCurrentActivitiesByProvider( unit );
+//
+//        for ( org.hisp.dhis.activityplan.Activity activity : activities )
+//        {
+//            items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
+//        }
+//
+//        if ( items.isEmpty() )
+//        {
+//            return null;
+//        }
+//
+//        Collections.sort( items, activityComparator );
 
         if ( DEBUG )
             log.debug( "Found " + items.size() + " current activities in " + (System.currentTimeMillis() - time)
@@ -149,16 +148,16 @@
 
         this.setGroupByAttribute( patientAttService.getPatientAttributeByGroupBy( true ) );
 
-        Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService.getActivitiesByProvider( unit );
-
-        for ( org.hisp.dhis.activityplan.Activity activity : activities )
-        {
-            if ( activity.getDueDate() != null )
-            {
-                items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
-            }
-
-        }
+//        Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService.getActivitiesByProvider( unit );
+//
+//        for ( org.hisp.dhis.activityplan.Activity activity : activities )
+//        {
+//            if ( activity.getDueDate() != null )
+//            {
+//                items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
+//            }
+//
+//        }
 
         if ( items.isEmpty() )
         {
@@ -502,10 +501,10 @@
         this.patientMobileSettingService = patientMobileSettingService;
     }
 
-    public void setActivityPlanService( org.hisp.dhis.activityplan.ActivityPlanService activityPlanService )
-    {
-        this.activityPlanService = activityPlanService;
-    }
+//    public void setActivityPlanService( org.hisp.dhis.activityplan.ActivityPlanService activityPlanService )
+//    {
+//        this.activityPlanService = activityPlanService;
+//    }
 
     public PatientMobileSetting getSetting()
     {

=== removed directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan'
=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2012-06-20 08:57:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	1970-01-01 00:00:00 +0000
@@ -1,407 +0,0 @@
-package org.hisp.dhis.activityplan;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.system.util.DateUtils;
-
-/**
- * @author abyotag_adm
- * 
- */
-public class DefaultActivityPlanService
-    implements ActivityPlanService
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private ActivityPlanStore activityPlanStore;
-
-    public void setActivityPlanStore( ActivityPlanStore activityPlanStore )
-    {
-        this.activityPlanStore = activityPlanStore;
-    }
-
-    private ProgramService programService;
-
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
-    private ProgramInstanceService programInstanceService;
-
-    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
-    {
-        this.programInstanceService = programInstanceService;
-    }
-
-    private PatientDataValueService patientDataValueService;
-
-    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
-    {
-        this.patientDataValueService = patientDataValueService;
-    }
-
-    private ProgramStageInstanceService programStageInstanceService;
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Activity Plan
-    // -------------------------------------------------------------------------
-
-    @Override
-    public Collection<Activity> getActivitiesByBeneficiary( Patient beneficiary )
-    {
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( beneficiary, false );
-
-        return getActivties( programInstances );
-    }
-
-    public Collection<Activity> getCurrentActivitiesByProvider( OrganisationUnit organisationUnit )
-    {
-        long time = PeriodType.createCalendarInstance().getTime().getTime();
-
-        List<Activity> items = new ArrayList<Activity>();
-
-        List<ProgramInstance> programInstances = new ArrayList<ProgramInstance>();
-
-        Collection<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION,
-            organisationUnit );
-
-        for ( Program program : programs )
-        {
-            programInstances.addAll( programInstanceService.getProgramInstances( program, organisationUnit ) );
-        }
-
-        Calendar expiredDate = Calendar.getInstance();
-
-        for ( ProgramInstance programInstance : programInstances )
-        {
-            Set<ProgramStageInstance> programStageInstances = programInstance.getProgramStageInstances();
-            for ( ProgramStageInstance programStageInstance : programStageInstances )
-            {
-                if ( !programStageInstance.isCompleted() )
-                {
-                    expiredDate.setTime( DateUtils.getDateAfterAddition( programStageInstance.getDueDate(),
-                        programStageInstance.getProgramInstance().getProgram().getMaxDaysAllowedInputData() ) );
-
-                    // TODO compare with date.before
-
-                    if ( programStageInstance.getDueDate().getTime() <= time && expiredDate.getTimeInMillis() > time )
-                    {
-                        Activity activity = new Activity();
-                        activity.setBeneficiary( programInstance.getPatient() );
-                        activity.setTask( programStageInstance );
-                        activity.setDueDate( programStageInstance.getDueDate() );
-                        items.add( activity );
-                    }
-                }
-            }
-        }
-        return items;
-    }
-
-    public Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit )
-    {
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        Collection<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION,
-            organisationUnit );
-
-        if ( programs.size() > 0 )
-        {
-            // -----------------------------------------------------------------
-            // For all the programs a facility is servicing get active programs,
-            // those with active instances (completed = false)
-            // -----------------------------------------------------------------
-
-            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( programs, false );
-
-            // -----------------------------------------------------------------
-            // Get next activities for the active programInstances
-            // -----------------------------------------------------------------
-
-            activities = getActivties( programInstances );
-        }
-
-        return activities;
-    }
-
-    public Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit, Collection<Program> programs )
-    {
-
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        if ( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit ).containsAll(
-            programs ) )
-        {
-            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( programs, false );
-
-            // -----------------------------------------------------------------
-            // Get next activities for the active programInstances
-            // -----------------------------------------------------------------
-
-            activities = getActivties( programInstances );
-        }
-
-        return activities;
-    }
-
-    public Collection<Activity> getActivitiesByProgram( Collection<Program> programs )
-    {
-
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( programs, false );
-
-        // -----------------------------------------------------------------
-        // Get next activities for the active programInstances
-        // -----------------------------------------------------------------
-
-        activities = getActivties( programInstances );
-
-        return activities;
-    }
-
-    @Override
-    public Collection<Activity> getActivitiesByTask( ProgramStageInstance task )
-    {
-        // ---------------------------------------------------------------------
-        // Get the parent program for the given program stage
-        // ---------------------------------------------------------------------
-
-        Program program = task.getProgramInstance().getProgram();
-
-        // ---------------------------------------------------------------------
-        // Pick only those active instances for the identified program
-        // ---------------------------------------------------------------------
-
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program, false );
-
-        // ---------------------------------------------------------------------
-        // Get next activities for the active programInstances
-        // ---------------------------------------------------------------------
-
-        return getActivties( programInstances );
-    }
-
-    @Override
-    public Collection<Activity> getActivitiesByDueDate( Date dueDate )
-    {
-        // ---------------------------------------------------------------------
-        // Get all active stageInstances within the given due date
-        // ---------------------------------------------------------------------
-
-        Collection<ProgramStageInstance> programStageInstances = programStageInstanceService.getProgramStageInstances(
-            dueDate, false );
-
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        for ( ProgramStageInstance programStageInstance : programStageInstances )
-        {
-
-            Activity activity = new Activity();
-            activity.setBeneficiary( programStageInstance.getProgramInstance().getPatient() );
-            activity.setTask( programStageInstance );
-            activity.setDueDate( programStageInstance.getDueDate() );
-            activities.add( activity );
-        }
-
-        return activities;
-    }
-
-    @Override
-    public Collection<Activity> getActivitiesWithInDate( Date startDate, Date endDate )
-    {
-        // ---------------------------------------------------------------------
-        // Get all active stageInstances within the given time frame
-        // ---------------------------------------------------------------------
-
-        Collection<ProgramStageInstance> programStageInstances = programStageInstanceService.getProgramStageInstances(
-            startDate, endDate, false );
-
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        for ( ProgramStageInstance programStageInstance : programStageInstances )
-        {
-
-            Activity activity = new Activity();
-            activity.setBeneficiary( programStageInstance.getProgramInstance().getPatient() );
-            activity.setTask( programStageInstance );
-            activity.setDueDate( programStageInstance.getDueDate() );
-            activities.add( activity );
-        }
-
-        return activities;
-
-    }
-
-    public Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit, int min, int max )
-    {
-        Collection<Integer> programStageInstanceIds = activityPlanStore.getActivitiesByProvider( organisationUnit
-            .getId(), min, max );
-
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        if ( programStageInstanceIds != null )
-        {
-            for ( Integer id : programStageInstanceIds )
-            {
-                ProgramStageInstance instance = programStageInstanceService.getProgramStageInstance( id );
-                Activity activity = new Activity();
-                activity.setBeneficiary( instance.getProgramInstance().getPatient() );
-                activity.setTask( instance );
-                activity.setDueDate( instance.getDueDate() );
-                activities.add( activity );
-            }
-        }
-
-        return activities;
-    }
-
-    public int countActivitiesByProvider( OrganisationUnit organisationUnit )
-    {
-        return activityPlanStore.countActivitiesByProvider( organisationUnit.getId() );
-    }
-
-    // -------------------------------------------------------------------------
-    // Supportive methods
-    // -------------------------------------------------------------------------
-
-    private Collection<Activity> getActivties( Collection<ProgramInstance> programInstances )
-    {
-        Collection<Activity> activities = new ArrayList<Activity>();
-
-        // ---------------------------------------------------------------------
-        // Get all stageInstances for the give programInstances
-        // ---------------------------------------------------------------------
-
-        Collection<ProgramStageInstance> programStageInstances = programStageInstanceService
-            .getProgramStageInstances( programInstances );
-
-        Map<String, ProgramStageInstance> mappedStageInstance = new HashMap<String, ProgramStageInstance>();
-
-        for ( ProgramStageInstance programStageInstance : programStageInstances )
-        {
-            mappedStageInstance.put( programStageInstance.getProgramInstance().getId() + "_"
-                + programStageInstance.getProgramStage().getId(), programStageInstance );
-
-        }
-
-        // -----------------------------------------------------------------
-        // Initially assume to have a first visit for all programInstances
-        // -----------------------------------------------------------------
-
-        Map<Integer, Integer> visitsByProgramInstances = new HashMap<Integer, Integer>();
-
-        for ( ProgramInstance programInstance : programInstances )
-        {
-            programStageInstances.addAll( programInstance.getProgramStageInstances() );
-
-            visitsByProgramInstances.put( programInstance.getId(), 0 );
-        }
-
-        // ---------------------------------------------------------------------
-        // For each of these active instances, see at which stage they are
-        // actually (may not necessarily be at the first stage)
-        // ---------------------------------------------------------------------
-
-        Collection<PatientDataValue> patientDataValues = patientDataValueService
-            .getPatientDataValues( programStageInstances );
-
-        for ( PatientDataValue patientDataValue : patientDataValues )
-        {
-            if ( visitsByProgramInstances.get( patientDataValue.getProgramStageInstance().getProgramInstance().getId() ) < patientDataValue
-                .getProgramStageInstance().getProgramStage().getStageInProgram() )
-            {
-                visitsByProgramInstances.put( patientDataValue.getProgramStageInstance().getProgramInstance().getId(),
-                    patientDataValue.getProgramStageInstance().getProgramStage().getStageInProgram() );
-            }
-        }
-
-        // ---------------------------------------------------------------------
-        // For each of these active instances, based on the current stage
-        // determine the next stage
-        // ---------------------------------------------------------------------
-
-        for ( ProgramInstance programInstance : programInstances )
-        {
-            Program program = programInstance.getProgram();
-
-            ProgramStage nextStage = program.getProgramStageByStage( visitsByProgramInstances.get( programInstance
-                .getId() ) + 1 );
-
-            if ( nextStage != null )
-            {
-
-                ProgramStageInstance nextStageInstance = mappedStageInstance.get( programInstance.getId() + "_"
-                    + nextStage.getId() );
-
-                Activity activity = new Activity();
-                activity.setBeneficiary( programInstance.getPatient() );
-                activity.setTask( nextStageInstance );
-
-                if ( nextStageInstance != null )
-                {
-                    activity.setDueDate( nextStageInstance.getDueDate() );
-                }
-
-                activities.add( activity );
-            }
-        }
-
-        return activities;
-    }
-
-}

=== removed directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc'
=== removed file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java	2012-07-26 08:53:44 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java	1970-01-01 00:00:00 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2004-2009, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.activityplan.jdbc;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.activityplan.ActivityPlanStore;
-import org.hisp.dhis.jdbc.StatementBuilder;
-import org.hisp.dhis.patient.startup.TableAlteror;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-
-/**
- * @author Chau Thu Tran
- * @version $ JdbcActivityPlanStore.java May 22, 2011 7:52:03 PM $
- * 
- */
-public class JdbcActivityPlanStore
-    implements ActivityPlanStore
-{
-    private static final Log log = LogFactory.getLog( TableAlteror.class );
-
-    // -------------------------------------------------------------------------
-    // Dependency
-    // -------------------------------------------------------------------------
-
-    private JdbcTemplate jdbcTemplate;
-
-    private StatementBuilder statementBuilder;
-
-    // -------------------------------------------------------------------------
-    // Setters
-    // -------------------------------------------------------------------------
-
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
-    public void setStatementBuilder( StatementBuilder statementBuilder )
-    {
-        this.statementBuilder = statementBuilder;
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation Methods
-    // -------------------------------------------------------------------------
-
-    @Override
-    public Collection<Integer> getActivitiesByProvider( Integer orgunitId, int min, int max )
-    {
-        try
-        {
-            String sql = "SELECT distinct psi.programstageinstanceid " + "FROM programstageinstance psi "
-                + "INNER JOIN programinstance pi " + "ON pi.programinstanceid = psi.programinstanceid "
-                + "INNER JOIN programstage ps " + "ON ps.programstageid=psi.programstageid "
-                + "INNER JOIN program_organisationunits po " + "ON po.programid=pi.programid "
-                + "INNER JOIN program pg " + "ON po.programid=pg.programid " + "WHERE pi.completed = FALSE  "
-                + "AND pg.type=1 " + "AND po.organisationunitid = " + orgunitId + " AND psi.completed = FALSE "
-                + "AND ps.stageinprogram in ( SELECT min(ps1.stageinprogram) " + "FROM programstageinstance psi1 "
-                + "INNER JOIN programinstance pi1 " + "ON pi1.programinstanceid = psi1.programinstanceid "
-                + "INNER JOIN programstage ps1 " + "ON ps1.programstageid=psi1.programstageid "
-                + "INNER JOIN program_organisationunits po1 " + "ON po1.programid=pi1.programid "
-                + "WHERE pi1.completed = FALSE  " + "AND po1.organisationunitid = " + orgunitId
-                + " AND psi1.completed = FALSE ) " + "ORDER BY ps.stageinprogram "
-                + statementBuilder.limitRecord( min, max );
-
-            Collection<Integer> programStageInstanceIds = jdbcTemplate.query( sql, new RowMapper<Integer>()
-            {
-                public Integer mapRow( ResultSet rs, int rowNum )
-                    throws SQLException
-                {
-                    return rs.getInt( 1 );
-                }
-            } );
-
-            return programStageInstanceIds;
-
-        }
-        catch ( Exception ex )
-        {
-            log.debug( ex );
-            return null;
-        }
-    }
-
-    @Override
-    public int countActivitiesByProvider( Integer orgunitId )
-    {
-        try
-        {
-            String sql = "SELECT count(distinct psi.programstageinstanceid) " + "FROM programstageinstance psi "
-                + "INNER JOIN programinstance pi " + "ON pi.programinstanceid = psi.programinstanceid "
-                + "INNER JOIN programstage ps " + "ON ps.programstageid=psi.programstageid "
-                + "INNER JOIN program_organisationunits po " + "ON po.programid=pi.programid "
-                + "INNER JOIN program pg " + "ON po.programid=pg.programid " + "WHERE pi.completed = FALSE  "
-                + "AND pg.type=1 " + "AND po.organisationunitid = " + orgunitId + " AND psi.completed = FALSE "
-                + "AND ps.stageinprogram in ( SELECT min(ps1.stageinprogram) " + "FROM programstageinstance psi1 "
-                + "INNER JOIN programinstance pi1 " + "ON pi1.programinstanceid = psi1.programinstanceid "
-                + "INNER JOIN programstage ps1 " + "ON ps1.programstageid=psi1.programstageid "
-                + "INNER JOIN program_organisationunits po1 " + "ON po1.programid=pi1.programid "
-                + "WHERE pi1.completed = FALSE  " + "AND po1.organisationunitid = " + orgunitId
-                + " AND psi1.completed = FALSE ) ";
-
-            return jdbcTemplate.queryForInt( sql );
-        }
-        catch ( Exception ex )
-        {
-            ex.printStackTrace();
-            return 0;
-        }
-    }
-
-}

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2012-09-11 13:35:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2012-09-14 02:43:21 +0000
@@ -14,12 +14,6 @@
 		<property name="jdbcTemplate" ref="jdbcTemplate" />
 	</bean>
 
-	<bean id="org.hisp.dhis.activityplan.jdbc.JdbcActivityPlanStore"
-		class="org.hisp.dhis.activityplan.jdbc.JdbcActivityPlanStore">
-		<property name="jdbcTemplate" ref="jdbcTemplate" />
-		<property name="statementBuilder" ref="statementBuilder" />
-	</bean>
-
 	<bean id="org.hisp.dhis.relationship.RelationshipStore"
 		class="org.hisp.dhis.relationship.hibernate.HibernateRelationshipStore">
 		<property name="clazz" value="org.hisp.dhis.relationship.Relationship" />
@@ -149,18 +143,7 @@
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
-
-	<bean id="org.hisp.dhis.activityplan.ActivityPlanService" class="org.hisp.dhis.activityplan.DefaultActivityPlanService">
-		<property name="patientDataValueService"
-			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-		<property name="programStageInstanceService"
-			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="activityPlanStore"
-			ref="org.hisp.dhis.activityplan.jdbc.JdbcActivityPlanStore" />
-	</bean>
-
+	
 	<bean id="org.hisp.dhis.caseaggregation.CaseAggregationConditionService"
 		class="org.hisp.dhis.caseaggregation.DefaultCaseAggregationConditionService">
 		<property name="aggregationConditionStore"