Package com.eforce.baby.common.dao

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


      log.debug("ID="+groupVO.getId()+"  ||  "+groupVO.getGroupName());
      ResultSet 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_GROUP);
          throw daox;
        }
      }

      sql = qManager.getUpdateGroupQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, groupVO.getGroupName() );
      pStmt.setString( 2, groupVO.getGroupDesc() );
      pStmt.setString( 3, groupVO.getId());

      pStmt.executeUpdate();

      //first delete old users
      sql = qManager.getDeleteGroupUserQuery(dbType);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, groupVO.getId());
      pStmt.executeUpdate();

      this.createSearchContent(con,dbType, groupVO, "TBL_GROUP", "GROUP_ID");

      String[] userIds = EEMSUtil.convertToArray(groupVO.getUserNames(),IConstants.EEMS_DELIMITER);
      if(userIds!=null)
      {
        sql = qManager.getFindCreateUserGroupQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);
   
        for (int i=0; i<userIds.length;i++)
        {
          if(userIds[i]!= null)
          {
            log.debug("userID " + userIds[i]);
            log.debug("groupid "+groupVO.getId());
            pStmt.setString( 1, userIds[i].trim() );
            pStmt.setString( 2, groupVO.getId() );
            pStmt.executeUpdate();
            log.debug("user-group added" + i);
          }
        }
   
      }
      log.debug("inserted...and updated");
      con.commit();
    }
    catch(SQLException ex)
    {
      try
      {
        con.rollback();
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        log.error("Error GroupDAO SQLException:" + e);
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
    }
    finally
    {
      try
      {
        if(pStmt != null) pStmt.close();
        this.releaseConnection(con);
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        log.error("Error GroupDAO SQLException:" + e);
        DAOException daox = new DAOException ("FATAL Error");
        daox.setMessageKey(IErrorMessageKeys.KEY_FATAL_ERROR);
        throw daox;
      }


    }
View Full Code Here


      groupVO.setUserNames(userLoginId);
      groupVO.setUserIDs(userId);
    }
    catch(SQLException e){
      log.error("Error GroupDAO SQLException:" + e);
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
    }
    finally{
      try
      {
                if(rset != null)
                {
                    rset.close();
                }
                if(pStmt != null)
                {
                    pStmt.close();
                }
        this.releaseConnection(con);
        log.debug("Connection released");
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        DAOException daox = new DAOException ("FATAL Error");
        daox.setMessageKey(IErrorMessageKeys.KEY_FATAL_ERROR);
        throw daox;
      }
    }
    return groupVO;
  }
View Full Code Here

      pStmt.setString( 1, groupVO.getGroupName() );
      ResultSet 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_GROUP);
          throw daox;
        }
      }
     
     
      sql = qManager.getFetchNewGroupIdQuery(dbType);
      log.debug(sql);
      groupVO.setId(this.getCurrentSequenceValue(con,sql));
      //sql = qManager.getFetchNewGroupQuery(dbType);
      sql = qManager.getFindCreateGroupQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
 
      pStmt.setString( 1, groupVO.getId() );
      pStmt.setString( 2, groupVO.getGroupName() );
      pStmt.setString( 3, groupVO.getGroupDesc());
      pStmt.executeUpdate();
     
      this.createSearchContent(con,dbType, groupVO, "TBL_GROUP", "GROUP_ID");
     
      String[] userIds = EEMSUtil.convertToArray(groupVO.getUserNames(),IConstants.EEMS_DELIMITER);
      if(userIds!=null)
      {
        sql = qManager.getFindCreateUserGroupQuery(dbType);
        pStmt = con.prepareStatement( sql );
        log.debug(sql);
       
        for (int i=0; i<userIds.length;i++)
        {
          if(userIds[i]!= null)
          {
            pStmt.setString( 1, userIds[i].trim() );
            pStmt.setString( 2, groupVO.getId() );
            pStmt.executeUpdate();
            log.debug("user-group added" + i);
          }
        }
       
      }
      log.debug("inserted in tbl_group...and returning");
      con.commit();
    }
    catch(SQLException ex)
    {
      try
      {
        con.rollback();
        log.debug("Rollback...");
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        log.error("Error GroupDAO SQLException:" + e);
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
   
    }
    finally
    {
      try
      {
        if(pStmt!=null) pStmt.close();
        this.releaseConnection(con);
        log.debug("Connection released");
      }
      catch (SQLException 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

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

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

      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        log.error("Error GroupDAO SQLException:" + e);
      }
      DAOException daox = new DAOException ("Database Error");
      daox.setMessageKey(IErrorMessageKeys.KEY_DATABASE_ERROR);
      throw daox;
    }
    finally
    {
      try
      {
        if(pStmt!=null) pStmt.close();
        this.releaseConnection(con);
      }
      catch (SQLException e)
      {
        // TODO Auto-generated catch block
        log.error("Error GroupDAO SQLException:" + e);
        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

            }

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

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

            rowCount = stmt.executeUpdate();
            log.debug("rowCount: " + rowCount);
        }
        catch(SQLException se)
        {
            throw new DAOException(se.getMessage());
        }
        finally
        {
            super.releaseConnection(con);
            super.cleanUp(null, stmt);
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.