Examples of ActionMessage


Examples of org.apache.struts.action.ActionMessage

    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

Examples of org.apache.struts.action.ActionMessage

    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

Examples of org.apache.struts.action.ActionMessage

   * @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

Examples of org.apache.struts.action.ActionMessage

    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

Examples of org.apache.struts.action.ActionMessage

  {
    CatalogForm catalog = (CatalogForm)form;
    ActionMessages msgs = new ActionMessages();
   
    if(StringUtils.isEmpty(catalog.getName()))
      msgs.add("name", new ActionMessage("error.empty_not_allowed"));
    else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(catalog.getName()))
      msgs.add("name", new ActionMessage("error.illegal_glossary"));
    else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(catalog.getDetail()))
      msgs.add("detail", new ActionMessage("error.illegal_glossary"));
    else{
      SiteBean site = super.getSiteBean(request);
      CatalogBean cbean = new CatalogBean();
      cbean.setName(super.autoFiltrate(site, catalog.getName()));
      if(StringUtils.isNotEmpty(catalog.getDetail())){
        String detail = super.autoFiltrate(site, catalog.getDetail());
        cbean.setDetail(super.filterScriptAndStyle(detail));
      }
      cbean.setType(catalog.getType());
      cbean.setSite(site);
      cbean.setCreateTime(new Date());
      if(catalog.getCatalog()>0){
        cbean.setCatalog(new TypeBean(catalog.getCatalog()));
      }
      try{
        CatalogDAO.create(cbean, catalog.getId(), catalog.getDirection()==1);
      }catch(Exception e){
        msgs.add("catalog", new ActionMessage("error.database", e.getMessage()));
      }     
    }
   
    if(!msgs.isEmpty()){
      saveMessages(request, msgs);
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    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",
                e.getMessage()));
          }
        } else
          msgs.add("log", new ActionMessage("error.catalog_deny",
              new Integer(diaryForm.getCatalogId())));
      }
    }
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    DiaryForm log = (DiaryForm) form;
    //super.validateClientId(request, log);
    while (true) {
      // ����ռDZ����ֵ
      if (StringUtils.isEmpty(log.getTitle())) {
        msgs.add("title", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if (StringUtils.isEmpty(log.getContent())) {
        msgs.add("content",
            new ActionMessage("error.empty_not_allowed"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if (loginUser == null) {
        msgs.add("log", new ActionMessage("error.user_not_login"));
        break;
      }
      if (loginUser.getStatus() != UserBean.STATUS_NORMAL) {
        msgs.add("log", new ActionMessage("error.user_not_available"));
        break;
      }
      SiteBean site = super.getSiteByID(log.getSid());
      if (site == null) {
        msgs.add("log", new ActionMessage("error.site_not_available"));
        break;
      }
      boolean catalog_can_access = false;
      CatalogBean catalog = null;
      // վ�����Է���վ�ڵ��κη���
      if (site.isOwner(loginUser)) {
        catalog = CatalogDAO.getCatalogByID(log.getCatalogId());
        if (catalog!=null && 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() == log.getCatalogId()) {
            catalog = t_catalog;
            catalog_can_access = true;
            break;
          }
        }
      }
      if (!catalog_can_access) {
        msgs.add("log", new ActionMessage("error.catalog_deny",
            new Integer(log.getCatalogId())));
        break;
      }
      // �û����������ռǷ��౻����
      if (StringUtils.isEmpty(log.getWeather()))
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    DiaryForm log = (DiaryForm) form;

    while (true) {
      UserBean loginUser = super.getLoginUser(request, response);
      if (loginUser == null) {
        msgs.add("log", new ActionMessage("error.user_not_login"));
        break;
      }
      if (loginUser.getStatus() != UserBean.STATUS_NORMAL) {
        msgs.add("log", new ActionMessage("error.user_not_available"));
        break;
      }
      SiteBean site = super.getSiteByID(log.getSid());
      if (site == null) {
        msgs.add("log", new ActionMessage("error.site_not_available"));
        break;
      }
      // �û����������ռǷ��౻����
      DiaryBean journal = DiaryDAO.getDiaryByID(log.getId());
      if (journal == null
          || journal.getStatus() != DiaryBean.STATUS_DRAFT
          || journal.getOwner().getId() != loginUser.getId()) {
        msgs.add("draft", new ActionMessage("error.draft_not_exists"));
        break;
      }
      boolean catalog_can_access = false;
      // վ�����Է���վ�ڵ��κη���
      if (site.isOwner(loginUser)) {
        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() == log.getCatalogId()) {
            catalog_can_access = true;
            break;
          }
        }
      }
      if (!catalog_can_access) {
        msgs.add("log", new ActionMessage("error.catalog_deny",
            new Integer(log.getCatalogId())));
        break;
      }
      // ��ȡ�����²ݸ����Ȼ���״̬��Ϊ����
      journal.setClient(new ClientInfo(request, log.getClientType()));
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    DiaryForm log = (DiaryForm) form;
    //super.validateClientId(request, log);
    while (true) {
      // ����ռDZ����ֵ
      if (StringUtils.isEmpty(log.getTitle())) {
        msgs.add("title", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if (StringUtils.isEmpty(log.getContent())) {
        msgs.add("content",
            new ActionMessage("error.empty_not_allowed"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if (loginUser == null) {
        msgs.add("log", new ActionMessage("error.user_not_login"));
        break;
      }
      if (loginUser.getStatus() != UserBean.STATUS_NORMAL) {
        msgs.add("log", new ActionMessage("error.user_not_available"));
        break;
      }
      SiteBean site = super.getSiteByID(log.getSid());
      if (site == null) {
        msgs.add("log", new ActionMessage("error.site_not_available"));
        break;
      }
      boolean catalog_can_access = false;
      CatalogBean catalog = null;
      // վ�����Է���վ�ڵ��κη���
      if (site.isOwner(loginUser)) {
        catalog = CatalogDAO.getCatalogByID(log.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() == log.getCatalogId()) {
            catalog = t_catalog;
            catalog_can_access = true;
            break;
          }
        }
      }
      if (!catalog_can_access) {
        msgs.add("log", new ActionMessage("error.catalog_deny",
            new Integer(log.getCatalogId())));
        break;
      }
      // �û����������ռǷ��౻����
      DiaryBean journal = DiaryDAO.getDiaryByID(log.getId());
      if (journal == null
          || journal.getStatus() != DiaryBean.STATUS_DRAFT) {
        msgs.add("draft", new ActionMessage("error.draft_not_exists"));
        break;
      }
      // ��鱳�������Ƿ���Ч
      MusicBean song = MusicDAO.getMusicByID(log.getBgSound());
      if (song != null && song.getSite().getId() == site.getId()) {
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    DiaryForm log = (DiaryForm) form;
    //super.validateClientId(request, log);
    UserBean loginUser = super.getLoginUser(request, response);
    while (true) {
      if (loginUser == null) {
        msgs.add("log", new ActionMessage("error.user_not_login"));
        break;
      }
      if (loginUser.getStatus() != UserBean.STATUS_NORMAL) {
        msgs.add("log", new ActionMessage("error.user_not_available"));
        break;
      }
     
      SiteBean site = super.getSiteByID(log.getSid());
      if (site == null) {
        msgs.add("log", new ActionMessage("error.site_not_available"));
        break;
      }
      boolean catalog_can_access = false;
      CatalogBean catalog = null;
      // վ�����Է���վ�ڵ��κη���
      if (site.isOwner(loginUser)) {
        catalog = CatalogDAO.getCatalogByID(log.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() == log.getCatalogId()
              && t_catalog.getSite().getId() == site.getId()) {
            catalog = t_catalog;
            catalog_can_access = true;
            break;
          }
        }
      }
      //�û����������ռǷ��಻������
      if(!catalog_can_access){
        msgs.add("log", new ActionMessage("error.catalog_deny",
            new Integer(log.getCatalogId())));
        break;
      }
      // ����ռDZ����ֵ
      if (StringUtils.isEmpty(log.getTitle())){
        msgs.add("title", new ActionMessage(
            "error.empty_not_allowed"));
        break;
      }
      if (StringUtils.isEmpty(log.getContent())){
        msgs.add("content", new ActionMessage(
            "error.empty_not_allowed"));
        break;
      }
      if (StringUtils.isEmpty(log.getWeather()))
        log.setWeather(DEFAULT_WEATHER);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.