Package com.eforce.baby.common.dao

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


    Connection con = this.createConnection( dsName );
    PreparedStatement pStmt=null;
    try
    {
      con.setAutoCommit(false);
      QueryManager qManager = QueryManager.getInstance();
      String sql = qManager.getDeleteUserQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, id );
      pStmt.executeUpdate();
      log.debug("User Deleted ");
View Full Code Here


    String userId = "";
    PreparedStatement pStmt=null;
    try
    {
      con.setAutoCommit(false);
      QueryManager qManager = QueryManager.getInstance();
      String sql = qManager.getFindUserIDQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, id );
      ResultSet rset = pStmt.executeQuery();
      if(rset.next()){
View Full Code Here

        String userId = "";
        PreparedStatement pStmt=null;
        try
        {
            con.setAutoCommit(false);
            QueryManager qManager = QueryManager.getInstance();
            String sql = qManager.getFindLoginIDQuery(dbType);
            log.debug(sql);
            pStmt = con.prepareStatement( sql );
            pStmt.setString( 1, id );
            ResultSet rset = pStmt.executeQuery();
            if(rset.next()){
View Full Code Here

       String userId = "";
       PreparedStatement pStmt=null;
       try
       {
           con.setAutoCommit(false);
           QueryManager qManager = QueryManager.getInstance();
           String sql = qManager.getFindProfileIDQuery(dbType);
           log.debug(sql);
           pStmt = con.prepareStatement( sql );
           pStmt.setString( 1, id );
           ResultSet rset = pStmt.executeQuery();
           if(rset.next()){
View Full Code Here

    String profileEnabled = "";
    PreparedStatement pStmt=null;
    try
    {
      con.setAutoCommit(false);
      QueryManager qManager = QueryManager.getInstance();
      String sql = qManager.getForceProfileEnabledQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      ResultSet rset = pStmt.executeQuery();
      if(rset.next()){
        profileEnabled=rset.getString(1);
View Full Code Here

        ResultSet rset = null;
    try
    {
      con.setAutoCommit(false);
   
      QueryManager qManager = QueryManager.getInstance();

      /* Checking for duplicate role */
      String sql;
      sql = qManager.getDuplicateRoleQuery(dbType);
      pStmt = con.prepareStatement( sql );
      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++)
        {
View Full Code Here

    PreparedStatement pStmt = null;
        ResultSet rset = null;
    try
    {
      con.setAutoCommit(false);
      QueryManager qManager = QueryManager.getInstance();

      /* Check if there is any ROLE with same name */
      String sql;
      sql = qManager.getDuplicateRoleUpdateQuery(dbType);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, roleVO.getId() );
      pStmt.setString( 2, roleVO.getRoleName() );
      log.debug("SQL="+sql);
      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++)
        {
View Full Code Here

    Connection con = this.createConnection( dsName );
    PreparedStatement pStmt=null;
    try
    {
      con.setAutoCommit(false);
      QueryManager qManager = QueryManager.getInstance();
      String sql = qManager.getDelGroupRoleQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, id );
      pStmt.executeUpdate();
     
      sql = qManager.getDelRolePrivilegeQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, id );
      pStmt.executeUpdate();

      sql = qManager.getDeleteRoleQuery(dbType);
      log.debug(sql);
      pStmt = con.prepareStatement( sql );
      pStmt.setString( 1, id );
      pStmt.executeUpdate();
View Full Code Here

TOP

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

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.