Package org.j2cms.model.channel

Examples of org.j2cms.model.channel.Channel


    orderbyRankid.put("rankid", "asc");//正序
    orderbyVisitTotal.put("visitTotal", "desc");
    orderbyCommentCount.put("commentCount", "desc");
    try {
      flashs=flashService.getScrollData(0, 5,"o.checkState=?1",new Object[]{CheckState.pass}, orderby).getResultlist();
      channelsDisplay=channelService.getScrollData(-1,-1, "o.father=?1 and o.display=true",new Object[]{new Channel(1)},orderbyRankid).getResultlist();
      latestArticles=articleService.getScrollData(0, 8,"o.checkState=?1",new Object[]{CheckState.pass},orderby).getResultlist();
      mostVisitArticles=articleService.getScrollData(0, 10,"o.checkState=?1",new Object[]{CheckState.pass},orderbyVisitTotal).getResultlist();
      mostCommentArticles=articleService.getScrollData(0, 10,"o.checkState=?1",new Object[]{CheckState.pass},orderbyCommentCount).getResultlist();
      channelInIndexs=channelService.getScrollData(0,-1, "o.displayInIndex=true",null,orderbyRankid).getResultlist();       
//      List<?> channelArticles[] = new ArrayList<?>[channelInIndexs.size()];     
View Full Code Here


    orderbyRankid.put("rankid", "asc");//正序
    orderbyVisitTotal.put("visitTotal", "desc");
    orderbyCommentCount.put("commentCount", "desc");
    try {
      flashs=flashService.getScrollData(0, 5,"o.checkState=?1",new Object[]{CheckState.pass}, orderby).getResultlist();
      channelsDisplay=channelService.getScrollData(-1,-1, "o.father=?1 and o.display=true",new Object[]{new Channel(1)},orderbyRankid).getResultlist();
      latestArticles=articleService.getScrollData(0, 8,"o.checkState=?1",new Object[]{CheckState.pass},orderby).getResultlist();
      mostVisitArticles=articleService.getScrollData(0, 10,"o.checkState=?1",new Object[]{CheckState.pass},orderbyVisitTotal).getResultlist();
      mostCommentArticles=articleService.getScrollData(0, 10,"o.checkState=?1",new Object[]{CheckState.pass},orderbyCommentCount).getResultlist();
      channelInIndexs=channelService.getScrollData(0,100, "o.displayInIndex=true",null,orderbyRankid).getResultlist()
View Full Code Here

    Integer id = WebUtil.StrToInt(Struts2Utils.getParameter("id"));//channel 
    String ctp = (String)(Struts2Utils.getRequest().getContextPath());//ctp 

    String title = Struts2Utils.getParameter("title");
    int page =WebUtil.StrToInt(Struts2Utils.getParameter("page"));//channel.ftl传递过来的page的值 
    Channel channel = entityService.find(id);
    Struts2Utils.setAttribute("entity", channel);
    Struts2Utils.setAttribute("title", title);
   
    Map <String,Object>map  = new HashMap<String,Object>();
    String channelFTL = "channel.html";
    String singleFTL="single.html";
    String relaPath ="";
    String htmlName = id+".html";
    map.put("entity", channel);
    map.put("title", title);
   
    try{
      channel.setVisitTotal(channel.getVisitTotal()+1);//点击量加1
    }catch(Exception e){
      return "errorPage";
    }
    if(channel.getCheckState()==CheckState.pass)
    {
      if(channel.getSingle()!=null&&channel.getSingle()==true){
       
        try {
          new CreateHtml().init(singleFTL, htmlName, map, relaPath);//生成静态HTML
        } catch (IOException e) {
          e.printStackTrace();
        } catch (TemplateException e) {
          e.printStackTrace();
        }
      }
      else{
        PageView<Article> pageView = new PageView<Article>(1);
        if(page!=0){
          pageView.setCurrentpage(page);
          relaPath="Channel/";
          htmlName=id+"_"+page+".html";//有页码的HTML的名称
          }
        int firstindex = (pageView.getCurrentpage()-1)*pageView.getMaxresult();
        LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
        orderby.put("id", "desc");     
        StringBuffer jpql = new StringBuffer("o.checkState=?1");
        List<Object> params = new ArrayList<Object>();
        params.add(CheckState.pass);
        if(id!=null&&id!=1){
          if(params.size()>0) jpql.append(" and ");
          jpql.append(" o.channel=?").append((params.size()+1));
          params.add(new Channel(id));
        }
        if(title!=null && !"".equals(title)){
          if(params.size()>0) jpql.append(" and ");
          jpql.append(" o.title like ?").append((params.size()+1));
          params.add("%"+ title+ "%");
View Full Code Here

      }
      return ERROR;
  }
 
  public String makeSingleChannelToHtml(int id){
    Channel entity = entityService.find(id);
    CreateHtml creatHtml = new CreateHtml();
    Map <String,Object>map  = new HashMap<String,Object>();
    String channelFTL = "channel.html";
    String singleFTL="single.html";
    String relaPath ="";
    String htmlName = id+".html";
    map.put("entity", entity);

    if(entity.getSingle()!=null&&entity.getSingle()==true){
      try {
        creatHtml.init(singleFTL, htmlName, map, relaPath);//生成静态HTML
      } catch (IOException e) {
        e.printStackTrace();
      } catch (TemplateException e) {
        e.printStackTrace();
      }
      return "succ";
    }
    else{
      PageView<Article> pageView = new PageView<Article>(1);
     
      int firstindex = (pageView.getCurrentpage()-1)*pageView.getMaxresult();
      LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
      List<Object> params = new ArrayList<Object>();
      QueryResult<Article> qr ;
     
      orderby.put("id", "desc");
     
      StringBuffer jpql = new StringBuffer("o.checkState=?1");
      params.add(CheckState.pass);
      if(id!=0&&id!=1){
        if(params.size()>0) jpql.append(" and ");
        jpql.append(" o.channel=?").append((params.size()+1));
        params.add(new Channel(id));
      }
      qr=articleService.getScrollData(firstindex, pageView.getMaxresult(),jpql.toString(), params.toArray(), orderby);
      pageView.setQueryResult(qr);
      try {
        map.put("pageView", pageView);
View Full Code Here

      article.setContent("<p>&nbsp;&nbsp;J2CMS是一款JAVAEE平台的开源内容管理系统.继承java强大、稳定、安全、高效、跨平台等多方面的优点,结合mysql数据库开发. 懂html就能建站,提供最便利、合理的使用方式.<br />");
      article.setAuthor("郭涛");
      article.setOrigin("本站");
      article.setUser(new User(1));
      article.setGroup(new Group(5));
      article.setChannel(new Channel(7));
      article.setReleaseDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
      article.setCommentCount(200+i);
      article.setVisitTotal(100+i);
      article.setCheckState(CheckState.pass);     
         
View Full Code Here

  public void list2(){
//    int page =Integer.parseInt(Struts2Utils.getParameter("page"));
//    int id = Integer.parseInt(Struts2Utils.getParameter("id"));
    int page =1;
    Integer id=1;
    Channel channel = new Channel(id);
   
    PageView<Article> pageView = new PageView<Article>(15,page);
    int firstindex = (pageView.getCurrentpage()-1)*pageView.getMaxresult();
    LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
    orderby.put("id", "desc");
    QueryResult<Article> qr =articleService.getScrollData(
        firstindex, pageView.getMaxresult(),"o.checkState=?1 and o.channel=?2 and o.author=?3", new Object[]{CheckState.pass,new Channel(id),'%'}, orderby);
//        firstindex, pageView.getMaxresult(),"o.checkState=?1 and o.channel=?2 ", new Object[]{CheckState.已审核,new Channel(id)}, orderby);
    pageView.setQueryResult(qr);

//    Struts2Utils.setAttribute("channel", channel);
//    Struts2Utils.setAttribute("pageView", pageView);   
//    return "list";
    System.out.println(channel.getId());
   
    for(Article article:pageView.getRecords()){
      System.out.println(article.getTitle());
    }
  }
View Full Code Here

      e.printStackTrace();
    }
  }
  @Test public void save(){
    for (int i =12;i<21;i++){
    Channel channel = new Channel();
    channel.setName("栏目"+i);
    channel.setInfo("栏目说明"+i);
    channel.setFather(new Channel(i-1));
    channel.setRankid(0);
    channelService.save(channel);
    }
  }
View Full Code Here

    channel.setRankid(0);
    channelService.save(channel);
    }
  }
  @Test public void finds(){
    List<Channel> channels = (List<Channel>) channelService.getScrollData(0, 10, "o.father=?1",new Object[]{new Channel(1)});
    System.out.println();
   
  }
View Full Code Here

TOP

Related Classes of org.j2cms.model.channel.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.