=== removed file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/startup/DataElementCategoryOptionComboStartupRoutine.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/startup/DataElementCategoryOptionComboStartupRoutine.java 2009-06-10 22:25:07 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/startup/DataElementCategoryOptionComboStartupRoutine.java 1970-01-01 00:00:00 +0000 @@ -1,137 +0,0 @@ -package org.hisp.dhis.datamart.startup; - -/* - * Copyright (c) 2004-2007, 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.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.dataelement.DataElementCategoryCombo; -import org.hisp.dhis.dataelement.DataElementCategoryComboService; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService; -import org.hisp.dhis.system.startup.AbstractStartupRoutine; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class DataElementCategoryOptionComboStartupRoutine - extends AbstractStartupRoutine -{ - private static final Log log = LogFactory.getLog( DataElementCategoryOptionComboStartupRoutine.class ); - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private JdbcTemplate jdbcTemplate; - - public void setJdbcTemplate( JdbcTemplate jdbcTemplate ) - { - this.jdbcTemplate = jdbcTemplate; - } - - private DataElementCategoryOptionComboService categoryOptionComboService; - - public void setCategoryOptionComboService( DataElementCategoryOptionComboService categoryOptionComboService ) - { - this.categoryOptionComboService = categoryOptionComboService; - } - - private DataElementCategoryComboService categoryComboService; - - public void setCategoryComboService( DataElementCategoryComboService categoryComboService ) - { - this.categoryComboService = categoryComboService; - } - - // ------------------------------------------------------------------------- - // AbstractStartupRoutine implementation - // ------------------------------------------------------------------------- - - @Transactional - public void execute() - throws Exception - { - - List combos = new ArrayList(); - - for ( DataElementCategoryOptionCombo combo : categoryOptionComboService.getAllDataElementCategoryOptionCombos() ) - { - DataElementCategoryOptionCombo duplicate = combo.get( combos ); - - if ( duplicate != null ) - { - final DataElementCategoryOptionCombo combo1 = combo; - final DataElementCategoryOptionCombo combo2 = duplicate; - - duplicate = combo1.getId() > combo2.getId() ? combo1 : combo2; - combo = combo1.getId() < combo2.getId() ? combo1 : combo2; - - log.warn( "Categoryoptioncombo id='" + combo.getId() + "' duplicate id='" + duplicate.getId() + "'" ); - - try - { - String sql = "update datavalue set categoryoptioncomboid=" + combo.getId() + " where categoryoptioncomboid=" + duplicate.getId(); - - int result = jdbcTemplate.update( sql ); - - log.info( "Moved " + result + " datavalues from duplicate to existing categoryoptioncombo" ); - } - catch ( Exception ex ) // Moving values resulted in duplicate datavalues - { - String sql = "delete from datavalue where categoryoptioncomboid=" + duplicate.getId(); - - int result = jdbcTemplate.update( sql ); - - log.info( "Deleted " + result + " datavalues registered for duplicate categoryoptioncombo" ); - } - - DataElementCategoryCombo categoryCombo = duplicate.getCategoryCombo(); - - categoryCombo.getOptionCombos().remove( duplicate ); - - categoryComboService.updateDataElementCategoryCombo( categoryCombo ); - - categoryOptionComboService.deleteDataElementCategoryOptionCombo( duplicate ); - - log.info( "Deleted duplicate categoryoptioncombo" ); - } - else - { - combos.add( combo ); - } - } - - log.info( "Verified CategoryOptionCombos" ); - } -} === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2009-07-07 10:27:18 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2009-10-14 14:15:43 +0000 @@ -238,17 +238,7 @@ - - - - - - - - + @@ -256,7 +246,6 @@ - === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2009-10-14 08:15:42 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2009-10-14 14:15:43 +0000 @@ -603,8 +603,6 @@ DataElement dataElement = dataElementMap.get( dataElementId ); //dataElementService.getDataElement( dataElementId ); - System.out.println("The dataset is: " + dataSet.getId() + " and the data element: " + dataElementId ); - // ------------------------------------------------------------- // Find type of data element // -------------------------------------------------------------