Package com.jeecms.cms.entity.main

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


  @SuppressWarnings("unchecked")
  public void execute(Environment env, Map params, TemplateModel[] loopVars,
      TemplateDirectiveBody body) throws TemplateException, IOException {
    CmsSite site = FrontUtils.getSite(env);
    Integer id = DirectiveUtils.getInt(PARAM_ID, params);
    Channel channel;
    if (id != null) {
      channel = channelMng.findById(id);
    } else {
      String path = DirectiveUtils.getString(PARAM_PATH, params);
      if (StringUtils.isBlank(path)) {
View Full Code Here


  public String channel(String path, int pageNo, String[] params,
      PageInfo info, HttpServletRequest request,
      HttpServletResponse response, ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    Channel channel = channelMng.findByPathForTag(path, site.getId());
    if (channel == null) {
      log.debug("Channel path not found: {}", path);
      return FrontUtils.pageNotFound(request, response, model);
    }

    model.addAttribute("channel", channel);
    FrontUtils.frontData(request, model, site);
    FrontUtils.frontPageData(request, model);
    return channel.getTplChannelOrDef();
  }
View Full Code Here

    f.append(" order by bean.priority asc,bean.id asc");
    return find(f);
  }

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

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

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

    return StringUtils.split(nameStr, ',');
  }

  protected Integer[] getChannelIdsByPaths(String[] paths, Integer siteId) {
    Set<Integer> set = new HashSet<Integer>();
    Channel channel;
    for (String path : paths) {
      channel = channelMng.findByPathForTag(path, siteId);
      if (channel != null) {
        set.add(channel.getId());
      }
    }
    if (set.size() > 0) {
      return set.toArray(new Integer[set.size()]);
    } else {
View Full Code Here

    String[] paths = getChannelPaths(params);
    if (paths == null) {
      return null;
    }
    Set<Integer> set = new HashSet<Integer>();
    Channel channel;
    if (siteIds == null) {
      List<CmsSite> list = cmsSiteMng.getListFromCache();
      siteIds = new Integer[list.size()];
      int i = 0;
      for (CmsSite site : list) {
        siteIds[i++] = site.getId();
      }
    }
    for (Integer siteId : siteIds) {
      for (String path : paths) {
        channel = channelMng.findByPathForTag(path, siteId);
        if (channel != null) {
          set.add(channel.getId());
        }
      }
    }
    if (set.size() > 0) {
      return set.toArray(new Integer[set.size()]);
View Full Code Here

        tpl = FrontUtils.getTplPath(request, site.getSolutionPath(),
            TPLDIR_TOPIC, TOPIC_DEFAULT);
      }
      return tpl;
    } else if (channelId != null) {
      Channel channel = channelMng.findById(channelId);
      if (channel != null) {
        model.addAttribute("channel", channel);
      } else {
        return FrontUtils.pageNotFound(request, response, model);
      }
View Full Code Here

    doc.add(new Field(SITE_ID, c.getSite().getId().toString(),
        Field.Store.NO, Field.Index.NOT_ANALYZED));
    doc.add(new Field(RELEASE_DATE, DateTools.dateToString(c
        .getReleaseDate(), Resolution.DAY), Field.Store.NO,
        Field.Index.NOT_ANALYZED));
    Channel channel = c.getChannel();
    while (channel != null) {
      doc.add(new Field(CHANNEL_ID_ARRAY, channel.getId().toString(),
          Field.Store.NO, Field.Index.NOT_ANALYZED));
      channel = channel.getParent();
    }
    doc.add(new Field(TITLE, c.getTitle(), Field.Store.NO,
        Field.Index.ANALYZED));
    if (!StringUtils.isBlank(c.getTxt())) {
      doc.add(new Field(CONTENT, c.getTxt(), Field.Store.NO,
View Full Code Here

    return false;
  }

  private boolean vldChannel(WebErrors errors, CmsSite site, CmsUser user,
      Integer channelId) {
    Channel channel = channelMng.findById(channelId);
    if (errors.ifNotExist(channel, Channel.class, channelId)) {
      return true;
    }
    if (!channel.getSite().getId().equals(site.getId())) {
      errors.notInSite(Channel.class, channelId);
      return true;
    }
    if (!channel.getContriGroups().contains(user.getGroup())) {
      errors.noPermission(Channel.class, channelId);
      return true;
    }
    return false;
  }
View Full Code Here

  @Transactional(readOnly = true)
  public void contentRelated(Content content) throws IOException,
      TemplateException {
    content(content);
    Channel channel = content.getChannel();
    while (channel != null) {
      channel(channel, true);
      channel = channel.getParent();
    }
    if (content.getSite().getStaticIndex()) {
      index(content.getSite());
    }
  }
View Full Code Here

TOP

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

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.