Package com.eforce.baby.common.dao

Examples of com.eforce.baby.common.dao.DAOException


            }
           
        }
        catch(SQLException se)
        {
            throw new DAOException(se.getMessage());
        }
        finally
        {
            super.cleanUp(rset, stmt);
            super.releaseConnection(con);
View Full Code Here


   
        }
        catch(SQLException se)
        {
      log.error("ERROR: ", se);
            throw new DAOException();
        }
        finally
        {
            super.cleanUp(rset, stmt);
            super.releaseConnection(con);
View Full Code Here

      pStmt.setString( 1, roleVO.getRoleName() );
      rset = null;
      rset = pStmt.executeQuery();
      if( rset.next() ){
        if(rset.getInt(1)>0){
          DAOException daox = new DAOException ("Database Error");
          daox.setMessageKey(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
          throw daox;
        }
      }

      sql = qManager.getFetchNewRoleIdQuery(dbType);
      log.debug(sql);
      roleVO.setId(this.getCurrentSequenceValue(con,sql));
      sql = qManager.getFetchNewRoleQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, roleVO.getId() );
      pStmt.setString( 2, roleVO.getRoleName());
      pStmt.setString( 3, roleVO.getRoleDesc());
      log.debug("ID="+roleVO.getId());
      pStmt.executeUpdate();
     
      this.createSearchContent(con, dbType, roleVO, "TBL_ROLE", "ROLE_ID" ) ;
     
      log.debug("Role Info incerted ");
     
      String[] groupIds = EEMSUtil.convertToArray(roleVO.getGroupNames(),IConstants.EEMS_DELIMITER);
      if(groupIds!=null)
      {
        sql = qManager.getFetchRoleGroupQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);
 
        for (int i=0; i<groupIds.length;i++)
        {
          if(groupIds[i]!= null)
          {
           
            log.debug("GROUPSID " + groupIds[i]);
            log.debug("role id "+roleVO.getId());
            pStmt.setString( 1, groupIds[i].trim() );
            pStmt.setString( 2, roleVO.getId() );
            pStmt.executeUpdate();
            log.debug("ROLE-GROUP added" + i);
          }
        }
 
      } 

      /* Privilege */
      String[] privilegeIds = EEMSUtil.convertToArray(roleVO.getPrivilegeNames(),IConstants.EEMS_DELIMITER);
      if(groupIds!=null)
      {
        sql = qManager.getRolePrivilegeQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);
 
        for (int i=0; i<privilegeIds.length;i++)
        {
          if(privilegeIds[i]!= null)
          {
           
            log.debug("privilegeID " + privilegeIds[i]);
            log.debug("role id "+roleVO.getId());
            pStmt.setString( 1, roleVO.getId() );
            pStmt.setString( 2, privilegeIds[i].trim() );
            pStmt.executeUpdate();
            log.debug("ROLE-privilege added" + i);
          }
        }
 
      } 

      /* Privilege */       
       
      log.debug("inserted...and returning");
      con.commit();
    }
    catch(SQLException ex)
    {   ex.printStackTrace();
      try
      {
        con.rollback();
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
   
    }
    finally
    {
      try
      {
                super.cleanUp(rset, pStmt);
        this.releaseConnection(con);
      }
      catch (DAOException e)
      {
        // TODO Auto-generated catch block
        DAOException daox = new DAOException ("FATAL Error");
        daox.setMessageKey(IErrorMessageKeys.KEY_FATAL_ERROR);
        throw daox;
      }
   
   
    }
View Full Code Here

    }
    catch (Exception e)
    {
      // TODO Auto-generated catch block
      throw new DAOException(e.getMessage());

    }
     finally
     {
       super.cleanUp(rset,pstmt);
View Full Code Here

      log.debug("ID="+roleVO.getId()+"  ||  "+roleVO.getRoleName());
     
      rset = pStmt.executeQuery();
      if( rset.next() ){
        if(rset.getInt(1)>0){
          DAOException daox = new DAOException ("Database Error");
          daox.setMessageKey(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
          throw daox;
        }
      }
     
      sql = qManager.getUpdateRole(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, roleVO.getRoleName() );
      pStmt.setString( 2, roleVO.getRoleDesc() );
      pStmt.setString( 3, roleVO.getId());
     
      pStmt.executeUpdate();
       
      this.createSearchContent(con, dbType, roleVO, "TBL_ROLE", "ROLE_ID" ) ;
       
      //first delete old groups
      sql = qManager.getDeleteRoleGroupQuery(dbType);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, roleVO.getId());
      pStmt.executeUpdate();
     
      String[] groupIds = EEMSUtil.convertToArray(roleVO.getGroupNames(),IConstants.EEMS_DELIMITER);
      if(groupIds!=null)
      {
        sql = qManager.getFetchRoleGroupQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);
 
        for (int i=0; i<groupIds.length;i++)
        {
          if(groupIds[i]!= null)
          {
           
            log.debug("GROUPSID " + groupIds[i]);
            log.debug("role id "+roleVO.getId());
            pStmt.setString( 1, groupIds[i].trim() );
            pStmt.setString( 2, roleVO.getId() );
            pStmt.executeUpdate();
            log.debug("ROLE-GROUP added" + i);
          }
        }
 
      }
      //first delete old privilege
      sql = qManager.getDelRolePrivilegeQuery(dbType);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, roleVO.getId());
      pStmt.executeUpdate();
     
      /* Privilege */
      String[] privilegeIds = EEMSUtil.convertToArray(roleVO.getPrivilegeNames(),IConstants.EEMS_DELIMITER);
      if(groupIds!=null)
      {
        sql = qManager.getRolePrivilegeQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);

        for (int i=0; i<privilegeIds.length;i++)
        {
          if(privilegeIds[i]!= null)
          {
         
            log.debug("privilegeID " + privilegeIds[i]);
            log.debug("role id "+roleVO.getId());
            pStmt.setString( 1, roleVO.getId() );
            pStmt.setString( 2, privilegeIds[i].trim() );
            pStmt.executeUpdate();
            log.debug("ROLE-privilege added" + i);
          }
        }
 
      } 
      /* Privilege */       
     
     
     
      log.debug("inserted...and updated");
      con.commit();
    }
    catch(SQLException ex)
    {
      try
      {
        con.rollback();
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
    }
    finally
    {
      try
      {
                super.cleanUp(rset, pStmt);
        this.releaseConnection(con);
      }
      catch (DAOException e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
        DAOException daox = new DAOException ("FATAL Error");
        daox.setMessageKey(IErrorMessageKeys.KEY_FATAL_ERROR);
        throw daox;
      }


    }
View Full Code Here

      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
    }
    finally
    {
      try
      {
                super.cleanUp(null, pStmt);
        this.releaseConnection(con);
      }
      catch (DAOException e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
        DAOException daox = new DAOException ("FATAL Error");
        daox.setMessageKey(IErrorMessageKeys.KEY_FATAL_ERROR);
        throw daox;
      }
 
 
    }
View Full Code Here

 
    }
    catch (Exception e)
    {
      // TODO Auto-generated catch block
      throw new DAOException(e.getMessage());
    }
    finally
    {
      super.cleanUp(rset, pstmt);
      this.releaseConnection(con);
View Full Code Here

 
    }
    catch (Exception e)
    {
      // TODO Auto-generated catch block
      throw new DAOException(e.getMessage());

    }
    finally
    {
            super.cleanUp(rset, pstmt);
View Full Code Here

TOP

Related Classes of com.eforce.baby.common.dao.DAOException

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.