Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. package com.todobom.sped.efd.activator;
  2.  
  3. import java.net.URL;
  4.  
  5. import org.adempiere.exceptions.AdempiereException;
  6. import org.adempiere.plugin.utils.Incremental2PackActivator;
  7. import org.apache.commons.io.IOUtils;
  8. import org.compiere.util.DB;
  9.  
  10. public class InstallViewsActivator extends Incremental2PackActivator {
  11.  
  12.     boolean packedIn = false;
  13.    
  14.     public InstallViewsActivator() {
  15.         super();
  16.     }
  17.  
  18.     @Override
  19.     protected void packIn(String trxName, URL packout) {
  20.         super.packIn(trxName, packout);
  21.         packedIn = true;
  22.     }
  23.  
  24.    
  25.    
  26.     @Override
  27.     protected void packIn(String trxName, String installedVersionPart,
  28.             String bundleVersionPart) {
  29.         super.packIn(trxName, installedVersionPart, bundleVersionPart);
  30.  
  31.         if ( packedIn && DB.isPostgreSQL() ) {
  32.            
  33.             String iltax;
  34.  
  35.             try {
  36.                 iltax = IOUtils.toString ( getClass().getClassLoader().getResource("sql/postgres/views/lbr_factfiscal_invoicelinetax.sql") );
  37.            
  38.                 DB.executeUpdate( "DROP VIEW IF EXISTS LBR_FactFiscal_InvoiceLineTax;" , false , trxName );
  39.                 DB.executeUpdate( iltax , false , trxName );
  40.             } catch (Exception e) {
  41.                 // TODO Auto-generated catch block
  42.                 e.printStackTrace();
  43.                 throw new AdempiereException("erro ao executar scripts");
  44.             }
  45.  
  46.         }
  47.  
  48.     }
  49.  
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement