Package com.eforce.baby.auth.vo

Examples of com.eforce.baby.auth.vo.RoleVO


   * @param string
   * @return
   */
  public RoleVO getRole(String dsName, String dbType, String roleID) throws BusinessException
  {
    RoleVO roleVO = null;
       
        RoleDAO dao = (RoleDAO)DAOFactory.getInstance().getDAO("com.eteam.ems.auth.dao.RoleDAO");
        try
        {
          log.debug("calling  dao.findRole");
View Full Code Here


   * @return
   */
  public RoleVO findRole(String dsName, String dbType, String roleID) throws DAOException
  {
    Connection con = super.createConnection(dsName);
    RoleVO roleVO =  new RoleVO();
    roleVO.setId(roleID);
      PreparedStatement pstmt=null;
      ResultSet rset = null;

    log.debug("start of DB Fetch");
    try {
      String sql = QueryManager.getInstance().getFindRole(dbType);
      pstmt = con.prepareStatement(sql);
      log.debug(sql);
      pstmt.setString(1, roleVO.getId());
      rset = pstmt.executeQuery();

      String groups = "";
      String sep = ", ";
      while(rset.next())
       {
         if(groups.equals(""))
         {
          roleVO.setRoleName(rset.getString(1));
          roleVO.setRoleDesc(rset.getString(2));
          
         
         }
         if(!rset.getString(3).equals("NA"))
         {
          groups += rset.getString(3)+sep;
         }
       }
       if(groups.endsWith(sep))
       {
        groups=groups.substring(0,(groups.length()-sep.length()));
     
       }
      roleVO.setGroupNames(groups);
      
      log.debug("groups="+groups);

      /* Privilege */
      sql = QueryManager.getInstance().getFindRoleSelectedPrivilegeQuery(dbType);
      pstmt = con.prepareStatement(sql);
      log.debug(sql);
      pstmt.setString(1, roleVO.getId());
      rset = pstmt.executeQuery();

      String privileges = "";
      sep = ", ";
      while(rset.next())
       {
         if(!rset.getString(2).equals("NA"))
         {
          privileges += rset.getString(2)+sep;
         }
       }
       if(privileges.endsWith(sep))
       {
        privileges=privileges.substring(0,(privileges.length()-sep.length()));
     
       }
      roleVO.setPrivilegeNames(privileges);
      /* Privilege */
      log.debug("Privilege="+privileges);


    }
View Full Code Here

    log.debug("calling get Role");
    HttpSession session = request.getSession();
    SessionUserVO sessUser = (SessionUserVO) session.getAttribute(IConstants.SESSION_ATTR_USER_SESSION_INFO);
    String dsName = sessUser.getDsName();
    String dbType = sessUser.getDbType();
    RoleVO roleVO = new RoleVO();
    try
    {
      roleVO = bd.getRole(dsName, dbType, request.getParameter("id"));
    }
    catch (Exception e) {
View Full Code Here

    log.debug("calling get Role");
    HttpSession session = request.getSession();
    SessionUserVO sessUser = (SessionUserVO) session.getAttribute(IConstants.SESSION_ATTR_USER_SESSION_INFO);
    String dsName = sessUser.getDsName();
    String dbType = sessUser.getDbType();
    RoleVO roleVO = new RoleVO();
    try
    {
      roleVO = bd.getRole(dsName, dbType, request.getParameter("id"));
    }
    catch (Exception e) {
View Full Code Here

                  )
                  throws IOException, ServletException 
  {   
    log.debug("Creating Role ...");
    ActionForward actionFrwd = null;
    RoleVO roleVO = new RoleVO();
    try
    {
 
      BeanUtils.copyProperties( roleVO, form );
   

    }
    catch (IllegalAccessException e)
    {
      log.error("ERROR in createRole",e);
    }
    catch (InvocationTargetException e)
    {
      log.error("ERROR in createRole",e);
    }
    log.debug("Asking for RoleBD");
    try
    {
      RoleBD bd = (RoleBD)BusinessDelegateFactory.getInstance().getDelegate("com.eteam.ems.auth.delegates.RoleBD");
 
      log.debug("BD got, calling create Role");
   
      HttpSession session = request.getSession();
      SessionUserVO sessUser = (SessionUserVO) session.getAttribute(IConstants.SESSION_ATTR_USER_SESSION_INFO);
      String dsName = sessUser.getDsName();
      String dbType = sessUser.getDbType();
   
      bd.createDistGroup(dsName , dbType, roleVO);
      log.debug("Role Created Successfully !!!");
 
      request.setAttribute("fwd","/admin/Role.do?target=viewRole&id="+roleVO.getId());
      actionFrwd=mapping.findForward("pop_success");
 
    } catch(DAOException e){
      ActionMessage message;
      log.debug("Message Key:= "+e.getMessageKey());
View Full Code Here

                  )
                  throws IOException, ServletException
    {
      ActionForward actionFrwd = null;
      log.debug("Updating  Role ...");
      RoleVO roleVO = new RoleVO();
      try
      {

        BeanUtils.copyProperties(roleVO,form);

      }
      catch (IllegalAccessException e)
      {
        log.error("ERROR in updateRole",e);
      }
      catch (InvocationTargetException e)
      {
        log.error("ERROR in updateRole",e);
      }
      log.debug("Asking for DistGroupBD");
      try
      {
        RoleBD bd = (RoleBD)BusinessDelegateFactory.getInstance().getDelegate("com.eteam.ems.auth.delegates.RoleBD");
        log.debug("BD got, calling updateRole");

        HttpSession session = request.getSession();
        SessionUserVO sessUser = (SessionUserVO) session.getAttribute(IConstants.SESSION_ATTR_USER_SESSION_INFO);
        String dsName = sessUser.getDsName();
        String dbType = sessUser.getDbType();

        bd.updateRole(dsName , dbType, roleVO);
        log.debug("Role Updated Successfully !!!");

        request.setAttribute("fwd","/admin/Role.do?target=viewRole&id="+roleVO.getId());
        actionFrwd=mapping.findForward("pop_success");

      } catch(DAOException e){
        ActionMessage message;
        log.debug("Message Key:= "+e.getMessageKey());
        log.debug("Error Message := "+IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
        if( e.getMessageKey().equals(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE)){
          message =  new ActionMessage(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
        }
        else{
          message =  new ActionMessage(IErrorMessageKeys.KEY_DATABASE_ERROR);
        }
        //ActionMessage message =  new ActionMessage(IErrorMessageKeys.KEY_DATABASE_ERROR);
        ActionMessages messages = new ActionMessages();
        messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
        this.saveErrors(request, messages);

        actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());
      }
      catch (BusinessException be)
      {
        // TODO Auto-generated catch block
   

        // If some business error occured, will return to the input page
        ActionMessage message = new ActionMessage(be.getMessageKey());
        ActionMessages messages = new ActionMessages();
        messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
        this.saveErrors(request, messages);
   
        actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());

      }
      catch (Exception e1)
      {
        // TODO Auto-generated catch block
        e1.printStackTrace();

        // If some business error occured, will return to the input page
        ActionMessage message = new ActionMessage(IErrorMessageKeys.KEY_FATAL_ERROR);
        ActionMessages messages = new ActionMessages();
        messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
        this.saveErrors(request, messages);

        actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());

      }
      return actionFrwd;
    }
View Full Code Here

TOP

Related Classes of com.eforce.baby.auth.vo.RoleVO

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.