Package com.dotmarketing.db

Examples of com.dotmarketing.db.HibernateUtil$RunnablesExecutor


     * @param inode inode of the object tagged
     * @return list of all the TagInode where the tags are associated to the object
     */
  public static List getTagInodeByInode(String inode) {
        try {
            HibernateUtil dh = new HibernateUtil(TagInode.class);
            dh.setQuery("from tag_inode in class com.dotmarketing.tag.model.TagInode where inode = ?");
            dh.setParam(inode);

            List list = dh.list();
          return list;

        } catch (Exception e) {
            Logger.warn(Tag.class, "getTagInodeByInode failed:" + e, e);
        }
View Full Code Here


    }
  }

  public static MultiTree getMultiTree(Inode parent1, Inode parent2, Inode child) {
    try {
      HibernateUtil dh = new HibernateUtil(MultiTree.class);
      dh.setQuery("from multi_tree in class com.dotmarketing.beans.MultiTree where parent1 = ? and parent2 = ? and child = ?");
      dh.setParam(parent1.getInode());
      dh.setParam(parent2.getInode());
      dh.setParam(child.getInode());

      return (MultiTree) dh.load();
    } catch (Exception e) {
            Logger.warn(MultiTreeFactory.class, "getMultiTree failed:" + e, e);
    }
    return new MultiTree();
  }
View Full Code Here

   */
  public java.util.List<Tag> getTagByName(String name) {
        try {
      name = escapeSingleQuote(name);

      HibernateUtil dh = new HibernateUtil(Tag.class);
            dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where lower(tagName) = ?");
            dh.setParam(name.toLowerCase());

            List list = dh.list();
          return list;
        } catch (Exception e) {
            Logger.warn(Tag.class, "getTagByName failed:" + e, e);
        }
        return new ArrayList();
View Full Code Here

   * @param inode inode of the object tagged
   * @return the tagInode
   */
  public static TagInode getTagInode(String tagId, String inode) {
    // getting the tag inode record
        HibernateUtil dh = new HibernateUtil(TagInode.class);
        try {
            dh.setQuery("from tag_inode in class com.dotmarketing.tag.model.TagInode where tag_id = ? and inode = ?");
       } catch (DotHibernateException e) {
      Logger.error(TagFactory.class,"getTagInode failed:" + e, e);
    }
        dh.setParam(tagId);
        dh.setParam(inode);

        TagInode tagInode;
        try {
          tagInode = (TagInode) dh.load();
        }
        catch (Exception ex) {
          tagInode = new TagInode();
        }
        return tagInode;
View Full Code Here

    return new MultiTree();
  }
 
  public static MultiTree getMultiTree(Identifier parent1, Identifier parent2, Identifier child) {
    try {
      HibernateUtil dh = new HibernateUtil(MultiTree.class);
      dh.setQuery("from multi_tree in class com.dotmarketing.beans.MultiTree where parent1 = ? and parent2 = ? and child = ?");
      dh.setParam(parent1.getInode());
      dh.setParam(parent2.getInode());
      dh.setParam(child.getInode());

      return (MultiTree) dh.load();
    } catch (Exception e) {
            Logger.warn(MultiTreeFactory.class, "getMultiTree failed:" + e, e);
    }
    return new MultiTree();
  }
View Full Code Here

   * @param userId id of the user
   * @return a list of all the tags created
   */
  public java.util.List<Tag> getTagByUser(String userId) {
        try {
            HibernateUtil dh = new HibernateUtil(Tag.class);
            dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where user_id = ?");
            dh.setParam(userId);

            List list = dh.list();

          return list;
        } catch (Exception e) {
            Logger.warn(Tag.class, "getTagByUser failed:" + e, e);
        }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static List<Tag> getSuggestedTag(String name) {
    try {
      name = escapeSingleQuote(name);

      HibernateUtil dh = new HibernateUtil(Tag.class);
      dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where lower(tagname) like ?");
          dh.setParam(name.toLowerCase() + "%");
            List<Tag> list = dh.list();
          return list;
    }
    catch (Exception e) {}
    return new ArrayList<Tag>();
  }
View Full Code Here

  }
   
  @SuppressWarnings("unchecked")
  public static java.util.List<MultiTree> getMultiTree(Inode parent) {
    try {
      HibernateUtil dh = new HibernateUtil(MultiTree.class);
      dh.setQuery("from multi_tree in class com.dotmarketing.beans.MultiTree where parent1 = ? or parent2 = ? ");
      dh.setParam(parent.getInode());
      dh.setParam(parent.getInode());

      return dh.list();
           
    } catch (Exception e) {
            Logger.error(MultiTreeFactory.class, "getMultiTree failed:" + e, e);
      throw new DotRuntimeException(e.toString());
    }
View Full Code Here

   * @return tag
   */
  public static Tag getTag(String name, String userId, String hostId) throws Exception {

    // validating if exists a tag with the name provided
        HibernateUtil dh = new HibernateUtil(List.class);
      dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where lower(tagName) = ?");
        dh.setParam(name.toLowerCase());

        Tag newTag = new Tag();
        List<Tag> tags = (List<Tag>) dh.list();
        // if doesn't exists then the tag is created
        if (tags == null || tags.size() == 0) {
          // creating tag
          return saveTag(name, userId, hostId);
        }
View Full Code Here

    //return new java.util.ArrayList();
  }
 
  public static java.util.List<MultiTree> getMultiTree(Identifier parent) {
    try {
      HibernateUtil dh = new HibernateUtil(MultiTree.class);
      dh.setQuery("from multi_tree in class com.dotmarketing.beans.MultiTree where parent1 = ? or parent2 = ? ");
      dh.setParam(parent.getInode());
      dh.setParam(parent.getInode());

      return dh.list();
           
    } catch (Exception e) {
            Logger.error(MultiTreeFactory.class, "getMultiTree failed:" + e, e);
      throw new DotRuntimeException(e.toString());
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.db.HibernateUtil$RunnablesExecutor

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.