|  |  | @ -1,6 +1,6 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package siprp.planoactuacao.db; |  |  |  | package siprp.planoactuacao.db; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.planoactuacao.SingletonConstants; |  |  |  | import siprp.SingletonConstants; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.evolute.utils.Singleton; |  |  |  | import com.evolute.utils.Singleton; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.evolute.utils.db.DBManager; |  |  |  | import com.evolute.utils.db.DBManager; | 
			
		
	
	
		
		
			
				
					|  |  | @ -11,17 +11,35 @@ import com.evolute.utils.strings.UnicodeChecker; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | public class PlanoActuacaoDBInit |  |  |  | public class PlanoActuacaoDBInit | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public static void initDB() |  |  |  | 	public static void initDB( boolean web ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		throws Exception |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		DBManager webManager = new JDBCManager( DBConstants.WEB_URL, |  |  |  | 		if( web ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				DBConstants.WEB_USER, DBConstants.WEB_PASSWORD , 10, 8, 8,  |  |  |  | 		{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				DBConstants.INIT ); |  |  |  | 			String url = DBConstants.WEB_URL; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		DBManager localManager = new JDBCManager( DBConstants.LOCAL_URL, |  |  |  | 			String user = DBConstants.WEB_USER; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				DBConstants.LOCAL_USER, DBConstants.LOCAL_PASSWORD , 10, 8, 8,  |  |  |  | 			String pwd = DBConstants.WEB_PASSWORD; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				DBConstants.INIT ); |  |  |  | 			DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Singleton.setInstance( SingletonConstants.WEB_DBMANAGER, webManager ); |  |  |  | 			Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Singleton.setInstance( SingletonConstants.LOCAL_DBMANAGER, localManager ); |  |  |  | 			 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			url = DBConstants.LOCAL_URL; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			user = DBConstants.LOCAL_USER; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			pwd = DBConstants.LOCAL_PASSWORD; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			DBManager localManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, localManager ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); |  |  |  | 		Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		UnicodeChecker.setUseDoubleSlash( true ); |  |  |  | 		UnicodeChecker.setUseDoubleSlash( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
	
		
		
			
				
					|  |  | 
 |