package org.hisp.dhis.jdbc.batchhandler;



import org.amplecode.quick.JdbcConfiguration;
import org.amplecode.quick.batchhandler.AbstractBatchHandler;
import org.hisp.dhis.indicator.IndicatorType;

/**
 * @author Lars Helge Overland
 * @version $Id: IndicatorTypeBatchHandler.java 5062 2008-05-01 18:10:35Z larshelg $
 */
public class IndicatorTypeBatchHandler
    extends AbstractBatchHandler<IndicatorType>
{
    // -------------------------------------------------------------------------
    // Constructor
    // -------------------------------------------------------------------------
 
    public IndicatorTypeBatchHandler( JdbcConfiguration config )
    {
        super( config, false, false );
    }

    // -------------------------------------------------------------------------
    // AbstractBatchHandler implementation
    // -------------------------------------------------------------------------

    @Override
    protected void setTableName()
    {
        statementBuilder.setTableName( "indicatortype" );
    }

    @Override
    protected void setAutoIncrementColumn()
    {
        statementBuilder.setAutoIncrementColumn( "indicatortypeid" );
    }
    
    @Override
    protected void setIdentifierColumns()
    {
        statementBuilder.setIdentifierColumn( "indicatortypeid" );
    }

    @Override
    protected void setIdentifierValues( IndicatorType type )
    {        
        statementBuilder.setIdentifierValue( type.getId() );
    }
    
    @Override
    protected void setUniqueColumns()
    {
        statementBuilder.setUniqueColumn( "name" );
    }
    
    @Override
    protected void setUniqueValues( IndicatorType type )
    {        
        statementBuilder.setUniqueValue( type.getName() );
    }
    
    @Override
    protected void setColumns()
    {
        statementBuilder.setColumn( "uid" );
        statementBuilder.setColumn( "code" );
        statementBuilder.setColumn( "name" );
        statementBuilder.setColumn( "indicatorfactor" );
        statementBuilder.setColumn( "indicatornumber" );
    }
    
    @Override
    protected void setValues( IndicatorType type )
    {        
        statementBuilder.setValue( type.getUid() );
        statementBuilder.setValue( type.getCode() );
        statementBuilder.setValue( type.getName() );
        statementBuilder.setValue( type.getFactor() );
        statementBuilder.setValue( type.isNumber() );
        
    }
}
