Package com.dotmarketing.db

Examples of com.dotmarketing.db.HibernateUtil


   *
   * @return If the inode has children return true, false otherwise
   */
  public boolean hasParents() {

    HibernateUtil dh = new HibernateUtil();
    String query = "select count(*) from " + Inode.class.getName()
        + "  inode where inode.inode in (select tree.parent from "
        + Tree.class.getName() + "  tree where tree.child = "
        + this.inode + ")";
    List results = new ArrayList();
    try {
      dh.setQuery(query);
      results = dh.list();
    } catch (DotHibernateException e) {
      Logger.error(this.getClass(), e.getMessage(), e);
    }
    return ((Integer) results.get(0)).intValue() > 0;
  }
View Full Code Here


import com.liferay.portal.model.User;

public class UserFilterFactory {

  public static java.util.List getAllUserFilter() {
    HibernateUtil dh = new HibernateUtil(UserFilter.class);
    List<UserFilter> list =null;
    try {
      dh.setQuery("from inode in class com.dotmarketing.portlets.userfilter.model.UserFilter order by title");
      list = dh.list();
    } catch (DotHibernateException e) {
      Logger.error(UserFilterFactory.class, "getAllUserFilter failed:" + e, e);
    }
    return list;
  }
View Full Code Here

    }
    return list;
  }
 
  public static java.util.List getAllUserFilterByUser(User user) {
    HibernateUtil dh = new HibernateUtil(UserFilter.class);
    List<UserFilter> list =null;
    try {
      dh.setSQLQuery("select user_filter.* from user_filter user_filter, inode inode where user_filter.inode=inode.inode and inode.owner=? order by title");
      dh.setParam(user.getUserId());
      list = dh.list();
    } catch (DotHibernateException e) {
      Logger.error(UserFilterFactory.class, "getAllUserFilterByUser failed:" + e, e);
    }
    return list;
  }
View Full Code Here

    }
    return list;
  }
 
  public static java.util.List getUserFilterByTitle(String title) {
    HibernateUtil dh = new HibernateUtil(UserFilter.class);
    List<UserFilter> list =null;
    try {
      dh.setQuery("from inode in class com.dotmarketing.portlets.userfilter.model.UserFilter where lower(title) like ? order by title");
      dh.setParam("%" + title.toLowerCase() + "%");
      list = dh.list();
    } catch (DotHibernateException e) {
      Logger.error(UserFilterFactory.class, "getUserFilterByTitle failed:" + e, e);
    }
    return list;
  }
View Full Code Here

        return findContentlets(inodes);
  }

  @Override
  protected List<Contentlet> findByStructure(String structureInode, int limit, int offset) throws DotDataException, DotStateException, DotSecurityException {
      HibernateUtil hu = new HibernateUtil();
        hu.setQuery("select inode from inode in class " + com.dotmarketing.portlets.contentlet.business.Contentlet.class.getName() +
                ", contentletvi in class "+ContentletVersionInfo.class.getName()+
                " where type = 'contentlet' and structure_inode = '" + structureInode + "' " +
                " and contentletvi.identifier=inode.identifier and contentletvi.workingInode=inode.inode ");
        if(offset > 0)
            hu.setFirstResult(offset);
        if(limit > 0)
            hu.setMaxResults(limit);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(String.valueOf(content.getInode()), content);
//          result.add(content);
View Full Code Here

                "on contentlet_1_.inode = contentlet.inode and contentlet_1_.type = 'contentlet' where  contentlet.inode in ('";
       
        for(int init=0; init < inodesNotFound.size(); init+=200) {
            int end = Math.min(init + 200, inodesNotFound.size());
           
            HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);
            hu.setSQLQuery( hql + StringUtils.join(inodesNotFound.subList(init, end), "','") + "')");
           
            List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
            for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
                Contentlet con = convertFatContentletToContentlet(fatty);
                result.add(con);
                cc.add(con.getInode(), con);
            }
View Full Code Here

            queryBuffer.append(" and contentvi.lang = ? ");
        }

        queryBuffer.append(" and contentlet.identifier = ? ");

        HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);
        hu.setSQLQuery(queryBuffer.toString());
        if(languageId!=null){
          hu.setParam(languageId.longValue());
        }
        hu.setParam(identifier);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties = hu.list();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet con = convertFatContentletToContentlet(fatty);
            cc.add(String.valueOf(con.getInode()), con);
            cons.add(con);
        }
View Full Code Here

            dc.setSQL(countSQL);
            List<HashMap<String, String>> resultCount = dc.getResults();
            int count = Integer.parseInt(resultCount.get(0).get("count"));
            int limit = 500;

            HibernateUtil hu = new HibernateUtil();
            hu.setQuery("from inode in class com.dotmarketing.portlets.contentlet.business.Contentlet, " +
                        " contentletvi in class "+ContentletVersionInfo.class.getName() +
                        " where contentletvi.identifier=inode.identifier " +
                        " and contentletvi.live_inode=inode.inode " +
                        " and structure_inode= '" + structure.getInode() + "' " +
                        " and " + field.getFieldContentlet() + " is not null" +
                        " and " + field.getFieldContentlet() + "<>'' " +
                        " order by " + field.getFieldContentlet());
            hu.setMaxResults(limit);
            for (int offset = 0; offset < count; offset+=limit) {
                if (offset > 0)
                    hu.setFirstResult(offset);
                List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
                for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
                    result.add(convertFatContentletToContentlet(fatty));
                }
            }
        } catch (Exception e) {
View Full Code Here

            Logger.debug(this, "LanguageId is -1 so we will not use a language to pull contentlets");
        }else{
            condition.append(" and contentletvi.lang = ").append(languageId);
        }

        HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);

        if (!UtilMethods.isSet(orderby) || orderby.equals("tree_order")) {
            orderby = "multi_tree.tree_order";
        }
        String query = "SELECT {contentlet.*} FROM contentlet JOIN inode contentlet_1_ ON (contentlet.inode=contentlet_1_.inode) "
          + " JOIN multi_tree ON (multi_tree.child = contentlet.identifier) "
            + " JOIN contentlet_version_info contentletvi ON (contentlet.identifier=contentletvi.identifier) "
            + " where multi_tree.parent1 = ? and multi_tree.parent2 = ? and " + condition.toString() + " order by "
            + orderby;

        hu.setSQLQuery(query);
        hu.setParam(HTMLPageIdentifier);
        hu.setParam(containerIdentifier);

        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(content.getInode(), content);
            result.add(content);
View Full Code Here

               .append(" JOIN contentlet_version_info contentletvi ON (contentlet.identifier=contentletvi.identifier) ")
                   .append(" WHERE ")
                   .append((live!=null && live.booleanValue() ?
                           "contentletvi.live_inode" : "contentletvi.working_inode"))
                   .append(" = contentlet.inode and contentlet.identifier = ? ");
        HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);
        hu.setSQLQuery(queryBuffer.toString());
        hu.setParam(identifier);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(content.getInode(), content);
            result.add(content);
View Full Code Here

TOP

Related Classes of com.dotmarketing.db.HibernateUtil

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.