/* * LembretesDataProvider.java * * Created on February 5, 2007, 6:09 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package siprp.lembretes; import com.evolute.utils.Singleton; import com.evolute.utils.arrays.Virtual2DArray; import com.evolute.utils.db.DBManager; import com.evolute.utils.db.Executer; import com.evolute.utils.sql.Field; import com.evolute.utils.sql.Select; import java.util.Date; /** * * @author lflores */ public class LembretesDataProvider { private static final Object LOCK = new Object(); private static LembretesDataProvider instance = null; private Executer EXECUTER; /** Creates a new instance of LembretesDataProvider */ public LembretesDataProvider() throws Exception { DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); EXECUTER = dbm.getSharedExecuter( this ); } public static LembretesDataProvider getProvider() throws Exception { synchronized( LOCK ) { if( instance == null ) { instance = new LembretesDataProvider(); } } return instance; } public TipoLembrete[] getTiposLembrete() throws Exception { Select select = new Select( new String[]{ "lembretes_tipos" }, new String[]{ "id", "codigo", "descricao", "ordem" }, new Field( "activo" ).isEqual( "y" ), new String[]{ "ordem" }, null ); Virtual2DArray array = EXECUTER.executeQuery( select ); TipoLembrete tipos[] = new TipoLembrete[ array.columnLength() ]; for( int n = 0; n < tipos.length; n++ ) { Integer id = ( Integer ) array.get( n, 0 ); String codigo = ( String ) array.get( n, 1 ); String descricao = ( String ) array.get( n, 2 ); Integer ordem = ( Integer ) array.get( n, 3 ); tipos[ n ] = new TipoLembrete( id, codigo, descricao, ordem ); } return tipos; } public void criarLembretes( Integer tipoID, Date data, String descricao, String texto, Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID, Integer marcacaoEstabelecimentoID, Integer marcacaoTrabalhadorID, boolean enviarEmail, Integer periodicidadeDias, Integer periodicidade_meses ) throws Exception { } }