Tabnine Logo
Node.getParent
Code IndexAdd Tabnine to your IDE (free)

How to use
getParent
method
in
javax.jcr.Node

Best Java code snippets using javax.jcr.Node.getParent (Showing top 20 results out of 1,143)

origin: stackoverflow.com

for (Node parent = anyChildNode; parent.getParent() != null; parent = parent.getParent())
 ; // this for loop has no body, so an empty statement takes its place
origin: stackoverflow.com

 table.setOnMousePressed(new EventHandler<MouseEvent>() {
  @Override 
  public void handle(MouseEvent event) {
    if (event.isPrimaryButtonDown() && event.getClickCount() == 2) {
      Node node = ((Node) event.getTarget()).getParent();
      TableRow row;
      if (node instanceof TableRow) {
        row = (TableRow) node;
      } else {
        // clicking on text part
        row = (TableRow) node.getParent();
      }
      System.out.println(row.getItem());
    }
  }
});
origin: stackoverflow.com

 String getXPath(Node node)
{
  Node parent = node.getParent();
  if (parent == null) {
    return "/" + node.getTagName();
  }
  return getXPath(parent) + "/" + "[@id='" + node.getAttribute("id") + "']";
}
origin: info.magnolia/magnolia-core

@Override
public Node getParent() throws ItemNotFoundException,
    AccessDeniedException, RepositoryException {
  return baseNode.getParent();
}
origin: info.magnolia/magnolia-core

  @Override
  protected boolean nodeMatches(Node node) {
    // Only get children (child level 1) below parent path
    try {
      return StringUtils.equals(parentPath, node.getParent().getPath());
    } catch (RepositoryException e) {
      return false;
    }
  }
}
origin: stackoverflow.com

void rename(Node node, String newName) throws RepositoryException 
 {
   node.getSession().move(node.getPath(), node.getParent().getPath() + "/" + newName);
   // Don't forget - not necessarily here at this place:
   // node.getSession().save();
 }
origin: info.magnolia/magnolia-core

/**
 * Check if node1 and node2 are siblings.
 */
public static boolean isSameNameSiblings(Node node1, Node node2) throws RepositoryException {
  Node parent1 = node1.getParent();
  Node parent2 = node2.getParent();
  return isSame(parent1, parent2) && node1.getName().equals(node2.getName());
}
origin: stackoverflow.com

for (Node n: chartBackground.getParent().getChildrenUnmodifiable()) {
 if (n != chartBackground && n != xAxis && n != yAxis) {
  n.setMouseTransparent(true);
origin: info.magnolia/magnolia-core

/**
 * Convenience - delegate to {@link Node#orderBefore(String, String)}.
 */
public static void orderBefore(Node node, String siblingName) throws RepositoryException {
  node.getParent().orderBefore(node.getName(), siblingName);
}
origin: info.magnolia/magnolia-core

public static boolean isFirstSibling(Node node) throws RepositoryException {
  Node parent = node.getParent();
  NodeIterator nodes = parent.getNodes();
  return isSame(nodes.nextNode(), node);
}
origin: info.magnolia/magnolia-core

public static void moveNode(Node nodeToMove, Node newParent) throws RepositoryException {
  // ignore move request silently if moving within same folder. Such op, although in theory should be void, will fail in JR
  // with exception when same name siblings are restricted in NT definition.
  if (!newParent.getPath().equals(nodeToMove.getParent().getPath())) {
    String newPath = combinePathAndName(newParent.getPath(), nodeToMove.getName());
    nodeToMove.getSession().move(nodeToMove.getPath(), newPath);
  }
}
origin: info.magnolia/magnolia-core

/**
 * Orders the node up one step among its siblings. If the node is the only sibling or the first sibling this method
 * has no effect.
 */
public static void orderNodeUp(Node node) throws RepositoryException {
  Node siblingBefore = getSiblingBefore(node);
  if (siblingBefore != null) {
    node.getParent().orderBefore(node.getName(), siblingBefore.getName());
  }
}
origin: info.magnolia/magnolia-core

public static void moveNodeBefore(Node nodeToMove, Node target) throws RepositoryException {
  Node targetParent = target.getParent();
  moveNode(nodeToMove, targetParent);
  targetParent.orderBefore(nodeToMove.getName(), target.getName());
}
origin: info.magnolia/magnolia-core

public static void renameNode(Node node, String newName) throws RepositoryException {
  if (node.getName().equals(newName)) {
    return;
  }
  final Node parent = node.getParent();
  final String newPath = combinePathAndName(parent.getPath(), newName);
  final Node siblingAfter = NodeUtil.getSiblingAfter(node);
  node.getSession().move(node.getPath(), newPath);
  if (siblingAfter != null) {
    parent.orderBefore(newName, siblingAfter.getName());
  }
}
origin: info.magnolia/magnolia-core

@Override
public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
  // at some point we will enter the real hierarchy, so its easiest to loop
  Node parent = getParent();
  while (parent.getDepth() > depth) {
    parent = parent.getParent();
  }
  return parent;
}
origin: info.magnolia/magnolia-core

@Override
protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
  final Node node = installContext.getJCRSession(repository).getNode(path);
  node.getParent().orderBefore(node.getName(), orderBeforeNodeName);
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

private Node getOrCreateParent(String key) throws RepositoryException {
  Node p = getParent(key);
  if (treeManager.isRoot(p)) {
    Node min = getMinimal();
    if (min != null) {
      p = min.getParent();
      renamePath(p, key);
    }
  }
  return p;
}
origin: info.magnolia/magnolia-core

  @Test
  public void testNavigatingWithNodeParentStillHidesExcludedNode() throws Exception {

    Node unspecified = sessionWrapper.getRootNode().getNode("unspecified");
    Node root = unspecified.getParent();
    assertFalse(root.hasNode("excluded"));
    try {
      root.getNode("excluded");
      fail();
    } catch (PathNotFoundException expected) {
    }
  }
}
origin: info.magnolia/magnolia-core

@Override
public Content getParent() throws PathNotFoundException, RepositoryException, AccessDeniedException {
  Node parentNode = getJCRNode().getParent();
  return parentNode == null ? null : new MockContent((MockNode) parentNode);
}
origin: info.magnolia/magnolia-core

@Override
public Item getAncestor(int depth) throws RepositoryException {
  if (this.getDepth() == depth) {
    return this;
  }
  Node parentNode = this.getParent();
  while (parentNode.getDepth() != depth) {
    parentNode = parentNode.getParent();
  }
  return parentNode;
}
javax.jcrNodegetParent

Popular methods of Node

  • getProperty
    Returns the property at relPath relative tothis node. The same reacquisition semantics apply as with
  • getPath
  • getNode
    Returns the node at relPath relative to this node. If relPath contains a path element that refers to
  • setProperty
    Sets the multi-value property of this node called name to the specified array of values. The behavio
  • addNode
    Creates a new node at relPath of the specified node type. The behavior of this method is identical t
  • getName
  • getSession
  • getNodes
    Gets all child nodes of this node accessible through the currentSession that match one or more of th
  • hasProperty
    Indicates whether a property exists at relPath Returnstrue if a property accessible through the curr
  • hasNode
    Indicates whether a node exists at relPath Returnstrue if a node accessible through the currentSessi
  • isNodeType
    Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof.
  • getPrimaryNodeType
    Returns the primary node type in effect for this node. WhichNodeType is returned when this method is
  • isNodeType,
  • getPrimaryNodeType,
  • remove,
  • getProperties,
  • addMixin,
  • getIdentifier,
  • getMixinNodeTypes,
  • hasNodes,
  • isSame

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • onRequestPermissionsResult (Fragment)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Path (java.nio.file)
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now