Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Tree


  @Override
  protected void removeChild(Categorizable parent, Category child, String relationType) throws DotDataException {
    if(!UtilMethods.isSet(relationType)){
      relationType = "child";
    }
    Tree tree = TreeFactory.getTree(parent.getCategoryId(), child.getInode(), relationType);
    if(tree != null && InodeUtils.isSet(tree.getChild())) {
      TreeFactory.deleteTree(tree);
    }
    try {
      catCache.removeChild(parent, child);
    } catch (DotCacheException e) {
View Full Code Here


  @Override
  protected void removeParent(Categorizable child, Category parent)
  throws DotDataException {

    Tree tree = TreeFactory.getTree(parent.getInode(), child.getCategoryId());
    if(tree != null && InodeUtils.isSet(tree.getChild())) {
      TreeFactory.deleteTree(tree);
    }
    try {
      catCache.removeParent(child, parent);
    } catch (DotCacheException e) {
View Full Code Here

    List<Tree> trees = TreeFactory.getTreesByParent(parent.getCategoryId());
    for(Tree tree : trees) {
      TreeFactory.deleteTree(tree);
    }
    for (Category cat : children) {
      Tree tree = new Tree(parent.getCategoryId(), cat.getInode());
      TreeFactory.saveTree(tree);
    }
    try {
      catCache.removeChildren(parent);
    } catch (DotCacheException e) {
View Full Code Here

  @Override
  protected void setParents(Categorizable child, List<Category> parents)
  throws DotDataException {
    List<Category> pars = getParents(child);
    for (Category category : pars) {
      Tree t = TreeFactory.getTree(category.getInode(), child.getCategoryId());
      TreeFactory.deleteTree(t);
    }
    for (Category cat : parents) {
      Tree tree = new Tree(cat.getInode(), child.getCategoryId());
      TreeFactory.saveTree(tree);
    }
    try {
      catCache.removeParents(child);
    } catch (DotCacheException e) {
View Full Code Here

      if(obj instanceof Inode){
        Inode parentInode = (Inode) obj;
        parentInode.addChild(workingLink);

        //to keep relation types from parent only if it exists
        Tree tree = com.dotmarketing.factories.TreeFactory.getTree(
            parentInode, currentLink);
        if ((tree.getRelationType() != null)
            && (tree.getRelationType().length() != 0)) {
          Tree newTree = com.dotmarketing.factories.TreeFactory.getTree(
              parentInode, workingLink);
          newTree.setRelationType(tree.getRelationType());
          newTree.setTreeOrder(0);
          TreeFactory.saveTree(newTree);
        }
      }
   
     
View Full Code Here

        continue;
       }
       parentInode.addChild(workingLink);

       //to keep relation types from parent only if it exists
       Tree tree = com.dotmarketing.factories.TreeFactory.getTree(
          parentInode, linkVersion);
       if ((tree.getRelationType() != null)
          && (tree.getRelationType().length() != 0)) {
        Tree newTree = com.dotmarketing.factories.TreeFactory.getTree(
            parentInode, workingLink);
        newTree.setRelationType(tree.getRelationType());
        newTree.setTreeOrder(0);
        TreeFactory.saveTree(newTree);
       }

       // checks type of parent and deletes child if not live version.
       if (!linkVersion.isLive()) {
View Full Code Here

     * @param relationship
     * @param relatedContentlets
     * @throws DotDataException
     */
    public static void deleteRelationships(Contentlet contentlet, Relationship relationship, List<Contentlet> relatedContentlets) throws DotDataException{
      Tree t = new Tree();
    for (Contentlet con : relatedContentlets) {

      t= TreeFactory.getTree(contentlet.getIdentifier(), con.getIdentifier(), relationship.getRelationTypeValue());
      if(InodeUtils.isSet(t.getChild())  & InodeUtils.isSet(t.getParent())){
        TreeFactory.deleteTree(t);
      }else{
        t= TreeFactory.getTree(con.getIdentifier(),contentlet.getIdentifier(), relationship.getRelationTypeValue());
        if(InodeUtils.isSet(t.getChild()) & InodeUtils.isSet(t.getParent())){
          TreeFactory.deleteTree(t);
        }
      }
    }
    }
View Full Code Here

   * @return true if the user was successfully added to the list, false - if the user could be added because belongs to the unsubscribers 
   * @throws DotHibernateException
   */
  public static boolean addMailingSubscriber (MailingList ml, UserProxy up, boolean force) throws DotHibernateException {

    Tree currentRel = TreeFactory.getTree(ml, up, null);

    if((currentRel != null && InodeUtils.isSet(currentRel.getChild())) && !force)
      return false;
    else if ((currentRel != null && InodeUtils.isSet(currentRel.getChild())) && force) {

      currentRel.setRelationType("subscriber");
      TreeFactory.saveTree(currentRel);
      HibernateUtil.saveOrUpdate(ml);

    } else {

View Full Code Here

   * @return true if the user was successfully unsubscribed from the list,
   *       false - if the user could not be unsubscribed because never belonged to the list  
   * @throws DotHibernateException
   */
  public static boolean unsubcribeFromMailingList (MailingList ml, UserProxy up, boolean force) throws DotHibernateException {
    Tree currentRel = TreeFactory.getTree(ml, up);
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {

      currentRel.setRelationType("unsubscriber");
      TreeFactory.saveTree(currentRel);
      HibernateUtil.saveOrUpdate(ml);

      return true;
    } else if(force) {
View Full Code Here

   * @param up The user to remove
   * @return true if the user was successfully removed from the list,
   *       false - if the user could not be removed because never belonged to the list  
   */
  public static boolean deleteUserFromMailingList (MailingList ml, UserProxy up) {
    Tree currentRel = TreeFactory.getTree(ml, up, null);
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {
      TreeFactory.deleteTree(currentRel);
      return true;
    }
    return false;
 
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Tree

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.