Package mydatagenerator.model.bean

Examples of mydatagenerator.model.bean.TableInfoPartialExportBean


                   
                    for(int i=0;i<fullTableList.size();i++)
                    {
                      if(fullTableList.get(i).isIncludeTable())
                      {                       
                       TableInfoPartialExportBean tableInfoPartialExport = new TableInfoPartialExportBean();
                       tableInfoPartialExport.setTableName(fullTableList.get(i).getTableName());
                       tableInfoPartialExport.setExportQuery(fullTableList.get(i).getExportQuery());
                      
                       filteredTableToExport.add(tableInfoPartialExport);                     
                      }
                    }         
                    //-------------
                  
                   //The exporting operation can be a long task: open a separate Thread           
             Thread partialExportDatabaseThread = new Thread() {
                               
              public void run() {                                
                   
                  try{                                
                      // Export the DB content as DBunit dataset
                      DatabaseExporter databaseExporter = new DatabaseExporter();  
                      databaseExporter.partialExport(destinationFolder, filteredTableToExport)
                    
                      // stop and hide the animation
                      busyLabelPanel.getJxBusyLabel().setBusy(false);
                      busyLabelPanel.getJxBusyLabel().setVisible(false);
                                     
                      operationResultLabel.setText("Operation Executed Successfully");
                      operationResultLabel.setFont(new Font("Serif", Font.BOLD, 15));
                      operationResultLabel.setForeground(Color.GREEN);
                              
                     }catch (Exception ex) {
                      
                      if(Log4jManager.IS_LOGGING_CONFIGURED)          
                        logger.fatal("Error executing the partial DB export, cause: ",ex)
                      
                  // stop and hide the animation
                  busyLabelPanel.getJxBusyLabel().setBusy(false);
                     busyLabelPanel.getJxBusyLabel().setVisible(false)
                    
                     operationResultLabel.setText("Error during the export operation: "+ex.getMessage());
                     operationResultLabel.setFont(new Font("Serif", Font.BOLD, 15));
                     operationResultLabel.setForeground(Color.RED);                    
                     }
                       }
             };
                           
          partialExportDatabaseThread.start();
          }
        }
     
      /**
       * Choose the destination folder for DB export
       */
      if (e.getActionCommand().equals("Choose"))
        {       
        destinationFolderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        destinationFolderChooser.setFileFilter(new FolderFileFilter());
        destinationFolderChooser.setDialogTitle("Choose a Destination Folder");           
               
              int value = destinationFolderChooser.showOpenDialog(this);
              
              // Return value if approved (ie yes, ok) is chosen.
              if (value == JFileChooser.APPROVE_OPTION)
              {
                 // The file name is equal at the DB name to export
                 File  destinationFolder = destinationFolderChooser.getSelectedFile();               
                 String  pathDestinationFolder = destinationFolder.getAbsolutePath();
                   //set the file path in the textField
                 this.exportFolderValue.setText(pathDestinationFolder);
            }
        } 
       
        /* The event intercepted by the sub-panel (ie PartialExportPanel) and forwarded at this listener */
        if (e.getActionCommand().equals("Load Tables"))
        {
          final PartialExportTableModel tableModel = (PartialExportTableModel)this.getPartialDatabaseExportPanel().getTableSelectionGrid().getModel();
         
          tableModel.setRowList(new ArrayList<TableInfoPartialExportBean>());
          //initialize the table model with an empty list of data
          tableModel.fireTableDataChanged();
         
          adjustTableWidth();
         
          final PartialExportPanel partialExpPanel = this.getPartialDatabaseExportPanel();
        
          if (!busyLabelPanel.getJxBusyLabel().isEnabled())
             {
                busyLabelPanel.getJxBusyLabel().setEnabled(true);              
             }
            
             if (busyLabelPanel.getJxBusyLabel().isBusy()) {     //true if task is finished        
                 busyLabelPanel.getJxBusyLabel().setBusy(false);
                 busyLabelPanel.getJxBusyLabel().setVisible(false);               
               
             }else{               
                 busyLabelPanel.getJxBusyLabel().setBusy(true);
                 busyLabelPanel.getJxBusyLabel().setVisible(true);
                
                 // Loading the ordered table name list can take some time: create a dedicated Thread to perform it                 
            Thread cleanDatabaseThread = new Thread() {
                             
             public void run() {                              
                 
                 try {                              
                     DatabaseTableUtils databaseTableUtils = new DatabaseTableUtils();
                     List<String> tableNames = databaseTableUtils.getTableNamesOrdered();                    
                    
                     List<TableInfoPartialExportBean> tableInfoPartialExporterList = new ArrayList<TableInfoPartialExportBean>();
                    
                     for(int i=0; i<tableNames.size(); i++)
                     {                    
                        TableInfoPartialExportBean tableInfo = new TableInfoPartialExportBean()
                        tableInfo.setExportQuery("select * from "+tableNames.get(i)); //the default query to export full content
                        tableInfo.setIncludeTable(false);
                        tableInfo.setTableName(tableNames.get(i));
                      
                        tableInfoPartialExporterList.add(tableInfo);                      
                     }
                    
                     tableModel.setRowList(tableInfoPartialExporterList);
View Full Code Here

TOP

Related Classes of mydatagenerator.model.bean.TableInfoPartialExportBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.