forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@835 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
6def0acfc5
commit
0782940ef5
@ -0,0 +1,17 @@
|
||||
package siprp.planoactuacao.db;
|
||||
|
||||
import com.evolute.utils.sql.SQLQuery;
|
||||
import com.evolute.utils.sql.Update;
|
||||
|
||||
public interface DBConstants
|
||||
{
|
||||
public static final String WEB_URL = "jdbc:postgresql://localhost:5436/siprp";
|
||||
public static final String WEB_USER = "postgres";
|
||||
public static final String WEB_PASSWORD = "Typein";
|
||||
|
||||
public static final String LOCAL_URL = "jdbc:postgresql://localhost:5436/siprp_local";
|
||||
public static final String LOCAL_USER = "postgres";
|
||||
public static final String LOCAL_PASSWORD = "Typein";
|
||||
|
||||
public static final SQLQuery INIT[] = new SQLQuery[]{};
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package siprp.planoactuacao.db;
|
||||
|
||||
import siprp.planoactuacao.SingletonConstants;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.JDBCManager;
|
||||
import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever;
|
||||
import com.evolute.utils.sql.Insert;
|
||||
import com.evolute.utils.strings.UnicodeChecker;
|
||||
|
||||
public class PlanoActuacaoDBInit
|
||||
{
|
||||
public static void initDB( String username, String password )
|
||||
throws Exception
|
||||
{
|
||||
DBManager webManager = new JDBCManager( DBConstants.WEB_URL,
|
||||
DBConstants.WEB_USER, DBConstants.WEB_PASSWORD , 10, 8, 8,
|
||||
DBConstants.INIT );
|
||||
DBManager localManager = new JDBCManager( DBConstants.LOCAL_URL,
|
||||
DBConstants.LOCAL_USER, DBConstants.LOCAL_PASSWORD , 10, 8, 8,
|
||||
DBConstants.INIT );
|
||||
Singleton.setInstance( SingletonConstants.WEB_DBMANAGER, webManager );
|
||||
Singleton.setInstance( SingletonConstants.LOCAL_DBMANAGER, localManager );
|
||||
Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER );
|
||||
UnicodeChecker.setUseDoubleSlash( true );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package siprp.planoactuacao.print;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
public class DadosImpressao
|
||||
{
|
||||
protected Integer idPlano;
|
||||
protected Integer idEmpresa;
|
||||
protected String designacaoEmpresa;
|
||||
protected String logotipoEmpresa;
|
||||
protected Integer idEstabelecimento;
|
||||
protected String designacaoEstabelecimento;
|
||||
protected Date data;
|
||||
protected Date dataHS;
|
||||
protected Vector<String> legislacaoAplicavel;
|
||||
protected Vector<String> areas;
|
||||
protected Vector<Vector<String>> riscos;
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package siprp.planoactuacao.print;
|
||||
|
||||
import siprp.planoactuacao.SingletonConstants;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.Executer;
|
||||
|
||||
|
||||
public class PlanoActuacaoPrintDataProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static PlanoActuacaoPrintDataProvider instance = null;
|
||||
|
||||
protected final Executer WEB_EXECUTER;
|
||||
protected final Executer LOCAL_EXECUTER;
|
||||
|
||||
public PlanoActuacaoPrintDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager WEB_DBMANAGER = ( DBManager ) Singleton.getInstance( SingletonConstants.WEB_DBMANAGER );
|
||||
WEB_EXECUTER = WEB_DBMANAGER.getSharedExecuter( this );
|
||||
DBManager LOCAL_DBMANAGER = ( DBManager ) Singleton.getInstance( SingletonConstants.LOCAL_DBMANAGER );
|
||||
LOCAL_EXECUTER = LOCAL_DBMANAGER.getSharedExecuter( this );
|
||||
}
|
||||
|
||||
public static PlanoActuacaoPrintDataProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new PlanoActuacaoPrintDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue