|
|
|
|
@ -18,9 +18,9 @@ import com.evolute.utils.error.ErrorLogger;
|
|
|
|
|
import com.evolute.utils.sql.Expression;
|
|
|
|
|
import com.evolute.utils.sql.Field;
|
|
|
|
|
import com.evolute.utils.sql.Select2;
|
|
|
|
|
import com.evolute.utils.sql.expression.Par;
|
|
|
|
|
import com.evolute.utils.strings.StringPlainer;
|
|
|
|
|
import com.sun.rave.web.ui.model.Option;
|
|
|
|
|
import db.data.siprp.outer.EstabelecimentosData;
|
|
|
|
|
import db.data.siprp.outer.TiposUtilizadoresData;
|
|
|
|
|
import db.data.siprp.outer.UtilizadoresData;
|
|
|
|
|
import global.Global;
|
|
|
|
|
@ -259,34 +259,43 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
{
|
|
|
|
|
List< Utilizador > listUtilizadores = new LinkedList< Utilizador >();
|
|
|
|
|
|
|
|
|
|
por = por == null ? "" : por;
|
|
|
|
|
nome = nome == null ? "" : StringPlainer.convertString( nome.replaceAll( " ", "%" ) );
|
|
|
|
|
login = login == null ? "" : StringPlainer.convertString( login.replaceAll( " ", "%" ) );
|
|
|
|
|
// por = por == null ? "" : por;
|
|
|
|
|
nome = nome == null ? null : StringPlainer.convertString( nome.replaceAll( " ", "%" ) );
|
|
|
|
|
login = login == null ? null : StringPlainer.convertString( login.replaceAll( " ", "%" ) );
|
|
|
|
|
activo = activo == null ? "y" : activo;
|
|
|
|
|
dirRH = dirRH == null ? "n" : dirRH;
|
|
|
|
|
boolean isDirRH = "y".equals( dirRH );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Expression whereExpression = new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" );
|
|
|
|
|
whereExpression = whereExpression.and( new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( activo ) );
|
|
|
|
|
whereExpression = whereExpression.and( new Field( UtilizadoresData.TIPO_FULL ).isDifferent( Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP ) );
|
|
|
|
|
whereExpression = whereExpression.and( new Field( "plain( " + UtilizadoresData.NUMERO_MECANOGRAFICO_FULL + " )" ).isILike( "%" + por + "%" ) );
|
|
|
|
|
whereExpression = whereExpression.and( new Field( "plain( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" ) ).or(
|
|
|
|
|
new Field( "plain_utf8( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" )
|
|
|
|
|
);
|
|
|
|
|
whereExpression = whereExpression.and( new Field( "plain( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" ) ).or(
|
|
|
|
|
new Field( "plain_utf8( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" )
|
|
|
|
|
);
|
|
|
|
|
if ( por != null )
|
|
|
|
|
{
|
|
|
|
|
whereExpression = whereExpression.and( new Field( "plain( " + UtilizadoresData.NUMERO_MECANOGRAFICO_FULL + " )" ).isILike( "%" + por + "%" ) );
|
|
|
|
|
}
|
|
|
|
|
if ( nome != null )
|
|
|
|
|
{
|
|
|
|
|
Expression nomeExpression = new Field( "plain( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" ).or(
|
|
|
|
|
new Field( "plain_utf8( " + UtilizadoresData.NOME_FULL + " )" ).isILike( "%" + nome + "%" ) );
|
|
|
|
|
whereExpression = whereExpression.and( new Par( nomeExpression ) );
|
|
|
|
|
}
|
|
|
|
|
if ( login != null )
|
|
|
|
|
{
|
|
|
|
|
Expression loginExpression = new Field( "plain( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" ).or(
|
|
|
|
|
new Field( "plain_utf8( " + UtilizadoresData.LOGIN_FULL + " )" ).isILike( "%" + login + "%" ) );
|
|
|
|
|
whereExpression = whereExpression.and( new Par( loginExpression ) );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ( estabelecimentoID != null )
|
|
|
|
|
{
|
|
|
|
|
whereExpression = whereExpression.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Select2 query = new Select2(
|
|
|
|
|
new String[] { UtilizadoresData.TABLENAME, TiposUtilizadoresData.TABLENAME, EstabelecimentosData.TABLENAME },
|
|
|
|
|
new Integer[] { Select2.JOIN_INNER, Select2.JOIN_LEFT_OUTER },
|
|
|
|
|
new String[] { UtilizadoresData.TABLENAME, TiposUtilizadoresData.TABLENAME },
|
|
|
|
|
new Integer[] { Select2.JOIN_INNER },
|
|
|
|
|
new Expression[] {
|
|
|
|
|
new Field( UtilizadoresData.TIPO_FULL ).isEqual( new Field( TiposUtilizadoresData.TIPO_FULL ) ),
|
|
|
|
|
new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( new Field( EstabelecimentosData.ID_FULL ) )
|
|
|
|
|
new Field( UtilizadoresData.TIPO_FULL ).isEqual( new Field( TiposUtilizadoresData.TIPO_FULL ) )
|
|
|
|
|
},
|
|
|
|
|
new String[] {
|
|
|
|
|
UtilizadoresData.ID_FULL, UtilizadoresData.LOGIN_FULL, UtilizadoresData.PASSWORD_FULL, UtilizadoresData.EMAIL_FULL,
|
|
|
|
|
@ -296,15 +305,15 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
UtilizadoresData.ACTIVO_FULL, UtilizadoresData.RESPONSAVEL_LOJA_FULL, UtilizadoresData.NUMERO_MECANOGRAFICO_FULL,
|
|
|
|
|
UtilizadoresData.GESTOR_GERAL_FULL, UtilizadoresData.PRIMEIRO_LOGIN_FULL, UtilizadoresData.APAGADO_FULL,
|
|
|
|
|
UtilizadoresData.DATA_PASSWORD_FULL,
|
|
|
|
|
EstabelecimentosData.NOME_FULL, TiposUtilizadoresData.DESCRICAO_FULL
|
|
|
|
|
TiposUtilizadoresData.DESCRICAO_FULL
|
|
|
|
|
},
|
|
|
|
|
whereExpression,
|
|
|
|
|
new String[] { UtilizadoresData.NUMERO_MECANOGRAFICO_FULL, UtilizadoresData.TIPO_FULL, EstabelecimentosData.NOME_FULL },
|
|
|
|
|
new String[] { UtilizadoresData.NUMERO_MECANOGRAFICO_FULL, UtilizadoresData.TIPO_FULL },
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println( "\nUtilizadores SQL : " + query.toString() );
|
|
|
|
|
Virtual2DArray array = getExecuter().executeQuery( query );
|
|
|
|
|
if ( array != null )
|
|
|
|
|
@ -332,8 +341,17 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
String apagado = array.get( i, 18 );
|
|
|
|
|
Date dataPassword = array.get( i, 19 );
|
|
|
|
|
java.sql.Date sqlDataPassword = dataPassword == null ? null : new java.sql.Date( dataPassword.getTime() );
|
|
|
|
|
String nomeEstabelecimento = array.get( i, 20 );
|
|
|
|
|
String categoria = array.get( i, 21 );
|
|
|
|
|
String categoria = array.get( i, 20 );
|
|
|
|
|
|
|
|
|
|
String nomeEstabelecimento = "";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
nomeEstabelecimento = AnalisesDataProvider.getInstance().getEstabelecimentoNome( estabelecimento_ID );
|
|
|
|
|
}
|
|
|
|
|
catch ( Exception e )
|
|
|
|
|
{
|
|
|
|
|
ErrorLogger.logException( e );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utilizador u = new Utilizador();
|
|
|
|
|
u.setId( userID );
|
|
|
|
|
@ -347,7 +365,7 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
u.setTipo( tipoTIPO );
|
|
|
|
|
u.setNumero_cedula( numeroCedula );
|
|
|
|
|
u.setCap( cap );
|
|
|
|
|
u.setNome( Utils.unicodeToHTML( nomeUtilizador ) );
|
|
|
|
|
u.setNome( Utils.htmlToText( Utils.unicodeToHTML( nomeUtilizador ) ) );
|
|
|
|
|
u.setMedico_id( medicoID );
|
|
|
|
|
u.setFuncionario_hst_id( funcionarioHSTID );
|
|
|
|
|
u.setActivo( activoUtilizador );
|
|
|
|
|
@ -356,7 +374,7 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
u.setNumero_mecanografico( numeroMecanografico );
|
|
|
|
|
u.setCategoria( categoria );
|
|
|
|
|
u.setApagado( apagado );
|
|
|
|
|
u.setNome_estabelecimento( nomeEstabelecimento );
|
|
|
|
|
u.setNome_estabelecimento( Utils.htmlToText( Utils.unicodeToHTML( nomeEstabelecimento ) ) );
|
|
|
|
|
|
|
|
|
|
listUtilizadores.add( u );
|
|
|
|
|
}
|
|
|
|
|
@ -508,6 +526,7 @@ public class UtilizadoresDataProvider extends GenericDataProvider
|
|
|
|
|
// {
|
|
|
|
|
// ErrorLogger.logException( e );
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if ( booDirRh.matches( "y" ) )
|
|
|
|
|
// {
|
|
|
|
|
// int uType = u.getTipo().intValue();
|
|
|
|
|
|