← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14512: Removed option set code from TableAlteror

 

------------------------------------------------------------
revno: 14512
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-03-28 09:36:47 +0100
message:
  Removed option set code from TableAlteror
modified:
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.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/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-03-28 08:30:22 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-03-28 08:36:47 +0000
@@ -31,7 +31,6 @@
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -45,8 +44,6 @@
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.jdbc.StatementBuilder;
-import org.hisp.dhis.option.OptionService;
-import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
@@ -107,9 +104,6 @@
     @Autowired
     private StatementBuilder statementBuilder;
 
-    @Autowired
-    private OptionService optionService;
-
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -297,37 +291,12 @@
 
         executeSql( "ALTER TABLE trackedentityattribute DROP COLUMN groupBy" );
 
-        removeNullOptionSet();
-
     }
 
     // -------------------------------------------------------------------------
     // Supporting methods
     // -------------------------------------------------------------------------
 
-    private void removeNullOptionSet()
-    {
-        Collection<OptionSet> optionSets = optionService.getAllOptionSets();
-        for ( OptionSet optionSet : optionSets )
-        {
-            boolean flag = false;
-            Iterator<String> iterOption = optionSet.getOptions().iterator();
-            while ( iterOption.hasNext() )
-            {
-                if ( iterOption.next() == null )
-                {
-                    iterOption.remove();
-                    flag = true;
-                }
-            }
-            if ( flag )
-            {
-                optionService.updateOptionSet( optionSet );
-            }
-
-        }
-    }
-
     private void updateProgramAttributes()
     {
         String autoIncrVal = statementBuilder.getAutoIncrementValue();