Package org.damour.base.client.objects

Examples of org.damour.base.client.objects.PermissibleObjectTreeNode


    for (PermissibleObject child : children) {
      if (acceptedClasses != null && !acceptedClasses.contains(child.getClass().getName())) {
        continue;
      }

      PermissibleObjectTreeNode childNode = new PermissibleObjectTreeNode();
      parentNode.getChildren().put(child, childNode);
      buildPermissibleObjectTreeNode(session, user, owner, voterGUID, childNode, child, acceptedClasses, currentDepth + 1, fetchDepth, metaDataFetchDepth);
    }
  }
View Full Code Here


        }
        if (depth > 0) {
          System.out.print("+-");
        }
        System.out.println("CHILD: " + child.getName());
        PermissibleObjectTreeNode grandChildren = parent.getChildren().get(child);
        dumpTreeNode(grandChildren, depth + 1);
      }
    }
  }
View Full Code Here

    session.close();

    System.out.println("Starting dump");
    session = HibernateUtil.getInstance().getSession();
    // as user, get files i can see
    PermissibleObjectTreeNode root = new PermissibleObjectTreeNode();
    RepositoryHelper.buildPermissibleObjectTreeNode(session, user, null, null, root, null, null, 0, -1, -1);
    RepositoryHelper.dumpTreeNode(root, 0);
    session.close();
    System.out.println("End dump");
View Full Code Here

        }
      } while (parent != null);
    }

    // create bare nodes for each element
    PermissibleObjectTreeNode rootNode = new PermissibleObjectTreeNode();

    for (Comment comment : commentSet) {
      PermissibleObjectTreeNode node = new PermissibleObjectTreeNode();
      node.setObject(comment);
      if (comment.getParentComment() == null) {
        if (!rootNode.getChildren().containsKey(comment)) {
          rootNode.getChildren().put(comment, node);
        }
      } else {
        // try to find parent in rootNode tree
        PermissibleObjectTreeNode parent = findParentCommentNode(rootNode, node);
        if (parent == null) {
          // this nodes parent cannot be found, let's add all of his parents
          List<Comment> parentComments = new ArrayList<Comment>();
          Comment parentComment = comment.getParentComment();
          do {
            if (parentComment != null) {
              parentComments.add(parentComment);
              parentComment = parentComment.getParentComment();
            }
          } while (parent != null);
          if (parentComments.size() == 0) {
            rootNode.getChildren().put(comment, node);
          } else {
            // reverse the order of the list and add/find existing parents
            Collections.reverse(parentComments);
            for (Comment myParentComment : parentComments) {
              PermissibleObjectTreeNode myParentCommentNode = new PermissibleObjectTreeNode();
              myParentCommentNode.setObject(myParentComment);
              PermissibleObjectTreeNode parentParent = findParentCommentNode(rootNode, myParentCommentNode);
              if (parentParent == null) {
                rootNode.getChildren().put(myParentComment, myParentCommentNode);
              } else {
                if (!parentParent.getChildren().containsKey(myParentComment)) {
                  parentParent.getChildren().put(myParentComment, myParentCommentNode);
                }
              }
            }
            // we better find it now
            parent = findParentCommentNode(rootNode, node);
View Full Code Here

    }
    for (PermissibleObject obj : rootNode.getChildren().keySet()) {
      if (obj.equals(((Comment) node.getObject()).getParentComment())) {
        return rootNode.getChildren().get(obj);
      }
      PermissibleObjectTreeNode possibleParent = findParentCommentNode(rootNode.getChildren().get(obj), node);
      if (possibleParent != null) {
        return possibleParent;
      }
    }
    return null;
View Full Code Here

  public PermissibleObjectTreeNode getPermissibleObjectTree(PermissibleObject parent, User owner, List<String> acceptedClasses, int fetchDepth,
      int metaDataFetchDepth) throws SimpleMessageException {
    try {
      User authUser = getAuthenticatedUser(session.get());
      PermissibleObjectTreeNode root = new PermissibleObjectTreeNode();
      if (parent != null) {
        parent = getPermissibleObject(parent.getId());
      }
      RepositoryHelper.buildPermissibleObjectTreeNode(session.get(), authUser, owner, getVoterGUID(), root, parent, acceptedClasses, 0, fetchDepth,
          metaDataFetchDepth);
View Full Code Here

    query += orderBy;

    List<PermissibleObject> objects = HibernateUtil.getInstance().executeQuery(session, query, true);
    List<PermissibleObjectTreeNode> treeNodes = new ArrayList<PermissibleObjectTreeNode>();
    for (PermissibleObject object : objects) {
      PermissibleObjectTreeNode treeNode = new PermissibleObjectTreeNode();
      treeNode.setObject(object);
      treeNodes.add(treeNode);
      if (object.getNumAdvisoryVotes() > 0) {
        treeNode.setUserAdvisory(AdvisoryHelper.getUserAdvisory(session, object, user, voterGUID));
      }
      if (object.getNumRatingVotes() > 0) {
        treeNode.setUserRating(RatingHelper.getUserRating(session, object, user, voterGUID));
      }
      if (object.getNumUpVotes() > 0 || object.getNumDownVotes() > 0) {
        treeNode.setUserThumb(ThumbHelper.getUserThumb(session, object, user, voterGUID));
      }
    }
    return treeNodes;
  }
View Full Code Here

TOP

Related Classes of org.damour.base.client.objects.PermissibleObjectTreeNode

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.