Package org.apache.struts.action

Examples of org.apache.struts.action.ActionMessage


    PhotoForm photo = (PhotoForm)form;
    validateClientId(request, photo);
    ActionMessages msgs = new ActionMessages();
   
    if(StringUtils.isEmpty(photo.getName()))
      msgs.add("name", new ActionMessage("error.photo.name_empty"));
    else{
      PhotoBean pbean = PhotoDAO.getPhotoByID(photo.getId());
      if(pbean != null){
        if(!StringUtils.equals(pbean.getName(), photo.getName())){
          pbean.setName(super.autoFiltrate(pbean.getSite(), photo.getName()));
View Full Code Here


    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      if (StringUtils.isEmpty(reply.getContent())) {
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      _ReplyBean rbean = ReplyDAO.getReply(PhotoReplyBean.class, reply
          .getReply_id());
      if (rbean!=null && rbean.getSite().getId() == site.getId()) {
View Full Code Here

    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      if (StringUtils.isEmpty(reply.getContent())) {
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      _ReplyBean rbean = ReplyDAO.getReply(DiaryReplyBean.class, reply.getReply_id());
      if (rbean!=null && rbean.getSite().getId() == site.getId()) {
        String content = StringUtils.abbreviate(super.autoFiltrate(
View Full Code Here

    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    do{
      if (StringUtils.isEmpty(reply.getContent())){
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if(reply.getContent().getBytes().length >= 3000){
        msgs.add("reply", new ActionMessage("error.reply_too_long"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      //��������
      if(loginUser!=null && isUserInBlackList(site, loginUser)){
        msgs.add("topic", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      DiaryOutlineBean diary = DiaryDAO.getDiaryOutlineByID(reply.getParentId());
      if (diary == null || diary.getSite().getId() != reply.getSid()) {
        msgs.add("reply", new ActionMessage("error.param"));
        break;
      }      
      if(diary.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.diary.locked"));
        break;
      }
      // ���������д������
      DiaryReplyBean rbean = new DiaryReplyBean();
      rbean.setUser(loginUser);     
View Full Code Here

    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    PhotoReplyBean rbean = new PhotoReplyBean();
    do{
      if (StringUtils.isEmpty(reply.getContent())){
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if(reply.getContent().getBytes().length >= 3000){
        msgs.add("reply", new ActionMessage("error.reply_too_long"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      //��������
      if(loginUser!=null && isUserInBlackList(site, loginUser)){
        msgs.add("photo", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      PhotoOutlineBean photo = PhotoDAO.getPhotoOutlineByID(reply.getParentId());
      if (photo == null || photo.getSite().getId() != reply.getSid()) {
        msgs.add("reply", new ActionMessage("error.param"));
        break;
      }
      if(photo.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.photo.locked"));
        break;
      }
      // ���������д������
      rbean.setUser(loginUser);
      rbean.setAuthor(super.autoFiltrate(site,reply.getAuthor()));
View Full Code Here

    MusicBoxForm mbox = (MusicBoxForm) form;
    super.validateClientId(request, mbox);
    ActionMessages msgs = validateSiteOwner(request, response, mbox);
    int mboxid = -1;
    if (msgs.isEmpty() && StringUtils.isEmpty(mbox.getName()))
      msgs.add("name", new ActionMessage("error.mbox.name_empty"));
    else if (msgs.isEmpty()) {
      SiteBean site = super.getSiteBean(request);
      MusicBoxBean mbean = new MusicBoxBean();
      mbean.setName(super.autoFiltrate(site, mbox.getName()));
      if (StringUtils.isNotEmpty(mbox.getDesc())){
View Full Code Here

    MusicForm mform = (MusicForm) form;
    super.validateClientId(request, mform);
    ActionMessages msgs = new ActionMessages();
    do{
      if (StringUtils.isEmpty(mform.getTitle())) {
        msgs.add("name", new ActionMessage("error.music.title_empty"));
        break;
      }
      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());
      if (mbox == null || mbox.getSite().getId() != mform.getSid()) {
        msgs.add("name", new ActionMessage("error.mbox_not_available",
            new Integer(mform.getBox())));
        break;
      }
      SiteBean site = super.getSiteByID(mform.getSid());
      if(site==null){
        msgs.add("site", new ActionMessage("error.site_not_available"));
        break;
      }
      //��������
      if(isUserInBlackList(site, loginUser)){
        msgs.add("music", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      MusicBean mbean = new MusicBean();
      mbean.setSite(site);
      mbean.setIntroducer(loginUser);
View Full Code Here

    MusicForm mform = (MusicForm) form;
    super.validateClientId(request, mform);
    ActionMessages msgs = validateSiteOwner(request, response, mform);
    while (msgs.isEmpty()) {
      if (StringUtils.isEmpty(mform.getTitle())) {
        msgs.add("name", new ActionMessage("error.music.title_empty"));
        break;
      }
      // ��֤���ֺе���Ч��
      MusicBoxBean mbox = MusicDAO.getMusicBoxByID(mform.getBox());
      if (mbox != null && mbox.getSite().getId() != mform.getSid()) {
        msgs.add("name", new ActionMessage("error.mbox_not_available",
            new Integer(mform.getBox())));
        break;
      }
      SiteBean site = super.getSiteBean(request);
      MusicBean mbean = new MusicBean();
View Full Code Here

   * @param user
   */
  public void validateUserForm(HttpServletRequest request,
      ActionMessages msgs, boolean reg) {
    if (reg && StringUtils.isEmpty(getName()))
      msgs.add("name", new ActionMessage("error.username_empty"));
    else if (reg && !StringUtils.isLegalUsername(getName()))
      msgs.add("name", new ActionMessage("error.illegal_username"));
    else if (StringUtils.isEmpty(getNickname()))
      msgs.add("nickname", new ActionMessage("error.nickname_empty"));
    else if (StringUtils.isEmpty(getPassword()))
      msgs.add("password", new ActionMessage("error.password_empty"));
    // ��֤�û��������ϵ��Ϣ����Ч��
    else if (StringUtils.isNotEmpty(getEmail())
        && !StringUtils.isEmail(getEmail()))
      msgs.add("email", new ActionMessage("error.email_format"));
    else if (StringUtils.isNotEmpty(getQq())
        && !StringUtils.isNumeric(getQq()))
      msgs.add("qq", new ActionMessage("error.qq_format"));
    else if (StringUtils.isNotEmpty(getMsn())
        && !StringUtils.isEmail(getMsn()))
      msgs.add("msn", new ActionMessage("error.msn_format"));
    else if (StringUtils.isNotEmpty(getMobile())
        && !StringUtils.isNumeric(getMobile()))
      msgs.add("mobile", new ActionMessage("error.mobile_format"));
    // У��ע����֤��
    else if (reg
        && !StringUtils.equals(getVerifyCode(),
            getVerifyCode(request)))
      msgs.add("verifyCode", new ActionMessage("error.verified_failed"));
    else if (DLOGSecurityManager.IllegalGlossary.existIllegalWord(getNickname()))
      msgs.add("nickname", new ActionMessage("error.illegal_glossary"));
    // �ʺŲ������ظ�
    else if (reg && DLOGUserManager.getUserByName(getName().trim()) != null)
      msgs.add("name", new ActionMessage("error.username_exists", getName()));
    // �û��dz�Ҳ�������ظ�
    else if (reg && DLOGUserManager.getUserByNickname(getNickname().trim()) != null)
      msgs.add("nickname", new ActionMessage("error.nickname_exists", getNickname()));
  }
View Full Code Here

    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�Ƿ���Ч
      CatalogBean bean = CatalogDAO.getCatalogByID(catalog.getId());
      if(bean==null){
        msgs.add("userid", new ActionMessage("error.catalog_not_found",
            new Integer(catalog.getId())));
      }
      //���sid��catalog_id�Ƿ��Ӧ
      else if(bean.getSite().getId()!=site.getId()){
        msgs.add("userid", new ActionMessage("error.catalog_deny",
            new Integer(catalog.getId())));
      }
      else{
        //�ж��Ƿ��Ѿ�����Ȩ����Ϣ
        int role = CatalogDAO.getUserRoleInCatalog(catalog.getId(), catalog.getUserid());
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionMessage

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.