/** * @inheritDoc */ public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException { return node.getUUID(); }
private static String getUUID(Node node) throws RepositoryException { try { return node.getUUID(); } catch (UnsupportedRepositoryOperationException e) { return ""; } }
private static String getUUID(Node node) throws RepositoryException { try { return node.getUUID(); } catch (UnsupportedRepositoryOperationException e) { return ""; } }
@Override public String getUUID() { try { return this.node.getUUID(); } catch (UnsupportedOperationException e) { log.error(e.getMessage()); } catch (RepositoryException re) { log.error("Exception caught", re); } return StringUtils.EMPTY; }
/** {@inheritDoc} */ @SuppressWarnings("deprecation") public String getUUID() throws RepositoryException, RemoteException { try { return node.getUUID(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
/** * Tests if adding a property with <code>Node.setProperty(String, * Node)</code> works with <code>Session.save()</code> */ public void testNewNodePropertySession() throws Exception { testNode.setProperty(propertyName1, n1); superuser.save(); assertEquals("Setting property with Node.setProperty(String, Node) and Session.save() not working", n1.getUUID(), testNode.getProperty(propertyName1).getString()); }
/** * Tests if adding a property with <code>Node.setProperty(String, * Node)</code> works with <code>parentNode.save()</code> */ public void testNewNodePropertyParent() throws Exception { testNode.setProperty(propertyName1, n1); testRootNode.getSession().save(); assertEquals("Setting property with Node.setProperty(String, Node) and parentNode.save() not working", n1.getUUID(), testNode.getProperty(propertyName1).getString()); }
@Override public void onClear() { Node node = ((JcrNodeModel) FacetSelectTemplatePlugin.this.getDefaultModel()).getNode(); try { node.setProperty("hippo:docbase", node.getSession().getRootNode().getUUID()); } catch (RepositoryException e) { log.error("Unable to reset docbase to rootnode uuid", e); } redraw(); }
@Override @SuppressWarnings("deprecation") public Value createValue(Node value, boolean weak) throws RepositoryException { if (!value.isNodeType(NodeType.MIX_REFERENCEABLE)) { throw new ValueFormatException( "Node is not referenceable: " + value.getPath()); } return weak ? newValue(GenericPropertyState.weakreferenceProperty("", value.getUUID()), namePathMapper) : newValue(GenericPropertyState.referenceProperty("", value.getUUID()), namePathMapper); }
@NotNull public Value createValue(@NotNull Node value, boolean weak) throws RepositoryException { if (!value.isNodeType(NodeType.MIX_REFERENCEABLE)) { throw new ValueFormatException( "Node is not referenceable: " + value.getPath()); } return weak ? newValue(GenericPropertyState.weakreferenceProperty("", value.getUUID()), namePathMapper, getBlobAccessProvider()) : newValue(GenericPropertyState.referenceProperty("", value.getUUID()), namePathMapper, getBlobAccessProvider()); }
public WorkflowDescriptor getWorkflowDescriptor(String category, Node item) throws RepositoryException { try { RemoteWorkflowDescriptor remoteDescriptor = remote.getWorkflowDescriptor(category, item.getUUID()); if (remoteDescriptor != null) { return new ClientWorkflowDescriptor(remoteDescriptor); } else { return null; } } catch(RemoteException ex) { throw new RemoteRuntimeException(ex); } }
protected String getExistingUUID() throws RepositoryException { Node n = adminSession.getRootNode(); n.addMixin(JcrConstants.MIX_REFERENCEABLE); //noinspection deprecation return n.getUUID(); }
protected void saveNode(Node node) { try { getModel().setObject(node.getUUID()); } catch (RepositoryException ex) { error(ex.getMessage()); } }
public Object doInJcr( final Session session ) throws RepositoryException { Item item; try { item = session.getItem( absPath ); } catch ( PathNotFoundException e ) { return null; } Assert.isTrue( item.isNode() ); return ( (Node) item ).getUUID(); } } );
/** * Tests if VersionHistory.getVersionableUUID() returns the uuid of the * corresponding versionable node. */ public void testGetVersionableUUID() throws RepositoryException { // create version versionableNode.checkout(); Version version = versionableNode.checkin(); assertEquals("Method getVersionableUUID() must return the UUID of the corresponding Node.", version.getContainingHistory().getVersionableUUID(), versionableNode.getUUID()); }
@Test public void testCopyReferenceableChildNode() throws Exception { Session session = getAdminSession(); session.getNode(TEST_PATH + "/source/node").addNode("child").addMixin(JcrConstants.MIX_REFERENCEABLE); session.save(); session.getWorkspace().copy(TEST_PATH + "/source/node", TEST_PATH + "/target/copied"); assertTrue(testNode.hasNode("source/node")); assertTrue(testNode.hasNode("target/copied")); Node childCopy = testNode.getNode("target/copied/child"); assertTrue(childCopy.isNodeType(JcrConstants.MIX_REFERENCEABLE)); assertFalse(childCopy.getUUID().equals(testNode.getNode("source/node/child").getUUID())); }
/** * Same as {@link #testAccessMovedReferenceableByUUID()} but calls save() * before accessing the node again. */ public void testAccessMovedReferenceableByUUID2() throws RepositoryException, NotExecutableException { String uuid = moveNode.getUUID(); //move the node doMove(moveNode.getPath(), destinationPath); superuser.save(); Node n = superuser.getNodeByUUID(uuid); assertTrue("After successful moving a referenceable node node, accessing the node by uuid must return the same node.", n.isSame(moveNode)); }
/** * Test if a moved referenceable node returns the same item than the moved * node. */ public void testAccessMovedReferenceableByUUID() throws RepositoryException, NotExecutableException { String uuid = moveNode.getUUID(); //move the node doMove(moveNode.getPath(), destinationPath); Node n = superuser.getNodeByUUID(uuid); assertTrue("After successful moving a referenceable node node, accessing the node by uuid must return the same node.", n.isSame(moveNode)); }
public void testQualifiedName() throws Exception { ChromatticSessionImpl session = login(); Node rootNode = session.getRoot(); Node aNode = rootNode.addNode("jcr:foo", "nodeattribute:a"); String aId = aNode.getUUID(); // TNA_A a = session.findById(TNA_A.class, aId); assertEquals("foo", a.getName()); // a.setName("bar"); assertEquals("jcr:bar", aNode.getName()); }
@SuppressWarnings( "deprecation" ) @Test( expected = UnsupportedRepositoryOperationException.class ) public void shouldNotProvideUuidIfNotReferenceable() throws Exception { initializeData(); // The b node was not set up to be referenceable in this test, but does have a mixin type Node node = session.getRootNode().getNode("a").getNode("b").getNode("c"); node.getUUID(); }