Package com.liusoft.dlog4j

Examples of com.liusoft.dlog4j.SessionUserObject


    PhotoForm pform = (PhotoForm)form;
    super.validateClientId(request, pform);
   
    ActionMessages msgs = new ActionMessages();
    do{
      SessionUserObject loginUser = super.getLoginUser(request,response,false);
      if(loginUser==null){
        msgs.add("photo", new ActionMessage("error.user_not_login"));
        break;
      }
      PhotoOutlineBean pbean = PhotoDAO.getPhotoOutlineByID(pform.getId());
View Full Code Here


    MusicForm mform = (MusicForm) form;
    int mid = Integer.parseInt(s_music_id);
    String msg = null;
    do{
      //�ж��û��Ƿ��¼���Ƿ����Լ�����վ
      SessionUserObject loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msg = getMessage(request, null, "error.user_not_login");
        break;
      }
      if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msg = getMessage(request, null, "error.user_disabled");
        break;
      }
      if(loginUser.getOwnSiteId()<=0){
        msg = getMessage(request, null, "error.user_not_have_a_site");
        break;
      }
      //�ж��û��ĸ��������Ƿ���Ч
      SiteBean toSite = super.getSiteByID(loginUser.getOwnSiteId());
      if(toSite==null){
        msg = super.getMessage(request, null, "error.site_not_available");
        break;
      }
      MusicBean mbean = MusicDAO.getMusicByID(mid);
      if(mbean!=null && mbean.getSite().getId()==mform.getSid())
      {
        MusicBean music = new MusicBean();
        music.setCreateTime(new Date());
        music.setMusicBox(null);
        music.setAlbum(mbean.getAlbum());
        music.setSinger(mbean.getSinger());
        music.setSite(new SiteBean(loginUser.getOwnSiteId()));
        music.setTitle(mbean.getTitle());
        music.setUrl(mbean.getUrl());
        music.setWord(mbean.getWord());
        MusicDAO.addMusic(music);
        msg = getMessage(request, null, "music.collected", music.getTitle());
View Full Code Here

  {
    int site_id = Integer.parseInt(s_site_id);
    String msg = null;
    do{
      //�ж��û��Ƿ��¼   
      SessionUserObject loginUser = super.getLoginUser(request, response);
      if(loginUser==null||loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msg = super.getMessage(request, null, "error.user_not_login");
        break;
      }
      //�ж��û��Ƿ�ע���и�������
      if(loginUser.getOwnSiteId()<1){
        msg = super.getMessage(request, null, "error.user_not_have_a_site");
        break;
      }
      if(loginUser.getOwnSiteId()==site_id){
        msg = super.getMessage(request, null, "error.cannot_add_myself");
        break;
      }
      //�ж��û��ĸ��������Ƿ���Ч
      SiteBean toSite = super.getSiteByID(loginUser.getOwnSiteId());
      if(toSite==null){
        msg = super.getMessage(request, null, "error.site_not_available");
        break;
      }
      //��������Ƿ��Ѿ�����
View Full Code Here

      HttpServletResponse response) throws Exception      
  {
    FormBean fbean = (FormBean) form;
    validateClientId(request, fbean);
    //�ж��û��Ƿ��¼
    SessionUserObject loginUser = super.getLoginUser(request, response, false);
    if(loginUser != null){
      String[] bids = request.getParameterValues("bid");     
      BookmarkDAO.deleteBookmarks(loginUser.getId(), bids);
    }
    return makeForward(mapping.findForward("bookmark"), fbean.getSid());
  }
View Full Code Here

   * @param request
   * @return
   */
  protected static SessionUserObject getLoginUser(HttpServletRequest request,
      HttpServletResponse response, boolean persistence) {
    SessionUserObject user = UserLoginManager.getLoginUser(request, response, true);
    try {
      if(user != null && persistence)
        return UserDAO.getUserByID(user.getId());
    } catch (Exception e) {
      log.error("getLoginUser failed.", e);
    }
    return user;
  }
View Full Code Here

   * �����ļ��ϴ�����
   */
  protected void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    //�жϵ�ǰ�������Ƿ��Ѿ���¼������д�ռǵ�Ȩ��(�ڶ����޷���֤)
    SessionUserObject loginUser = UserLoginManager.getLoginUser(req, res, true);   
    if(loginUser!=null){     
      super.doPost(req, res);
      Integer errno = (Integer)req.getAttribute("errno");
      if(errno!=null && errno.intValue()==0){
        //д���ϴ���Ϣ����
        FckUploadFileBean fbean = new FckUploadFileBean();
        try{       
          Long fileSize = (Long)req.getAttribute("file.size");
          Integer fileType = (Integer)req.getAttribute("file.type");
          String savePath = (String)req.getAttribute("file.path");
          String uriPath = (String)req.getAttribute("file.uri");
          if(fileSize!=null)
            fbean.setFileSize(fileSize.intValue());
          if(fileType!=null)
            fbean.setFileType(fileType.intValue());
          fbean.setSavePath(savePath);
          fbean.setUri(uriPath);
          HttpSession ssn = req.getSession(true);
          //SESSION_IDͬʱ������Cookie�з�ֹ
          RequestUtils.setCookie(req, res, Globals.SESSION_ID_KEY_IN_COOKIE, ssn.getId(),-1);
          fbean.setSessionId(ssn.getId());
          fbean.setUser(new UserBean(loginUser.getId()));
          fbean.setUploadTime(new Date());
          FCKUploadFileDAO.createUploadFileItem(fbean);
        }catch(Exception e){
          log.error("Writting upload file info failed.", e);
        }
View Full Code Here

      throws Exception {
    FormBean fbean = (FormBean) form;
    validateClientId(request, fbean);
    String msg = null;
    //�ж��û��Ƿ��¼
    SessionUserObject loginUser = super.getLoginUser(request, response, false);
    if(loginUser != null){
      int friendId = RequestUtils.getParam(request, "uid", -1);
      UserBean friend = UserDAO.getUserByID(friendId);
      if(friend==null)
        msg = getMessage(request,null,"error.user_not_found", new Integer(friendId));
      else if(friendId == loginUser.getId())
        msg = getMessage(request,null,"error.cannot_add_myself");
      else{
        FriendBean fb = new FriendBean();
        fb.setAddTime(new Date());
        fb.setFriend(friend);
        fb.setOwner(loginUser.getId());
        fb.setType(FriendBean.TYPE_GENERAL);
        fb.setRole(FriendBean.ROLE_GENERAL);
        UserDAO.addFriend(fb);
        msg = getMessage(request,null,"error.friend_added", new Integer(friendId));
      }
View Full Code Here

      throws Exception {
    UserForm fbean = (UserForm)form;
    super.validateClientId(request, fbean);
    String msg = null;
    //�ж��û��Ƿ��¼
    SessionUserObject loginUser = super.getLoginUser(request, response, false);
    if(loginUser!=null){
      String s_id = String.valueOf(fbean.getId());
      if(UserDAO.isUserInBlackList(loginUser.getId(), fbean.getId())){
        msg = getMessage(request,null,"error.user_already_in_block", s_id);
      }
      else{
        UserDAO.addBlackList(loginUser.getId(), fbean.getId(), 0);
        msg = getMessage(request,null,"error.user_added_to_block", s_id);
      }
    }
    else
      msg = getMessage(request,null,"error.user_not_login");
View Full Code Here

      throws Exception {
    FormBean fbean = (FormBean) form;
    validateClientId(request, fbean);
    String msg = null;
    //�ж��û��Ƿ��¼
    SessionUserObject loginUser = super.getLoginUser(request, response, false);
    if(loginUser != null){
      String[] uids = request.getParameterValues("uid");
      UserDAO.deleteBlacklist(loginUser.getId(), uids);
      msg = getMessage(request,null,"error.user_delete_from_block", "");
    }
    else
      msg = getMessage(request,null,"error.user_not_login");
    return msgbox(mapping,form,request,response,msg,fbean.getFromPage());
View Full Code Here

      throws Exception {
    FormBean fbean = (FormBean) form;
    validateClientId(request, fbean);
    String msg = null;
    //�ж��û��Ƿ��¼
    SessionUserObject loginUser = super.getLoginUser(request, response, false);
    if(loginUser != null){
      String[] uids = request.getParameterValues("uid");
      int er = UserDAO.deleteFriend(loginUser.getId(), uids);
      if(er>0)
        msg = getMessage(request,null,"error.friend_deleted");
    }
    else
      msg = getMessage(request,null,"error.user_not_login");
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.SessionUserObject

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.