Package com.eforce.baby.auth.vo

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


   * @return GroupVO
   * @throws DAOException
   */
  public GroupVO findGroup(String dsName, String dbType, String groupId) throws DAOException
  {
    GroupVO groupVO = new GroupVO();
    Connection con = this.createConnection( dsName );
    PreparedStatement pStmt=null;
    ResultSet rset = null;
   
    QueryManager qManager = QueryManager.getInstance();
    String sql = qManager.getGroupViewQuery(dbType);
    log.debug("SQL:"+sql);
    String userLoginId = null;
    String userId = null;
    try{
      pStmt = con.prepareStatement(sql);
      pStmt.setString(1, groupId);
      rset = pStmt.executeQuery();
      while(rset.next())
            {
        if(userLoginId==null)
          userLoginId += rset.getString(1);
        else
          userLoginId += (IConstants.EEMS_DELIMITER + rset.getString(1));
        if(userId==null)
          userId += rset.getString(4);
        else
          userId += (IConstants.EEMS_DELIMITER + rset.getString(4));
        groupVO.setGroupName(rset.getString(2));
        groupVO.setGroupDesc(rset.getString(3));
        groupVO.setId(groupId);
      }
      //Storing Role information separately
      sql = qManager.getGroupRoleQuery(dbType);
      pStmt = con.prepareStatement(sql);
      pStmt.setString(1,groupId);
      rset = pStmt.executeQuery();
      String roleName="NA";
      while(rset.next()){
        roleName=rset.getString(1);
      }
      groupVO.setRoleName(roleName);
     
      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);
View Full Code Here


   * @throws SQLException
   */
  public ArrayList getAllGroups(String dsName, String dbTypethrows DAOException, SQLException
  {
    Connection con = super.createConnection(dsName);
    GroupVO groupVO =  null;
    ArrayList groupList=new ArrayList();
    PreparedStatement pstmt=null;
    ResultSet rset=null;

    try {
      String sql = QueryManager.getInstance().getFindAllGroupsQuery(dbType);
      pstmt = con.prepareStatement(sql);
      log.debug(sql);
      rset = pstmt.executeQuery();

      while(rset.next())
      {
        groupVO = new GroupVO();
        groupVO.setId(rset.getString(1));
        groupVO.setGroupName(rset.getString(2));
   
        groupList.add(groupVO);
      }
 
    }
View Full Code Here

   */
  public ArrayList getDistGroupSelectedGroups(String dsName, String dbType, String roleId)
  throws DAOException, SQLException
  {
    Connection con = super.createConnection(dsName);
    GroupVO groupVO =  null;
    ArrayList groupList=new ArrayList();
    PreparedStatement pstmt=null;
    ResultSet rset=null;
     
    try {
      String sql = QueryManager.getInstance().getDistGroupSelectedGroupsQuery(dbType);
      pstmt = con.prepareStatement(sql);
      pstmt.setString( 1, roleId );
      log.debug(sql);
      rset = pstmt.executeQuery();

      while(rset.next())
      {
        groupVO = new GroupVO();
        groupVO.setId(rset.getString(1));
        groupVO.setGroupName(rset.getString(2));
   
        groupList.add(groupVO);
      }
 
    }
View Full Code Here

   */
  public ArrayList getUserSelectedGroups(String dsName, String dbType, String userId)
  throws DAOException, SQLException
  {
    Connection con = super.createConnection(dsName);
    GroupVO groupVO =  null;
    ArrayList groupList=new ArrayList();
    PreparedStatement pstmt=null;
    ResultSet rset=null;
     
    try {
      String sql = QueryManager.getInstance().getUserSelectedGroupQuery(dbType);
      pstmt = con.prepareStatement(sql);
      pstmt.setString( 1, userId );
      log.debug(sql);
      rset = pstmt.executeQuery();

      while(rset.next())
      {
        groupVO = new GroupVO();
        groupVO.setId(rset.getString(1));
        groupVO.setGroupName(rset.getString(2));
   
        groupList.add(groupVO);
      }
 
    }
View Full Code Here

    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    log.debug("Creating group ...");
    ActionForward actionFrwd = null;
    GroupVO groupVO = new GroupVO();
    try {
      BeanUtils.copyProperties(groupVO, form);
    } catch (IllegalAccessException e) {
      log.error("ERROR in createGroup", e);
    } catch (InvocationTargetException e) {
      log.error("ERROR in createGroup", e);
    }
    log.debug("Asking for GroupBD");
    try {
      GroupBD bd =
        (GroupBD) BusinessDelegateFactory.getInstance().getDelegate(
          "com.eteam.ems.auth.delegates.GroupBD");

      log.debug("BD got, calling create group");

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

      bd.createGroup(dsName, dbType, groupVO);
      log.debug("Group Created Successfully !!!");

      request.setAttribute(
        "fwd",
        "/admin/Group.do?target=viewGroup&id=" + groupVO.getId());
      actionFrwd = mapping.findForward("pop_success");

    } catch(DAOException e){
      ActionMessage message;
      log.debug("Message Key:= "+e.getMessageKey());
View Full Code Here

    SessionUserVO sessUser =
      (SessionUserVO) session.getAttribute(
        IConstants.SESSION_ATTR_USER_SESSION_INFO);
    String dsName = sessUser.getDsName();
    String dbType = sessUser.getDbType();
    GroupVO groupVO = new GroupVO();

    /* Forward to the View Page  */
    try {
      groupVO = bd.findGroup(dsName, dbType, request.getParameter(IConstants.REQ_PARAM_ID));
      BeanUtils.copyProperties(form, groupVO);
View Full Code Here

      (SessionUserVO) session.getAttribute(
        IConstants.SESSION_ATTR_USER_SESSION_INFO);
    String dsName = sessUser.getDsName();
    String dbType = sessUser.getDbType();
    // get dsName and dbType from the session - end
    GroupVO groupVO = new GroupVO();

    try {
      groupVO =
        (GroupVO) groupbd.findGroup(
          dsName,
          dbType,
          request.getParameter(IConstants.REQ_PARAM_ID));
      BeanUtils.copyProperties(form, groupVO);
    } catch (IllegalAccessException ex) {
      log.error("Error GroupAction:viewGroup()");
    } catch (InvocationTargetException ex) {
      log.error("Error GroupAction:viewGroup()");
    } catch(DAOException e){
      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(mapping.getInput());
    } catch(BusinessException e){
      ActionMessage message = new ActionMessage(e.getMessageKey());
      ActionMessages messages = new ActionMessages();
      messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
      this.saveErrors(request, messages);

      actionFrwd = new ActionForward(mapping.getInput());
    }

    request.getSession().setAttribute(
      IConstants.SESS_ATTR_UPDATE + groupVO.getId(),
      groupVO);

    actionFrwd = mapping.findForward(request.getParameter("page"));
    return actionFrwd;
  }
View Full Code Here

    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    ActionForward actionFrwd = null;

    GroupVO groupVO = new GroupVO();
    DynaActionForm dynaForm = (DynaActionForm) form;

    try {
      // Copying form objects to VO objects
      BeanUtils.copyProperties(groupVO, form);
      // Added by Arindam
    } catch (IllegalAccessException ex) {
      log.error("Error GroupAction:viewGroup()");
    } catch (InvocationTargetException ex) {
      log.error("Error GroupAction:viewGroup()");
    }

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

    GroupBD groupbd =
      (GroupBD) BusinessDelegateFactory.getInstance().getDelegate(
        "com.eteam.ems.auth.delegates.GroupBD");

    try {
      groupbd.updateGroup(dsName, dbType, groupVO);

      log.debug("new report id = " + groupVO.getId());
      request.setAttribute(
        "fwd",
        "/admin/Group.do?target=viewGroup&id=" + groupVO.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_GROUP);
      if( e.getMessageKey().equals(IErrorMessageKeys.KEY_ERROR_DUPLICATE_GROUP)){
        message =  new ActionMessage(IErrorMessageKeys.KEY_ERROR_DUPLICATE_GROUP);
      }
      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(mapping.getInput());
      actionFrwd = new ActionForward("/admin/Group.do?target=viewGroupForUpdate&id="+groupVO.getId()+"&mode=update&page=updateMain");
    } catch(BusinessException e){
      ActionMessage message = new ActionMessage(e.getMessageKey());
      ActionMessages messages = new ActionMessages();
      messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
      this.saveErrors(request, messages);

      actionFrwd = new ActionForward("/admin/Group.do?target=viewGroupForUpdate&id="+groupVO.getId()+"&mode=update&page=updateMain");
    }

    return actionFrwd;
  }
View Full Code Here

TOP

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

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.