Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Tree


   * @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 deleteSubscriberFromMailingList (MailingList ml, UserProxy up) {
    Tree currentRel = TreeFactory.getTree(ml.getInode(), up.getUserId(), "subscriber");
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {
      TreeFactory.deleteTree(currentRel);
      return true;
    }
    return false;
 
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 deleteUnsubscriberFromMailingList (MailingList ml, UserProxy up) {
    Tree currentRel = TreeFactory.getTree(ml.getInode(), up.getUserId(), "unsubscriber");
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {
      TreeFactory.deleteTree(currentRel);
      return true;
    }
    return false;
 
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 deleteBounceFromMailingList (MailingList ml, UserProxy up) {
    Tree currentRel = TreeFactory.getTree(ml.getInode(), up.getUserId(), "bounce");
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {
      TreeFactory.deleteTree(currentRel);
      return true;
    }
    return false;
 
View Full Code Here

   * @return true if the user was successfully added to the bounce list,
   *       false - if the user could not be added to the bounces list because never belonged to the list  
   * @throws DotHibernateException
   */
  public static boolean markAsBounceFromMailingList (MailingList ml, UserProxy up) throws DotHibernateException {
    Tree currentRel = TreeFactory.getTree(ml, up, null);
    if (currentRel != null && InodeUtils.isSet(currentRel.getChild())) {
      TreeFactory.deleteTree(currentRel);
      ml.addChild(up, "bounce");
      HibernateUtil.saveOrUpdate(ml);
      return true;
    }
View Full Code Here

   * @param ml
   * @param up
   * @return true if the user is a subscriber of the given list
   */
  public static boolean isSubscribed(MailingList ml, UserProxy up) {
    Tree tree = TreeFactory.getTree(ml.getInode(), up.getInode(), "subscriber");

    return tree != null && InodeUtils.isSet(tree.getParent()) && InodeUtils.isSet(tree.getChild());
  }
View Full Code Here

      Iterator<Template> it = currentTemplates.iterator();

      // update templates to new version
      while (it.hasNext()) {
        Template parentInode = (Template) it.next();
        TreeFactory.saveTree(new Tree(parentInode.getInode(), container.getInode()));
      }
    }

    // save the container-structure relationships , issue-2093
    for (ContainerStructure cs : containerStructureList) {
View Full Code Here

                            }
                        }

                    } else {
                        if(obj instanceof Tree){
                            Tree t = (Tree) obj;
                            DotConnect dc = new DotConnect();
                            List<String> inodeList = new ArrayList<String>();
                            dc.setSQL("select inode from inode where inode = ? or inode = ?");
                            dc.addParam(t.getParent());
                            dc.addParam(t.getChild());
                            inodeList = dc.getResults();
                            dc.setSQL("select id from identifier where id = ? or id = ?");
                            dc.addParam(t.getParent());
                            dc.addParam(t.getChild());
                            inodeList.addAll(dc.getResults());
                            if(inodeList.size() > 1){
                                HibernateUtil.save(obj);
                            }
                            else{
                                Logger.warn(this.getClass(), "Can't import tree- no matching inodes: {parent=" + t.getParent() + ", child=" + t.getChild() +"}");

                            }
                        }
                        else{
                            try {
View Full Code Here

        //Get the contentlet Identifier to gather the menu links
        Identifier menuLinkIdentifier = APILocator.getIdentifierAPI().find( menuLink );

        //Verify if the relation was created
        Tree tree = TreeFactory.getTree( contentlet.getInode(), menuLinkIdentifier.getInode(), RELATION_TYPE );

        //Validations
        assertNotNull( tree );
        assertNotNull( tree.getParent() );
        assertNotNull( tree.getChild() );
        assertEquals( tree.getParent(), contentlet.getInode() );
        assertEquals( tree.getChild(), menuLinkIdentifier.getInode() );
        assertEquals( tree.getRelationType(), RELATION_TYPE );

        menuLinkAPI.delete( menuLink, user, false );

    }
View Full Code Here

            //Get the contentlet Identifier to gather the menu links
            Identifier fileIdentifier = APILocator.getIdentifierAPI().find( testFile );

            //Verify if the relation was created
            Tree tree = TreeFactory.getTree( contentlet.getInode(), fileIdentifier.getInode(), RELATION_TYPE );

            //Validations
            assertNotNull( tree );
            assertNotNull( tree.getParent() );
            assertNotNull( tree.getChild() );
            assertEquals( tree.getParent(), contentlet.getInode() );
            assertEquals( tree.getChild(), fileIdentifier.getInode() );
            assertEquals( tree.getRelationType(), RELATION_TYPE );

            //Validations
            /*assertNotNull( finalFiles );
            assertTrue( !finalFiles.isEmpty() );
            assertNotSame( initialSize, finalFiles.size() );*/
 
View Full Code Here

            //Get the contentlet Identifier to gather the menu links
            Identifier fileIdentifier = APILocator.getIdentifierAPI().find( testFile );

            //Verify if the relation was created
            Tree tree = TreeFactory.getTree( contentlet.getInode(), fileIdentifier.getInode(), RELATION_TYPE );

            //Validations
            assertNotNull( tree );
            assertNotNull( tree.getParent() );
            assertNotNull( tree.getChild() );
            assertEquals( tree.getParent(), contentlet.getInode() );
            assertEquals( tree.getChild(), fileIdentifier.getInode() );
            assertEquals( tree.getRelationType(), RELATION_TYPE );

            /*//Validations
            assertNotNull( finalFiles );
            assertTrue( !finalFiles.isEmpty() );
            assertNotSame( initialSize, finalFiles.size() );*/
 
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.