Package com.jeecms.common.hibernate3

Examples of com.jeecms.common.hibernate3.HibernateSimpleDao


    f.setParam("siteId", siteId);
    return (Long) find(f).iterator().next();
  }

  private int getTotalCount(String hql, Integer siteId) {
    Finder f = createCacheableFinder(hql);
    f.setParam("siteId", siteId);
    return find(f).size();
  }
View Full Code Here


    }
    return (Long) find(f).iterator().next();
  }

  private Finder createCacheableFinder(String hql) {
    Finder finder = Finder.create(hql);
    finder.setCacheable(true);
    return finder;
  }
View Full Code Here

    implements ContentDao {
  public Pagination getPage(String title, Integer typeId,
      Integer inputUserId, boolean topLevel, boolean recommend,
      ContentStatus status, Byte checkStep, Integer siteId,
      Integer channelId, int orderBy, int pageNo, int pageSize) {
    Finder f = Finder.create("select bean from Content bean");
    if (prepared == status || passed == status || rejected == status) {
      f.append(" join bean.contentCheckSet check");
    }
    if (channelId != null) {
      f.append(" join bean.channel channel,Channel parent");
      f.append(" where channel.lft between parent.lft and parent.rgt");
      f.append(" and channel.site.id=parent.site.id");
      f.append(" and parent.id=:parentId");
      f.setParam("parentId", channelId);
    } else if (siteId != null) {
      f.append(" where bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    } else {
      f.append(" where 1=1");
    }
    if (prepared == status) {
      f.append(" and check.checkStep<:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (passed == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (rejected == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=true");
      f.setParam("checkStep", checkStep);
    }
    appendQuery(f, title, typeId, inputUserId, status, topLevel, recommend);
    if (prepared == status) {
      f.append(" order by check.checkStep desc,bean.id desc");
    } else {
      appendOrder(f, orderBy);
    }
    return find(f, pageNo, pageSize);
  }
View Full Code Here

    }
    return find(f, pageNo, pageSize);
  }
 
  public Pagination getPageForCollection(Integer siteId, Integer memberId, int pageNo, int pageSize){
    Finder f = Finder.create("select bean from Content bean join bean.collectUsers user where user.id=:userId").setParam("userId", memberId);
    if (siteId != null) {
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    }
    f.append(" and bean.status<>:status");
    f.setParam("status", ContentCheck.RECYCLE);
    return find(f, pageNo, pageSize);
  }
View Full Code Here

  public Pagination getPageBySelf(String title, Integer typeId,
      Integer inputUserId, boolean topLevel, boolean recommend,
      ContentStatus status, Byte checkStep, Integer siteId,
      Integer channelId, Integer userId, int orderBy, int pageNo,
      int pageSize) {
    Finder f = Finder.create("select bean from Content bean");
    if (prepared == status || passed == status || rejected == status) {
      f.append(" join bean.contentCheckSet check");
    }
    if (channelId != null) {
      f.append(" join bean.channel channel,Channel parent");
      f.append(" where channel.lft between parent.lft and parent.rgt");
      f.append(" and channel.site.id=parent.site.id");
      f.append(" and parent.id=:parentId");
      f.setParam("parentId", channelId);
    } else if (siteId != null) {
      f.append(" where bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    } else {
      f.append(" where 1=1");
    }
    f.append(" and bean.user.id=:userId");
    f.setParam("userId", userId);
    if (prepared == status) {
      f.append(" and check.checkStep<:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (passed == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (rejected == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=true");
      f.setParam("checkStep", checkStep);
    }
    appendQuery(f, title, typeId, inputUserId, status, topLevel, recommend);
    if (prepared == status) {
      f.append(" order by check.checkStep desc,bean.id desc");
    } else {
      appendOrder(f, orderBy);
    }
    return find(f, pageNo, pageSize);
  }
View Full Code Here

  public Pagination getPageByRight(String title, Integer typeId,
      Integer inputUserId, boolean topLevel, boolean recommend,
      ContentStatus status, Byte checkStep, Integer siteId,
      Integer channelId, Integer userId, boolean selfData, int orderBy,
      int pageNo, int pageSize) {
    Finder f = Finder.create("select bean from Content bean");
    if (prepared == status || passed == status || rejected == status) {
      f.append(" join bean.contentCheckSet check");
    }
    f.append(" join bean.channel channel join channel.users user");
    if (channelId != null) {
      f.append(",Channel parent");
      f.append(" where channel.lft between parent.lft and parent.rgt");
      f.append(" and channel.site.id=parent.site.id");
      f.append(" and parent.id=:parentId");
      f.setParam("parentId", channelId);
      f.append(" and user.id=:userId");
      f.setParam("userId", userId);
    } else if (siteId != null) {
      f.append(" where user.id=:userId");
      f.setParam("userId", userId);
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    } else {
      f.append(" where user.id=:userId");
      f.setParam("userId", userId);
    }
    if (selfData) {
      // userId前面已赋值
      f.append(" and bean.user.id=:userId");
    }
    if (prepared == status) {
      f.append(" and check.checkStep<:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (passed == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=false");
      f.setParam("checkStep", checkStep);
    } else if (rejected == status) {
      f.append(" and check.checkStep=:checkStep");
      f.append(" and check.rejected=true");
      f.setParam("checkStep", checkStep);
    }
    appendQuery(f, title, typeId, inputUserId, status, topLevel, recommend);
    if (prepared == status) {
      f.append(" order by check.checkStep desc,bean.id desc");
    } else {
      appendOrder(f, orderBy);
    }
    return find(f, pageNo, pageSize);
  }
View Full Code Here

public class StaticPageDaoImpl extends HibernateSimpleDao implements
    StaticPageDao {
  public int channelStatic(Integer siteId, Integer channelId,
      boolean containChild, Configuration conf, Map<String, Object> data)
      throws IOException, TemplateException {
    Finder finder = Finder.create("select bean from Channel bean");
    if (channelId != null) {
      if (containChild) {
        finder.append(",Channel parent where").append(
            " bean.lft between parent.lft and parent.rgt").append(
            " and parent.site.id=bean.site.id").append(
            " and parent.id=:channelId");
        finder.setParam("channelId", channelId);
      } else {
        finder.append(" where bean.id=:channelId");
        finder.setParam("channelId", channelId);
      }
    } else if (siteId != null) {
      finder.append(" where bean.site.id=:siteId");
      finder.setParam("siteId", siteId);
    }
    Session session = getSession();
    ScrollableResults channels = finder.createQuery(session).setCacheMode(
        CacheMode.IGNORE).scroll(ScrollMode.FORWARD_ONLY);
    int count = 0;
    CmsSite site;
    Channel c;
    PageInfo info;
View Full Code Here

  }

  public int contentStatic(Integer siteId, Integer channelId, Date start,
      Configuration conf, Map<String, Object> data) throws IOException,
      TemplateException {
    Finder f = Finder.create("select bean from Content bean");
    if (channelId != null) {
      f.append(" join bean.channel node,Channel parent");
      f.append(" where node.lft between parent.lft and parent.rgt");
      f.append(" and parent.id=:channelId");
      f.append(" and node.site.id=parent.site.id");
      f.setParam("channelId", channelId);
    } else if (siteId != null) {
      f.append(" where bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    } else {
      f.append(" where 1=1");
    }
    if (start != null) {
      f.append(" and bean.sortDate>=:start");
      f.setParam("start", start);
    }
    f.append(" and bean.status=" + ContentCheck.CHECKED);
    Session session = getSession();
    ScrollableResults contents = f.createQuery(session).setCacheMode(
        CacheMode.IGNORE).scroll(ScrollMode.FORWARD_ONLY);
    int count = 0;
    int totalPage;
    String url, real;
    File file, parent;
View Full Code Here

@Repository
public class CmsFileDaoImpl extends HibernateBaseDao<CmsFile, Integer>
    implements CmsFileDao {
  @SuppressWarnings("unchecked")
  public List<CmsFile> getList(Boolean valid) {
    Finder f = Finder.create("from CmsFile bean where 1=1");
    if(valid!=null){
      if(valid){
        f.append(" and bean.fileIsvalid=true");
      }else{
        f.append(" and bean.fileIsvalid=false");
      }
    }
    f.append(" order by bean.id desc");
    return find(f);
  }
View Full Code Here

    f.append(" order by bean.id desc");
    return find(f);
  }
 
  public CmsFile findByPath(String path){
    Finder f = Finder.create("from CmsFile bean where bean.filePath  like '%"+path+"%'");
    List li=find(f);
    if(li!=null&&li.size()>0){
      return (CmsFile) li.get(0);
    }else{
      return null;
View Full Code Here

TOP

Related Classes of com.jeecms.common.hibernate3.HibernateSimpleDao

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.