Package KFramework30.Base

Examples of KFramework30.Base.KExceptionClass


  public boolean fetch()
  throws KExceptionClass
  {
    // check transition
    if( status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot execute DB query. The status is not FINISHED_QUERY.", null
      );
    }

                // check not beyon set
    if( fetchComplete ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "SQL fetch past indicated end of data.", null
      );
    }
               
                // last row, set end
                try {
                    if( !resultSet.next() ){                       
                        fetchComplete = true;
                        log.log( this, "No more rows..." + fetchCount );                       
                    }
                   
                fetchCount++;
                   
                }               
                catch( Exception err  ) {
           
                    String message = "**** Query error **** \n" +
                        "Cannot fetch next row.\n";
                    log.log( this, message + "Exception: " + err );
                    throw new KExceptionClass( message, err );
                }
               
                //true - fetch OK.
                return( !fetchComplete );               
        }  
View Full Code Here


        public String getField( String fieldName )
        throws KExceptionClass
        {
           
            if( fetchComplete ){
    throw new KExceptionClass(
                    "**** Query error **** \n" +
                    "SQL fetch past indicated end of data.", null );
            }
           
           
            String fieldValue = null;
            try {
                      
              if(
                      metaData.getColumnType( resultSet.findColumn(fieldName) ) == java.sql.Types.DECIMAL ||
                      metaData.getColumnType( resultSet.findColumn(fieldName) ) == java.sql.Types.DOUBLE ||
                      metaData.getColumnType( resultSet.findColumn(fieldName) ) == java.sql.Types.FLOAT  ||
                      metaData.getColumnType( resultSet.findColumn(fieldName) ) == java.sql.Types.NUMERIC
                      ){                                         
                 
                    // force internationalization, or will have issues
                    fieldValue = KMetaUtilsClass.toDecimalString( resultSet.getDouble(fieldName) );
                   
              }else{
                 
                    fieldValue = resultSet.getString( fieldName );                 
              }
                             
            }
            catch( Exception err  ) {
           
                String message = "**** Query error **** \n" +
                    "Cannot get field value for [" + fieldName + "].\n";
                log.log( this, message + "Exception: " + err );
                throw new KExceptionClass( message, err );
            }            
               
            return( fieldValue );
           
        }       
View Full Code Here

        public byte[] getBinaryField( String fieldName )
        throws KExceptionClass
        {
           
            if( fetchComplete ){
    throw new KExceptionClass(
                    "**** Query error **** \n" +
                    "SQL fetch past indicated end of data.", null );
            }
           
            byte[] result = null;
           
            try{
               
                Blob blob = resultSet.getBlob( fieldName );
               
                if( blob != null ){
                   
                    result = resultSet.getBlob( fieldName ).getBytes( 1L, (int) blob.length() ); // up tp 1 meg                   
                }
                               
                             
            }
            catch( Exception err  ) {
           
                String message = "**** Query error **** \n" +
                    "Cannot get field value for [" + fieldName + "].\n";
                log.log( this, message + "Exception: " + err );
                throw new KExceptionClass( message, err );
            }            
               
            return( result );
           
        }       
View Full Code Here

        {
           
            String fieldValue = "";
           
            if( fetchComplete ){
    throw new KExceptionClass(
                    "**** Query error **** \n" +
                    "SQL fetch past indicated end of data.", null );
            }
           
           
            try{
                    fieldValue = resultSet.getString( fieldName );                 

                             
            }catch( Exception err  ) {
           
                String message = "**** Query error **** \n" +
                    "Cannot get field value for [" + fieldName + "].\n";
                log.log( this, message + "Exception: " + err );
                throw new KExceptionClass( message, err );
            }            
               
            return( fieldValue );
           
        }         
View Full Code Here

        {
            log.log( this, "providing HTML table from DB transaction...");
           
            // check transition
            if( status != FINISHED_QUERY ){
    throw new KExceptionClass(
      "**** Query error **** \n" +
      "Cannot provide HTML table from DB transaction. The status is not FINISHED_QUERY.", null
    );
            }
           
            if( fetchComplete ){
    throw new KExceptionClass(
                    "**** Query error **** \n" +
                    "SQL fetch past indicated end of data.", null );
            }           
       
            StringBuffer buffer =
                new StringBuffer( "<TABLE BORDER=1>\n" );
           
            if( headingColor != null )
                buffer.append("    <TR BGCOLOR=\"" + headingColor + "\"> \n  " );
            else
                buffer.append("    <TR>\n  " );
           
            try {
               
                //get query results
                ResultSetMetaData  metaData = resultSet.getMetaData();
                   
                for( int col=1; col<=columnCount; col++ ) {
                    //get headers
                    String colName = metaData.getColumnName(col).trim();
                    buffer.append( "<TH>" + colName );
                }
                   
                //get rows
                while( resultSet.next() ) {
                    
                    buffer.append("\n    <TR>\n  " );
                    for( int col=1; col<=columnCount; col++ ) {
                        String cellData = resultSet.getString( col );
                        buffer.append("<TD>" + cellData );   
                    }                       
                }

            }
            catch( SQLException err  ) {
           
                String message = "Cannot provide HTML table.\n<br>" + err;
                log.log( this, message + "SQLException: " + err );
                throw new KExceptionClass( message, err );
            }                 
           
            buffer.append( "\n</TABLE>" );           
            fetchComplete = true;
           
View Full Code Here

                }
                                                                              
            } catch (Exception error ) {
               
                log.log( this, "Could not close SQL statement 1" + error );
                throw new KExceptionClass( "Could not close SQL statement 1" + error , error );
            }
        }
View Full Code Here

       
            log.log( this, "Prepareing statement to LOCK ");

            // check transition
            if( status != NOT_READY && status != FINISHED_QUERY ){
                    throw new KExceptionClass(
                            "**** Query error **** \n" +
                            "Call to prepare in a READY DB transaction.", null
                    );
            }
           
View Full Code Here

                adjustColumnWidth( "OK", 30 );           
               
              
               
                // STATUS COMBO
                dbTransactionClientClass query = new dbTransactionClientClass(configuration, log);
                query.prepare( " select FACSTATUS_STATUS from SAMPLE_FACTURA_STATUS " );
                query.executeQuery( 0 , 999 );                 
                Vector< String > options = new Vector< String >();
                while( query.fetch() ) options.add( (String )query.getField( "FACSTATUS_STATUS" ) );               
               
                setColumnEditor("STATUS", new ComboCellEditorClass( options,  tableModel, log, true ) );
                setColumnRenderer("STATUS", new ComboCellRendererClass( options, tableModel, log) );
                  
                // TOTAL
View Full Code Here

           
            try {           
           
                // load status
                Properties invoiceStatusProp = new Properties();
                dbTransactionClientClass query = new dbTransactionClientClass(configuration, log);
                query.prepare( " select FACSTATUS_ID, FACSTATUS_STATUS from SAMPLE_FACTURA_STATUS " );
                query.executeQuery(0, 999);
                while( query.fetch() ){
                    invoiceStatusProp.put( query.getField("FACSTATUS_STATUS"), query.getField("FACSTATUS_ID") );
                }
                                                   
                // for you to see
                Iterator dataRowChanged = data.iterator();
                while( dataRowChanged.hasNext() ){
View Full Code Here

           
            sample_clientClass client = new sample_clientClass();

            client.materializeFromDisplay( getContentPane(), KDialogController.getNonVisibleWidgets(), KBusinessObjectClass.DONOT_IGNORE_MISSING_FIELDS );

            persistentObjectManagerClass persistentObjectManager =
                    new persistentObjectManagerClass( configuration, log );                  

            sample_clientClass nuevoCliente =
                    (sample_clientClass) persistentObjectManager.execute4( "TEST", client, new HashMap() );
                       
            nuevoCliente.displayVisualize( getContentPane(), KDialogController.getNonVisibleWidgets(), KBusinessObjectClass.DONOT_IGNORE_MISSING_FIELDS  );
       
        } catch (KExceptionClass error ) {
           
View Full Code Here

TOP

Related Classes of KFramework30.Base.KExceptionClass

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.