← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21115: Program service, cleanup

 

------------------------------------------------------------
revno: 21115
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-18 17:51:45 +0100
message:
  Program service, cleanup
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.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/program/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2015-11-18 16:46:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2015-11-18 16:51:45 +0000
@@ -35,7 +35,6 @@
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.trackedentity.TrackedEntity;
-import org.hisp.dhis.validation.ValidationCriteria;
 
 /**
  * @author Abyot Asalefew
@@ -110,15 +109,6 @@
     List<Program> getPrograms( OrganisationUnit organisationUnit );
 
     /**
-     * Get {@link Program} included in the expression of a
-     * {@link ValidationCriteria}
-     *
-     * @param validationCriteria {@link ValidationCriteria}
-     * @return Program list
-     */
-    List<Program> getPrograms( ValidationCriteria validationCriteria );
-
-    /**
      * Get {@link Program} by a type
      *
      * @param type The type of program. There are three types, include Multi

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-11-18 16:46:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-11-18 16:51:45 +0000
@@ -30,7 +30,6 @@
 
 import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
@@ -43,7 +42,6 @@
 import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
-import org.hisp.dhis.validation.ValidationCriteria;
 import org.springframework.transaction.annotation.Transactional;
 import com.google.common.collect.Sets;
 
@@ -133,22 +131,6 @@
     }
 
     @Override
-    public List<Program> getPrograms( ValidationCriteria validationCriteria )
-    {
-        List<Program> programs = new ArrayList<>();
-
-        for ( Program program : getAllPrograms() )
-        {
-            if ( program.getValidationCriteria().contains( validationCriteria ) )
-            {
-                programs.add( program );
-            }
-        }
-
-        return i18n( i18nService, programs );
-    }
-
-    @Override
     public List<Program> getPrograms( ProgramType type )
     {
         return i18n( i18nService, programStore.getByType( type ) );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2015-11-18 16:51:45 +0000
@@ -68,12 +68,14 @@
     @Override
     public void deleteValidationCriteria( ValidationCriteria validationCriteria )
     {
-        Collection<Program> programs = programService.getPrograms( validationCriteria );
+        Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class );
 
         for ( Program program : programs )
         {
-            program.getValidationCriteria().remove( validationCriteria );
-            idObjectManager.updateNoAcl( program );
+            if ( program.getValidationCriteria().remove( validationCriteria ) )
+            {
+                idObjectManager.updateNoAcl( program );
+            }
         }
     }