Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.UserBean


    Query q = old_ssn.createQuery("FROM UserForm u ORDER BY u.id ASC");
    List users = q.list();
   
    for(int i=0;i<users.size();i++){
      UserForm user = (UserForm)users.get(i)
      UserBean ubean = new UserBean();
      //���뵽ָ����site
      ubean.setSite(site);
      ubean.setName(user.getLoginName());
      ubean.setNickname(user.getDisplayName());
      ubean.setPassword(user.getPassword());
      ubean.setRegTime(new Timestamp(user.getRegTime().getTime()));
      ubean.setResume(user.getResume());
      ubean.setEmail(user.getEmail());
      ubean.setHomePage(StringUtils.abbreviate(user.getHomePage(),50));
      ubean.setLastAddr(user.getLastAddr());
      if(user.getLastTime()!=null)
        ubean.setLastTime(new Timestamp(user.getLastTime().getTime()));
      new_ssn.save(ubean);
      //�����¾��û��ı�Ŷ�Ӧ��ϵ
      userids.put(new Integer(user.getId()), ubean);
      System.out.println("User: " + user.getId() + " -> " + ubean.getId());
    }
  }
View Full Code Here


      msg.setStatus(MessageBean.STATUS_NEW);
      //����д�����ݿ�
      Session ssn = getSession();
      beginTransaction();
      for(int i=0;i<users.size();i++){
        UserBean user = (UserBean)users.get(i);
        msg.setToUser(user);
        ssn.save(msg);
        if(i % 20 == 0){
          ssn.flush();
          ssn.clear();
View Full Code Here

   * @param request
   * @param user
   * @return
   */
  public UserBean formToBean() {
    UserBean ubean = new UserBean();
    // ��ֵ
    ubean.setName(getName().trim());
    ubean.setNickname(super.autoFiltrate(getNickname().trim()));
    ubean.setBirth(getBirth());
    ubean.setKeepDays(getKeepDays());
    //ubean.setLastAddr(request.getRemoteAddr());
    ubean.setPassword(getPassword())
    if (StringUtils.isNotEmpty(getResume()))
      ubean.setResume(super.autoFiltrate(getResume()));

    ContactInfo ci = new ContactInfo();
    if (StringUtils.isNotEmpty(getEmail()) && StringUtils.isEmail(getEmail()))
      ci.setEmail(getEmail());
    if (StringUtils.isNotEmpty(getHomePage()))
      ci.setHomePage(getHomePage());
    if (StringUtils.isNotEmpty(getMobile()))
      ci.setMobile(getMobile());
    if (StringUtils.isNotEmpty(getMsn()))
      ci.setMsn(getMsn());
    if (StringUtils.isNotEmpty(getQq()))
      ci.setQq(getQq());
    if (StringUtils.isNotEmpty(getProvince()))
      ci.setProvince(getProvince());
    if (StringUtils.isNotEmpty(getCity()))
      ci.setCity(getCity());
    //ci.setMobile(RequestUtils.getRequestMobile(request));
    ubean.setContactInfo(ci);

    ubean.setSex(getSex());

    SiteBean site = null;
    // ���վ���Ƿ���Ч
    if (getSid() > 0)
      site = SiteDAO.getSiteByID(getSid());
    ubean.setSite(site);

    return ubean;
  }
View Full Code Here

  public static boolean addBlackList(int myId, int otherId, int type){
    if(namedUniqueResult("BLACKLIST", myId, otherId)==null){
      MyBlackListBean fbean = new MyBlackListBean();
      fbean.setAddTime(new Date());
      fbean.setMyId(myId);
      fbean.setOther(new UserBean(otherId));
      fbean.setType(type);
      save(fbean);
      return true;
    }
    return false;
View Full Code Here

      HttpServletResponse response) throws Exception      
  {
    CatalogForm catalog = (CatalogForm) form;
    super.validateClientId(request, catalog);
    ActionMessages msgs = new ActionMessages();
    UserBean loginUser = super.getLoginUserAfterValidateSiteOwner(request);
    //���userid�Ƿ����
    if (catalog.getUserid() < 1
        || UserDAO.getUserByID(catalog.getUserid()) == null) {
      msgs.add("userid", new ActionMessage("error.user_not_found",
          new Integer(catalog.getUserid())));
    }
    else if(catalog.getUserid()== loginUser.getId()){
      //��������Լ�
    }
    else{
      SiteBean site = getSiteBean(request);
      //���catalog_id�Ƿ���Ч
View Full Code Here

      if (StringUtils.isEmpty(mform.getUrl())) {
        msgs.add("url", new ActionMessage("error.music.url_empty"));
        break;
      }
      // ��֤�Ƿ��¼�û�
      UserBean loginUser = super.getLoginUser(request, response);
      if (loginUser == null) {
        msgs.add("url", new ActionMessage("error.user_not_login"));
        break;
      }
      if (loginUser.getStatus() != UserBean.STATUS_NORMAL) {
        msgs.add("url", new ActionMessage("error.user_not_available"));
        break;
      }
      // ��֤���ֺе���Ч��
      MusicBoxBean mbox = MusicDAO.getMusicBoxByID(mform.getBox());
View Full Code Here

      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_id) throws Exception {
    int diary_id = Integer.parseInt(s_id);
    String msg = "";
    do{
      UserBean loginUser = super.getLoginUser(request, response);
      if(!SiteBean.isSuperior(loginUser)){
        msg = getMessage(request,null,"error.access_deny");
        break;
      }
      boolean elite = "1".equals(request.getParameter("elite"));
View Full Code Here

  protected ActionForward doUndelete(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response,
      String s_log_id) throws Exception {
    int log_id = Integer.parseInt(s_log_id);
    DiaryForm diaryForm = (DiaryForm) form;
    UserBean loginUser = super.getLoginUser(request, response);
    String msg = null;
    String page = "diary";
    while (true) {
      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;
      }
      DiaryOutlineBean log = DiaryDAO.getDiaryOutlineByID(log_id);
      if (log == null || log.getStatus() != DiaryBean.STATUS_DELETED) {
        msg = getMessage(request, null, "error.diary_not_exists");
        break;
      }
      // ֻ��վ�����Դ��������лָ��ռ�
      if (loginUser.getOwnSiteId()!=diaryForm.getSid() && !SiteBean.isSuperior(loginUser) && log.getOwner().getId()!=loginUser.getId()){
        msg = getMessage(request, null, "error.access_deny");
        break;
      }
      try {
        DiaryDAO.unDelete(log);
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    ActionMessages msgs = new ActionMessages();
    DiaryForm diaryForm = (DiaryForm) form;
    //super.validateClientId(request, diaryForm);
    UserBean loginUser = super.getLoginUser(request, response);
    if (loginUser == null) {
      msgs.add("editlog", new ActionMessage("error.user_not_login"));
    } else {
      DiaryBean diary = DiaryDAO.getDiaryByID(diaryForm.getId());
      if (diary == null) {
        msgs
            .add("editlog", new ActionMessage(
                "error.diary_not_exists"));
      } else if (!DiaryDAO.canUserEditDiary(loginUser, diary)) {
        msgs.add("editlog", new ActionMessage("error.access_deny"));
      } else {
        boolean catalog_can_access = false;
        if (diary.getCatalog().getId() != diaryForm.getCatalogId()) {
          SiteBean site = diary.getSite();
          CatalogBean catalog = null;
          // վ�����Է���վ�ڵ��κη���
          if (site.isOwner(loginUser)) {
            catalog = CatalogDAO.getCatalogByID(diaryForm
                .getCatalogId());
            if (catalog.getSite().getId() == site.getId())
              catalog_can_access = true;
          } else {
            // �г��û��ڸ�վ��ɷ��ʵ��ռǷ���
            List catalogs = CatalogDAO.listCatalogs(site, loginUser, true);
            for (int i = 0; catalogs != null && i < catalogs.size(); i++) {
              CatalogBean t_catalog = (CatalogBean) catalogs
                  .get(i);
              if (t_catalog.getId() == diaryForm.getCatalogId()) {
                catalog = t_catalog;
                catalog_can_access = true;
                break;
              }
            }
          }
          // �����ռ���������
          if (catalog != null) {
            diary.getCatalog().incArticleCount(-1);
            diary.setCatalog(catalog);
            catalog.incArticleCount(1);
          }
        } else
          catalog_can_access = true;
        if (catalog_can_access) {
          SiteBean site = diary.getSite();
          // �����ռ�
          boolean updateTags = false;
          if (!StringUtils.equals(diary.getKeyword(), diaryForm
              .getTags())) {
            updateTags = true;
            if (StringUtils.isNotEmpty(diaryForm.getTags()))
              diary.setKeyword(super.autoFiltrate(site, diaryForm.getTags()));
            else {
              diary.setKeyword(null);
            }
          }
          diary.setTitle(super.autoFiltrate(site,diaryForm.getTitle()));
          if (!StringUtils.equals(diaryForm.getContent(), diary.getContent())) {
            diary.setContent(super.autoFiltrate(site,diaryForm.getContent()));
            diary.setSize(diaryForm.getContent().getBytes().length);
            //�����ı�����(Winter Lau, 2006-5-12)
            if(diary.getStatus() == DiaryBean.STATUS_NORMAL)
              TextCacheManager.updateTextContent(DiaryBean.TYPE_DIARY, diary.getId(), diary.getContent());
          }
          diary.setAuthor(diaryForm.getAuthor());
          if (StringUtils.isNotEmpty(diaryForm.getAuthorUrl()))
            diary.setAuthorUrl(diaryForm.getAuthorUrl());
          diary.setMoodLevel(diaryForm.getMoodLevel());
          if (StringUtils.isNotEmpty(diaryForm.getRefUrl()))
            diary.setRefUrl(diaryForm.getRefUrl());
          diary.setReplyNotify(diaryForm.getNotify());
          diary.setWeather(diaryForm.getWeather());
          diary.setModifyTime(new Date());
          if (diaryForm.getBgSound() != -1) {
            // ��鱳�������Ƿ���Ч
            MusicBean song = MusicDAO.getMusicByID(diaryForm.getBgSound());
            if (song != null
                && song.getSite().getId() == diary.getSite().getId()) {
              diary.setBgSound(song);
            }
          }
          try {
            // �����ϴ�����Ϣ
            pickupUploadFileItems(request, response, loginUser
                .getId(), diary.getSite(), diary.getId(), DiaryBean.TYPE_DIARY);
            DiaryDAO.update(diary, updateTags);
          } catch (Exception e) {
            context().log("update diary failed.", e);
            msgs.add("editlog", new ActionMessage("error.database",
View Full Code Here

   */
  protected ActionForward doCleanupTrash(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    DiaryForm diaryForm = (DiaryForm) form;
    UserBean loginUser = super.getLoginUser(request, response);
    String msg = null;
    if (loginUser == null) {
      msg = getMessage(request, null, "error.user_not_login");
    } else {
      if (loginUser.getOwnSiteId()!=diaryForm.getSid()) {
        msg = getMessage(request, null, "error.access_deny");
      } else {
        try {
          DiaryDAO.cleanupTrash(diaryForm.getSid());
          msg = getMessage(request, null, "trash.empty");
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.beans.UserBean

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.