/** {@inheritDoc} */ public boolean hasOrderableChildNodes() throws RemoteException { return type.hasOrderableChildNodes(); }
private static boolean isOrderable(Node node) throws RepositoryException { if (node.getPrimaryNodeType().hasOrderableChildNodes()) { return true; } NodeType[] types = node.getMixinNodeTypes(); for (NodeType type : types) { if (type.hasOrderableChildNodes()) { return true; } } return false; }
@Override public void checkOrderableChildNodes() throws UnsupportedRepositoryOperationException { for (NodeType nt : nodeTypes.values()) { if (nt.hasOrderableChildNodes()) { return; } } throw new UnsupportedRepositoryOperationException("Child node ordering is not supported on this node"); }
public boolean needsReorder(Node parent) throws RepositoryException { // could perform more comprehensive check return names.size() > 1 && parent.getPrimaryNodeType().hasOrderableChildNodes(); }
private static boolean isOrderable(Node node) throws RepositoryException { if (node.getPrimaryNodeType().hasOrderableChildNodes()) { return true; } NodeType[] types = node.getMixinNodeTypes(); for (NodeType type : types) { if (type.hasOrderableChildNodes()) { return true; } } return false; }
private static boolean isOrderable(Node node) throws RepositoryException { if (node.getPrimaryNodeType().hasOrderableChildNodes()) { return true; } NodeType[] types = node.getMixinNodeTypes(); for (NodeType type : types) { if (type.hasOrderableChildNodes()) { return true; } } return false; }
@Override public void checkOrderableChildNodes() throws UnsupportedRepositoryOperationException { for (NodeType nt : nodeTypes.values()) { if (nt.hasOrderableChildNodes()) { return; } } throw new UnsupportedRepositoryOperationException("Child node ordering is not supported on this node"); }
@Override public void checkOrderableChildNodes() throws UnsupportedRepositoryOperationException { for (NodeType nt : nodeTypes.values()) { if (nt.hasOrderableChildNodes()) { return; } } throw new UnsupportedRepositoryOperationException("Child node ordering is not supported on this node"); }
private boolean isOrderable(final javax.jcr.Node parent) throws RepositoryException { return parent.getPrimaryNodeType().hasOrderableChildNodes(); }
public static boolean isOrderable(final Node node) { try { return node != null && node.getDepth() > 0 && node.getParent().getPrimaryNodeType().hasOrderableChildNodes(); } catch (RepositoryException e) { log.error("Could not determine if node is orderable"); } return false; }
/** * Checks if the NodeType with name <code>ntName</code> supports orderable * child nodes. If not a {@link NotExecutableException} is thrown. * @param ntName the name of the node type. */ private void checkOrderableNodeType(String ntName) throws RepositoryException, NotExecutableException { NodeType nt = superuser.getWorkspace().getNodeTypeManager().getNodeType(ntName); if (!nt.hasOrderableChildNodes()) { throw new NotExecutableException("NodeType: " + ntName + " does not support orderable child nodes."); } } }
@Override protected void setUp() throws Exception { super.setUp(); assertTrue(testRootNode.getPrimaryNodeType().hasOrderableChildNodes()); for (char c : SEQ_BEFORE.toCharArray()) { testRootNode.addNode(new String(new char[]{c})); } superuser.save(); Reader cnd = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(TEST_NODETYPES)); CndImporter.registerNodeTypes(cnd, superuser); cnd.close(); }
@Override protected void setUp() throws Exception { super.setUp(); assertTrue(testRootNode.getPrimaryNodeType().hasOrderableChildNodes()); for (char c : SEQ_BEFORE.toCharArray()) { testRootNode.addNode(new String(new char[]{c})); } superuser.save(); Reader cnd = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(TEST_NODETYPES)); CndImporter.registerNodeTypes(cnd, superuser); cnd.close(); }
@Override protected void setUp() throws Exception { super.setUp(); if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) { throw new NotExecutableException("Test node does not have orderable children."); } children = new Node[4]; children[0] = testRootNode.addNode(nodeName1, testNodeType); children[1] = testRootNode.addNode(nodeName2, testNodeType); children[2] = testRootNode.addNode(nodeName3, testNodeType); children[3] = testRootNode.addNode(nodeName4, testNodeType); testRootNode.save(); }
@Override protected void setUp() throws Exception { super.setUp(); if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) { throw new NotExecutableException("Test node does not have orderable children."); } // create move-destination destParent = testRootNode.addNode(nodeName4, testNodeType); srcParent = testRootNode.addNode(nodeName2, testNodeType); destPath = destParent.getPath() + "/" + nodeName3; testRootNode.save(); }
@Override protected void setUp() throws Exception { super.setUp(); if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) { throw new NotExecutableException("Test node does not have orderable children."); } NodeIterator it = testRootNode.getNodes(); if (it.hasNext()) { throw new NotExecutableException("Test node already contains child nodes"); } createOrderableChildren(); }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }
@Test public void testReorder() throws Exception { Node n = testSession.getNode(path); if (!n.getPrimaryNodeType().hasOrderableChildNodes()) { throw new NotExecutableException("Reordering child nodes is not supported.."); } try { n.orderBefore(Text.getName(childNPath2), Text.getName(childNPath)); testSession.save(); fail("test session must not be allowed to reorder nodes."); } catch (AccessDeniedException e) { // success. } }