/** {@inheritDoc} */ public boolean isNew() { return item.isNew(); }
/** {@inheritDoc} */ public boolean isNew() throws RemoteException { return item.isNew(); }
@Override public boolean isNew() { return delegate.isNew(); }
public boolean isNew() { return this.item.isNew(); }
public boolean isNew() { return getDelegate().isNew(); }
/** * Test if Item.isNew() returns true directly after a new NodeItem is added * (before node is saved (transient)). * * @see javax.jcr.Item#isNew() */ public void testTransientNodeItemIsNew () throws RepositoryException { Node testNode = testRootNode.addNode(nodeName1, testNodeType); Item testNodeItem = superuser.getItem(testNode.getPath()); // check testNodeItem is new before save assertTrue("Item.isNew() must return true directly after a new NodeItem is added (before save of the parent node)", testNodeItem.isNew()); }
public boolean isNew() { return getDelegate().isNew(); }
/** * Test if Item.isNew() returns false after a NodeItem is added and * the node is saved (persistent). * * @see javax.jcr.Item#isNew() */ public void testPersistentNodeItemIsNew () throws RepositoryException { Node testNode = testRootNode.addNode(nodeName1, testNodeType); testRootNode.getSession().save(); Item testNodeItem = superuser.getItem(testNode.getPath()); // check testNodeItem is new after save assertFalse("Item.isNew() must return false after a new NodeItem is added and the parent Node is saved", testNodeItem.isNew()); }
/** * Test if Item.isNew() returns true direct after a new PropertyItem is set * (before node is saved (transient)). * * @see javax.jcr.Item#isNew() */ public void testTransientPropertyItemIsNew () throws RepositoryException { Property testProperty = testNode.setProperty(propertyName1, "test"); Item testPropertyItem = superuser.getItem(testProperty.getPath()); // check testPropertyItem.isNew() before save assertTrue("Item.isNew() must return true directly after a new Property is set (before current node is saved)", testPropertyItem.isNew()); }
builder.append("Property: "); if (item.isNew()) { builder.append("new "); } else if (item.isModified()) {
builder.append("Property: "); if (item.isNew()) { builder.append("new "); } else if (item.isModified()) {
/** * Test if Item.isNew() returns false after a new PropertyItem is set and * the node is saved (persistent). * This is equivalent to the test if Item.isNew() returns false for an * already exixting and not modified PropertyItem. * * @see javax.jcr.Item#isNew() */ public void testPersistentPropertyItemIsNew () throws RepositoryException { Property testProperty = testNode.setProperty(propertyName1, "test"); testNode.save(); Item testPropertyItem = superuser.getItem(testProperty.getPath()); // check testPropertyItem.isNew() after save assertFalse("Item.isNew() must return false after a new PropertyItem is set and the current Node is saved", testPropertyItem.isNew()); }
/** * Test if a node, that has been transiently removed is not 'New'. */ public void testNotNewRemovedItem() throws RepositoryException { removeItem.remove(); assertFalse("Transiently removed node must not be 'new'.", removeItem.isNew()); }
/** * Same as {@link #testNotNewRemovedItem()} but calls save() before * executing the test. */ public void testNotNewRemovedItem2() throws RepositoryException { removeItem.remove(); testRootNode.save(); assertFalse("Removed node must not be 'new'.", removeItem.isNew()); }
public void testRefreshMovedTree() throws RepositoryException { testRootNode.refresh(true); String msg = "Refresh must not revert a moved tree."; assertFalse(msg, superuser.itemExists(srcPath + "/" + nodeName2 + "/" + nodeName3)); int degree = destParentNode.getDepth(); List<Item> l = new ArrayList<Item>(); l.add(childNode); l.add(childProperty); l.add(grandChildNode); for (Iterator<Item> it = l.iterator(); it.hasNext();) { Item item = it.next(); assertTrue(msg, item.isNew()); assertTrue(msg, childNode.getAncestor(degree).isSame(destParentNode)); } } }
@Override protected void initPropertyNames() { super.initPropertyNames(); if (exists()) { names.addAll(JcrDavPropertyNameSet.EXISTING_ITEM_BASE_SET); try { if (item.getDepth() > 0) { names.add(JCR_PARENT); } } catch (RepositoryException e) { log.warn("Error while accessing node depth: " + e.getMessage()); } if (item.isNew()) { names.add(JCR_ISNEW); } else if (item.isModified()) { names.add(JCR_ISMODIFIED); } } else { names.addAll(JcrDavPropertyNameSet.ITEM_BASE_SET); } }
public void testSystemUsersAreSaved() throws Exception { String adminId = ((UserPerWorkspaceSecurityManager) secMgr).adminId; UserManager umgr = ((JackrabbitSession) superuser).getUserManager(); Principal p = umgr.getAuthorizable(adminId).getPrincipal(); if (p instanceof ItemBasedPrincipal) { Item item = superuser.getItem(((ItemBasedPrincipal) p).getPath()); assertFalse(item.isNew()); assertFalse(item.isModified()); } }
if (exists() && item.isNew()) { prop = new DefaultDavProperty<String>(JCR_ISNEW, null, true);
public void testRootNodeLifeCycle() throws Exception { // First check it does not exist ChromatticSession session = login(); Session jcrSession = session.getJCRSession(); String path = getRootNodePath(); assertFalse(jcrSession.itemExists(path)); // Perform an operation session.insert(A.class, "a"); // It should exist and be saved assertTrue(jcrSession.itemExists(path)); Item virtualRoot = jcrSession.getItem(path); assertFalse(virtualRoot.isNew()); // Save and close session.save(); session.close(); // Check it exists session = login(); jcrSession = session.getJCRSession(); assertTrue(jcrSession.itemExists(path)); session.close(); } }