Package KFramework30.Base

Examples of KFramework30.Base.KExceptionClass


    @Override
    public void materializeFromDisplay(Container visualDisplay, List extraList, int missingFieldsBehavior) throws KExceptionClass {
               
        super.materializeFromDisplay(visualDisplay, extraList, missingFieldsBehavior);
       
        if( prodCost <= 0 ) throw new KExceptionClass( "Product Cost must be assigned", null);
    }   
View Full Code Here


    @Override
    public void materializeFromDisplay(Container visualDisplay, List extraList, int missingFieldsBehavior) throws KExceptionClass {
                      
        super.materializeFromDisplay(visualDisplay, extraList, missingFieldsBehavior);
       
        if( itemQuantity <= 0 ) throw new KExceptionClass("Product Quantity must be assigned", null);               
               
    }
View Full Code Here

                log.log( this, "Prepareing statement [" + SQLstring + "]");
               
    // check transition
    if( status != NOT_READY && status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Call to prepare in a READY DB transaction.", null
      );
    }

    // set the SQL command
    SQL = SQLstring;                
               
                try {
                   
                    SQLStatement = sessionTransaction.createSQLStatement( SQL );
                }
                catch( Exception err  ) {
           
                    String message = "Cannot prepare SQL statment.\n<br>" + err;
                    log.log( this, message + "Exception: " + err );
                    throw new KExceptionClass( message, err );
                }
               
                columnCount = -1;
                fetchComplete = true;
                status = READY;
View Full Code Here

  public void bind( int paramIndex, Object parameterValue )
  throws KExceptionClass

    // check transition
    if( status != READY && status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot bind DB transaction. Transaction not READY or FINISHED_QUERY.", null
      );
    }                

    // for the record
    {
      String message = new String();
      message = " Binding parameter ";
      message += paramIndex;
      message += " with [";
      message += parameterValue;
      message += "]";
      log.log( this, message );
    }

                try {
                    if( parameterValue instanceof Short )
                        SQLStatement.setShort( paramIndex, ((Short)parameterValue).shortValue() );
                    else if( parameterValue instanceof Integer )
                        SQLStatement.setInt( paramIndex, ((Integer)parameterValue).intValue() )
                    else if( parameterValue instanceof Long )
                        SQLStatement.setLong( paramIndex, ((Long)parameterValue).longValue() );
                    else if( parameterValue instanceof Float )
                        SQLStatement.setFloat( paramIndex, ((Float)parameterValue).floatValue() );                      
                    else if( parameterValue instanceof Double )
                        SQLStatement.setDouble( paramIndex, ((Double)parameterValue).doubleValue() );  
                    else if( parameterValue instanceof String )
                        SQLStatement.setString( paramIndex, (String)parameterValue );  
                    else if( parameterValue instanceof java.sql.Date )
                        SQLStatement.setDate( paramIndex, (java.sql.Date)parameterValue );  
                    else if( parameterValue instanceof java.sql.Time )
                        SQLStatement.setTime( paramIndex, (java.sql.Time)parameterValue )
                    else if( parameterValue instanceof java.sql.Timestamp )
                        SQLStatement.setTimestamp( paramIndex, (java.sql.Timestamp)parameterValue );                       
                    else
                        throw new KExceptionClass( "**** Query error **** \n" +
                            "Invalid parameter " + paramIndex + " binding with [" + parameterValue + "]", null  );                      

                }
                catch( Exception err  ) {
           
                    String message = "**** Query error **** \n" +
                        "Cannot bind parameter" + paramIndex + " with [" + parameterValue + "].\n";
                    log.log( this, message + "Exception: " + err );
                    throw new KExceptionClass( message, err );
                }
               
                fetchComplete = true;
               
  }
View Full Code Here

               
                fetchCount = 0;
               
    // check transition
    if( status != READY && status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot execute DB query. The status is not READY or FINISHED_QUERY.", null
      );
    }

                try{
                    resultSet = SQLStatement.executeQuery();
                   
                    //get query results
                    metaData = resultSet.getMetaData();                   
                    columnCount = metaData.getColumnCount();                                                                            
                   
                }
                catch( Exception err  ) {
           
                    String message = "Cannot execute query.\n<br>" + err;
                    log.log( this, message + "Exception: " + err );
                    throw new KExceptionClass( message, err );
                }
                              
                status = FINISHED_QUERY;
                fetchComplete = false;
               
View Full Code Here

  {
                log.log( this, "Executing modify...");
               
    // check transition
    if( status != READY && status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot execute DB query. The status is not READY or FINISHED_QUERY.", null
      );
    }

                try{
                   
                    SQLStatement.execute();
                                                                                                                  
                }
                catch( Exception err  ) {
           
                    String message = "Cannot execute modify.\n<br>" + err;
                    log.log( this, message + "Exception: " + err );
                    throw new KExceptionClass( message, err );
                }
                              
                status = FINISHED_QUERY;
                fetchComplete = true;
               
View Full Code Here

  public int columnCount()
  throws KExceptionClass
  {
    // check transition
    if( status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot count columns in DB transaction. The status is not FINISHED_QUERY.", null
      );
    }

View Full Code Here

  public ResultSetMetaData getMetaData()
  throws KExceptionClass
  {
    // check transition
    if( status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot read metadata. The status is not FINISHED_QUERY." , null
      );
    }

View Full Code Here

  public ResultSet getResultSet()
  throws KExceptionClass
  {
    // check transition
    if( status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot read metadata. The status is not FINISHED_QUERY." , null
      );
    }

View Full Code Here

   public String[] getColumnNames()
  throws KExceptionClass
  {
    // check transition
    if( status != FINISHED_QUERY ){
      throw new KExceptionClass(
        "**** Query error **** \n" +
        "Cannot return column names in DB transaction. The status is not FINISHED_QUERY.", null
      );
   
               
                String[] columnNames = new String[ columnCount ];
                try{                                   
                   
                    //column index starts at 1
                    for( int i=1; i<=columnCount; i++ ) {
                        columnNames[i-1] =
                            metaData.getColumnName(i).trim();                                       
                    }
                   
                }
                catch( Exception err  ) {
           
                    String message = "**** Query error **** \n<br>" + err;
                    log.log( this, message + "\nException: " + err );
                    throw new KExceptionClass( message, err );
                }                
                   
               return columnNames;
        }
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.