Package com.jeecms.cms.entity.main

Examples of com.jeecms.cms.entity.main.Content


  @SuppressWarnings("unchecked")
  public void execute(Environment env, Map params, TemplateModel[] loopVars,
      TemplateDirectiveBody body) throws TemplateException, IOException {
    Integer id = getId(params);
    Boolean next = DirectiveUtils.getBool(PRAMA_NEXT, params);
    Content content;
    if (next == null) {
      content = contentMng.findById(id);
    } else {
      CmsSite site = FrontUtils.getSite(env);
      Integer channelId = DirectiveUtils.getInt(PARAM_CHANNEL_ID, params);
View Full Code Here


    }
    Session session = getSession();
    ScrollableResults contents = f.createQuery(getSession()).setCacheMode(
        CacheMode.IGNORE).scroll(ScrollMode.FORWARD_ONLY);
    int count = 0;
    Content content = null;
    while (contents.next()) {
      content = (Content) contents.get(0);
      writer.addDocument(LuceneContent.createDocument(content));
      if (++count % 20 == 0) {
        session.clear();
      }
    }
    if (count < max || content == null) {
      // 实际数量小于指定数量,代表生成结束。如果没有任何数据,也代表生成结束。
      return null;
    } else {
      // 返回最后一个ID
      return content.getId();
    }

  }
View Full Code Here

        log.warn("", e);
        ResponseUtils.renderJson(response, json.toString());
        return;
      }
    }
    Content content = contentMng.findById(contentId);
    if (content == null) {
      // 内容不存在
      json.put("success", false);
      json.put("status", 2);
    } else if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_OFF) {
      // 评论关闭
      json.put("success", false);
      json.put("status", 3);
    } else if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_LOGIN
        && user == null) {
      // 需要登录才能评论
      json.put("success", false);
      json.put("status", 4);
    } else {
View Full Code Here

  private boolean exist(Integer id) {
    if (id == null) {
      return false;
    }
    Content content = contentMng.findById(id);
    return content != null;
  }
View Full Code Here

    String code = config.getDownloadCode();
    int h = config.getDownloadTime() * 60 * 60 * 1000;
    if (pwdEncoder.isPasswordValid(k, cid + ";" + i + ";" + t, code)) {
      long curr = System.currentTimeMillis();
      if (t + h > curr) {
        Content c = contentMng.findById(cid);
        if (c != null) {
          List<ContentAttachment> list = c.getAttachments();
          if (list.size() > i) {
            contentCountMng.downloadCount(c.getId());
            ContentAttachment ca = list.get(i);
            response.sendRedirect(ca.getPath());
            return;
          } else {
            log.info("download index is out of range: {}", i);
View Full Code Here

        if (end == -1) {
          return handerResult(temp, history, title,
              AcquisitionResultType.CONTENTENDNOTFOUND);
        }
        String txt = html.substring(start, end);
        Content content = cmsAcquisitionMng.saveContent(title, txt,
            acquId, AcquisitionResultType.SUCCESS, temp, history);
        cmsAcquisitionTempMng.save(temp);
        cmsAcquisitionHistoryMng.save(history);
        return content;
      } catch (Exception e) {
View Full Code Here

  }

  public String content(Integer id, int pageNo, String[] params,
      PageInfo info, HttpServletRequest request,
      HttpServletResponse response, ModelMap model) {
    Content content = contentMng.findById(id);
    if (content == null) {
      log.debug("Content id not found: {}", id);
      return FrontUtils.pageNotFound(request, response, model);
    }
    CmsUser user = CmsUtils.getUser(request);
    CmsSite site = content.getSite();
    Set<CmsGroup> groups = content.getViewGroupsExt();
    int len = groups.size();
    // 需要浏览权限
    if (len != 0) {
      // 没有登录
      if (user == null) {
        return FrontUtils.showLogin(request, model, site);
      }
      // 已经登录但没有权限
      Integer gid = user.getGroup().getId();
      boolean right = false;
      for (CmsGroup group : groups) {
        if (group.getId().equals(gid)) {
          right = true;
          break;
        }
      }
      if (!right) {
        String gname = user.getGroup().getName();
        return FrontUtils.showMessage(request, model, GROUP_FORBIDDEN,
            gname);
      }
    }
    String txt = content.getTxtByNo(pageNo);
    // 内容加上关键字
    txt = cmsKeywordMng.attachKeyword(site.getId(), txt);
    Paginable pagination = new SimplePage(pageNo, 1, content.getPageCount());
    model.addAttribute("pagination", pagination);
    FrontUtils.frontPageData(request, model);
    model.addAttribute("content", content);
    model.addAttribute("channel", content.getChannel());
    model.addAttribute("title", content.getTitleByNo(pageNo));
    model.addAttribute("txt", txt);
    model.addAttribute("pic", content.getPictureByNo(pageNo));
    FrontUtils.frontData(request, model, site);
    return content.getTplContentOrDef();
  }
View Full Code Here

  @RequestMapping(value = "/comment*.jspx", method = RequestMethod.GET)
  public String page(Integer contentId, Integer pageNo,
      HttpServletRequest request, HttpServletResponse response,
      ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    Content content = contentMng.findById(contentId);
    if (content == null) {
      return FrontUtils.showMessage(request, model,
          "comment.contentNotFound");
    }
    if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_OFF) {
      return FrontUtils.showMessage(request, model, "comment.closed");
    }
    // 将request中所有参数保存至model中。
    model.putAll(RequestUtils.getQueryParams(request));
    FrontUtils.frontData(request, model, site);
View Full Code Here

    query.setParameter("parentId", channelId);
    return ((Number) (query.iterate().next())).intValue();
  }

  public Content findById(Integer id) {
    Content entity = get(id);
    return entity;
  }
View Full Code Here

    getSession().save(bean);
    return bean;
  }

  public Content deleteById(Integer id) {
    Content entity = super.get(id);
    if (entity != null) {
      getSession().delete(entity);
    }
    return entity;
  }
View Full Code Here

TOP

Related Classes of com.jeecms.cms.entity.main.Content

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.