forked from Coded/SIPRP
no message
git-svn-id: https://svn.coded.pt/svn/SIPRP@288 bb69d46d-e84e-40c8-a05a-06db0d6337410'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
parent
7e1a032f4f
commit
9cc0f7d8b6
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* TipoLembrete.java
|
||||||
|
*
|
||||||
|
* Created on February 5, 2007, 6:28 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package siprp.lembretes;
|
||||||
|
|
||||||
|
import com.evolute.utils.data.IDObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lflores
|
||||||
|
*/
|
||||||
|
public class TipoLembrete
|
||||||
|
implements IDObject, Comparable
|
||||||
|
{
|
||||||
|
protected Integer id;
|
||||||
|
protected String codigo;
|
||||||
|
protected String descricao;
|
||||||
|
protected Integer ordem;
|
||||||
|
|
||||||
|
/** Creates a new instance of TipoLembrete */
|
||||||
|
public TipoLembrete( Integer id, String codigo, String descricao,
|
||||||
|
Integer ordem )
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
this.codigo = codigo;
|
||||||
|
this.descricao = descricao;
|
||||||
|
this.ordem = ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getID()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getCodigo()
|
||||||
|
{
|
||||||
|
return codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDescricao()
|
||||||
|
{
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Integer getOrdem()
|
||||||
|
{
|
||||||
|
return ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compareTo( Object other )
|
||||||
|
{
|
||||||
|
if( !( other instanceof TipoLembrete ) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
TipoLembrete otl = ( TipoLembrete ) other;
|
||||||
|
return getOrdem().compareTo( otl.getOrdem() );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* PresencasDataProvider.java
|
||||||
|
*
|
||||||
|
* Created on February 5, 2007, 5:51 PM
|
||||||
|
*
|
||||||
|
* To change this template, choose Tools | Template Manager
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package siprp.medicina.presencas;
|
||||||
|
|
||||||
|
import com.evolute.utils.Singleton;
|
||||||
|
import com.evolute.utils.db.DBManager;
|
||||||
|
import com.evolute.utils.db.Executer;
|
||||||
|
import com.evolute.utils.sql.Assignment;
|
||||||
|
import com.evolute.utils.sql.Field;
|
||||||
|
import com.evolute.utils.sql.Update;
|
||||||
|
import siprp.medicina.MedicinaConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lflores
|
||||||
|
*/
|
||||||
|
public class PresencasDataProvider
|
||||||
|
implements MedicinaConstants
|
||||||
|
{
|
||||||
|
private static final Object LOCK = new Object();
|
||||||
|
private static PresencasDataProvider instance = null;
|
||||||
|
|
||||||
|
private Executer EXECUTER;
|
||||||
|
|
||||||
|
/** Creates a new instance of PresencasDataProvider */
|
||||||
|
public PresencasDataProvider()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
|
||||||
|
EXECUTER = dbm.getSharedExecuter( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PresencasDataProvider getProvider()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
synchronized( LOCK )
|
||||||
|
{
|
||||||
|
if( instance == null )
|
||||||
|
{
|
||||||
|
instance = new PresencasDataProvider();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void marcarFaltou( Integer id )
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
Update update =
|
||||||
|
new Update( "marcacoes_trabalhador",
|
||||||
|
new Assignment[]{
|
||||||
|
},
|
||||||
|
new Field( "id" ).isEqual( id ) );
|
||||||
|
EXECUTER.executeQuery( update );
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue