Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.SiteBean$Flag


      }
      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()))
        log.setWeather(DEFAULT_WEATHER);
      if (StringUtils.isEmpty(log.getAuthor()))
        log.setAuthor(loginUser.getNickname());
      if (StringUtils.isEmpty(log.getTags()))
        log.setTags(null);
      if (StringUtils.isEmpty(log.getAuthorUrl()))
        log.setAuthorUrl(null);
      if (StringUtils.isEmpty(log.getRefUrl()))
        log.setRefUrl(null);
      // ����JournalBean
      DiaryBean journal = new DiaryBean();
      journal.setOwner(loginUser);
      journal.setSite(site);
      journal.setAuthor(super.autoFiltrate(site, log.getAuthor()));
      journal.setAuthorUrl(log.getAuthorUrl());
      journal.setCatalog(catalog);
      journal.setClient(new ClientInfo(request, log.getClientType()));
      // ������վ�İ�ȫ��־�����Ƿ�����ݽ��������ִʹ���

      String ssn_id = RequestUtils.getDlogSessionId(request);
      boolean wml = WML_IDENTITY.equalsIgnoreCase(identity);
      String content = autoCompileContent(request, site, log.getContent(), loginUser.getId(), ssn_id, wml);
      journal.setContent(content);
      journal.setSize(content.getBytes().length);
      journal.setTitle(super.autoFiltrate(site, log.getTitle()));
      journal.setKeyword(super.autoFiltrate(site, log.getTags()));
     
      journal.setMoodLevel(log.getMoodLevel());
      journal.setRefUrl(log.getRefUrl());
      journal.setReplyNotify(log.getNotify());
      journal.setStatus(DiaryBean.STATUS_NORMAL);
      journal.setWeather(log.getWeather());
      journal.setWriteTime(DateUtils.mergeDateTime(log.getWriteDate(), log.getWriteTime()).getTime());
      Date curTime = new Date();
      if(journal.getWriteTime().after(curTime))
        journal.setWriteTime(curTime);
      // ��鱳�������Ƿ���Ч
      MusicBean song = MusicDAO.getMusicByID(log.getBgSound());
      if (song != null && song.getSite().getId() == site.getId()) {
        journal.setBgSound(song);
      }
      DiaryDAO.create(journal, log.getBookmark() == 1);
      // �����ϴ�����Ϣ
      pickupUploadFileItems(request, response, loginUser.getId(), site, journal
View Full Code Here


      }
      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++) {
View Full Code Here

      }
      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()) {
        journal.setBgSound(song);
      }
      if (StringUtils.isEmpty(log.getWeather()))
        journal.setWeather(DEFAULT_WEATHER);
      else
View Full Code Here

      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;
          }
        }
View Full Code Here

    if(loginUser!=null){
      BookmarkBean bean = new BookmarkBean();
      bean.setParentId(bookmark.getParentId());
      bean.setParentType(bookmark.getParentType());
      bean.setOwner(loginUser);
      bean.setSite(new SiteBean(bookmark.getSid()));
      bean.setTitle(bookmark.getTitle());
      try{
        if(BookmarkDAO.save(bean))
          msg = getMessage(request,null,"bookmark.created");
        else
View Full Code Here

    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    while (StringUtils.isNotEmpty(sform.getFriendlyName())) {
      SiteBean site = super.getSiteBean(request);
      String fn = super.autoFiltrate(site, sform.getFriendlyName());
      if(!StringUtils.equals(site.getFriendlyName(), fn)){
        //�����վ���Ƿ��Ѿ�����
        if(SiteDAO.getSiteByFriendlyName(fn) != null){
          msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_exists"));
          break;
        }
        try {
          site.setFriendlyName(fn);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
View Full Code Here

    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    do{
      SiteBean site = super.getSiteBean(request);
      String detail = super.autoFiltrate(site, StringUtils.extractText(sform.getDetail()));
      if(!StringUtils.equals(site.getDetail(), detail)){
        try {
          site.setDetail(detail);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
View Full Code Here

    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    do{
      SiteBean site = super.getSiteBean(request);
      String title = super.autoFiltrate(site, sform.getTitle());
      if(!StringUtils.equals(site.getTitle(), title)){
        try {
          site.setTitle(title);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
View Full Code Here

      if(StringUtils.isEmpty(friendlyName)){
        msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_empty"));
        break;
      }
      //�ж���վ���Ƿ����
      SiteBean site = super.getSiteBean(request);
      if (!StringUtils.equals(site.getFriendlyName(), friendlyName)
          && SiteDAO.getSiteByFriendlyName(friendlyName) != null) {       
        msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_exists"));
        break;
      }
      if(site!=null){
        if(StringUtils.isNotEmpty(f_site.getDetail())){
          String dt = super.autoFiltrate(site, StringUtils.extractText(f_site.getDetail()));
          site.setDetail(StringUtils.abbreviate(dt,250));
        }
        else
          site.setDetail(null);
       
        if(!StringUtils.equals(site.getFriendlyName(), friendlyName))
          site.setFriendlyName(friendlyName);
       
        if(StringUtils.isNotEmpty(f_site.getIcpNumber())){
          site.setIcpNumber(DLOGSecurityManager.IllegalGlossary
              .deleteIllegalWord(f_site.getIcpNumber()));
        }
        else
          site.setIcpNumber(null);
        site.setLastTime(new Date());
        if(StringUtils.isNotEmpty(f_site.getTitle()))
          site.setTitle(super.autoFiltrate(site, f_site.getTitle()));
        else
          site.setTitle(site.getFriendlyName());
       
        if(StringUtils.isNotEmpty(f_site.getUrl()))
          if(f_site.getUrl().toLowerCase().startsWith("http://"))
            site.setUrl(f_site.getUrl().substring(7));
          else
            site.setUrl(f_site.getUrl());
        else
          site.setUrl(null);
       
        try{
          SiteDAO.updateSite(site);
          msgs.add("site", new ActionMessage("site.updated"));
        }catch(Exception e){
View Full Code Here

   * ��ȡ��Ч��site
   * @param site_id
   * @return
   */
  protected static SiteBean getSiteByID(int site_id){
    SiteBean site = SiteDAO.getSiteByID(site_id);
    if (site == null || site.getStatus() < SiteBean.STATUS_NORMAL)
      return null;
    return site;
  }
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.beans.SiteBean$Flag

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.