forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
74 lines
2.2 KiB
package siprp.medicina.locais_analise;
|
|
|
|
import com.evolute.utils.Singleton;
|
|
import com.evolute.utils.arrays.Virtual2DArray;
|
|
import com.evolute.utils.data.IDObject;
|
|
import com.evolute.utils.data.MappableObject;
|
|
import com.evolute.utils.db.DBManager;
|
|
import com.evolute.utils.db.Executer;
|
|
import com.evolute.utils.sql.Expression;
|
|
import com.evolute.utils.sql.Field;
|
|
import com.evolute.utils.sql.Select;
|
|
import com.evolute.utils.sql.Select2;
|
|
|
|
public class LocaisAnaliseDataProvider
|
|
{
|
|
private static final Object LOCK = new Object();
|
|
private static LocaisAnaliseDataProvider instance = null;
|
|
|
|
private Executer EXECUTER;
|
|
|
|
/** Creates a new instance of LocaisRealizacaoDataProvider */
|
|
private LocaisAnaliseDataProvider()
|
|
throws Exception
|
|
{
|
|
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
|
|
EXECUTER = dbm.getSharedExecuter( this );
|
|
}
|
|
|
|
public static LocaisAnaliseDataProvider getProvider()
|
|
throws Exception
|
|
{
|
|
synchronized( LOCK )
|
|
{
|
|
if( instance == null )
|
|
{
|
|
instance = new LocaisAnaliseDataProvider();
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
protected IDObject[] getGruposEcdsIdsByMarcacoes( Integer marcacoesIds[] )
|
|
throws Exception
|
|
{
|
|
Select select =
|
|
new Select2(
|
|
new String[]{ "trabalhadores_ecd", "prt_tipos_elementos_protocolo",
|
|
"prt_grupos_protocolo"},
|
|
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
|
|
new Expression[]{
|
|
new Field( "trabalhadores_ecd.ecd_id" ).isEqual(
|
|
new Field( "prt_tipos_elementos_protocolo.id" ) ),
|
|
new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual(
|
|
new Field( "prt_grupos_protocolo.id" ) )
|
|
},
|
|
new String[]{ "DISTINCT prt_grupos_protocolo.id", "prt_grupos_protocolo.descricao",
|
|
"prt_grupos_protocolo.ordem" },
|
|
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).in( marcacoesIds ),
|
|
new String[]{ "prt_grupos_protocolo.ordem" },
|
|
null,
|
|
null,
|
|
null );
|
|
Virtual2DArray array = EXECUTER.executeQuery( select );
|
|
IDObject grupos[] = new IDObject[ array.columnLength() ];
|
|
for( int n = 0; n < grupos.length; n++ )
|
|
{
|
|
Integer id = ( Integer ) array.get( n, 0 );
|
|
String descricao = ( String ) array.get( n, 1 );
|
|
grupos[ n ] = new MappableObject( id, descricao );
|
|
}
|
|
return grupos;
|
|
}
|
|
}
|