本文整理了Java中javax.jcr.Node.isNew()
方法的一些代码示例,展示了Node.isNew()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.isNew()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:isNew
暂无
代码示例来源:origin: ModeShape/modeshape
private Node getMetadataNode( Node outputNode ) throws RepositoryException {
if (outputNode.isNew()) {
outputNode.setPrimaryType(METADATA_NODE);
return outputNode;
}
return outputNode.addNode(METADATA_NODE, METADATA_NODE);
}
代码示例来源:origin: org.modeshape/modeshape-sequencer-images
private Node getImageMetadataNode( Node outputNode ) throws RepositoryException {
if (outputNode.isNew()) {
outputNode.setPrimaryType(ImageMetadataLexicon.METADATA_NODE);
return outputNode;
}
return outputNode.addNode(ImageMetadataLexicon.METADATA_NODE, ImageMetadataLexicon.METADATA_NODE);
}
代码示例来源:origin: ModeShape/modeshape
private Node getMetadataNode( Node outputNode ) throws RepositoryException {
if (outputNode.isNew()) {
outputNode.setPrimaryType(METADATA_NODE);
return outputNode;
}
return outputNode.addNode(METADATA_NODE, METADATA_NODE);
}
代码示例来源:origin: ModeShape/modeshape
private Node getMetadataNode( Node outputNode ) throws RepositoryException {
if (outputNode.isNew()) {
outputNode.setPrimaryType(OdfMetadataLexicon.METADATA_NODE);
return outputNode;
}
return outputNode.addNode(OdfMetadataLexicon.METADATA_NODE, OdfMetadataLexicon.METADATA_NODE);
}
代码示例来源:origin: ModeShape/modeshape
private Node createTopLevelNode( Node outputNode ) throws RepositoryException {
// Create top-level node
if (!outputNode.isNew()) {
outputNode = outputNode.addNode(ZipLexicon.CONTENT);
}
outputNode.setPrimaryType(ZipLexicon.FILE);
return outputNode;
}
代码示例来源:origin: ModeShape/modeshape
private Node getPdfMetadataNode( Node outputNode ) throws RepositoryException {
if (outputNode.isNew()) {
outputNode.setPrimaryType(PdfMetadataLexicon.METADATA_NODE);
return outputNode;
}
return outputNode.addNode(PdfMetadataLexicon.METADATA_NODE, PdfMetadataLexicon.METADATA_NODE);
}
代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault
/**
* {@inheritDoc}
*/
@Override
public void startDocument() throws SAXException {
try {
stack = new StackElement(parentNode, parentNode.isNew());
} catch (RepositoryException e) {
throw new SAXException(e);
}
}
代码示例来源:origin: info.magnolia/magnolia-core
private static void dumpChanges(Node node, PrintWriter out) throws RepositoryException {
if (node.isModified()) {
out.println(node.getPath() + " is modified");
} else if (node.isNew()) {
out.println(node.getPath() + " is new");
}
for (Iterator iter = node.getNodes(); iter.hasNext(); ) {
Node child = (Node) iter.next();
dumpChanges(child, out);
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void move(String srcAbsPath, String destAbsPath) throws PathNotFoundException, VersionException, ConstraintViolationException, LockException, ItemExistsException, RepositoryException {
Node node = getNode(srcAbsPath);
// we want to remove mixin when copying node via NodeUtil
if (node.isNew() && TEMPORARY_NODE.matcher(srcAbsPath).matches() && NodeUtil.hasMixin(node, NodeTypes.HasVersion.NAME)) {
node.removeMixin(NodeTypes.HasVersion.NAME);
}
getWrappedSession().move(srcAbsPath, destAbsPath);
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertNumberOfModifiedOrNewChildren( Node node,
int expected ) throws Exception {
int numModifiedOrNewChildren = 0;
for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
Node child = iter.nextNode();
if (child.isNew() || child.isModified()) ++numModifiedOrNewChildren;
}
assertThat(numModifiedOrNewChildren, is(expected));
}
}
代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr
private void saveParent(Node node) throws RepositoryException {
Node parent = node.getParent();
if (parent.isNew()) {
saveParent(parent);
} else if (parent.isModified()) {
parent.save();
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertNoModifiedOrNewOrRemovedChildren( Node node ) throws Exception {
for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
Node child = iter.nextNode();
assertThat(child.isNew(), is(false));
assertThat(child.isModified(), is(false));
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testIsNew() throws RepositoryException, InterruptedException {
Session session = getAdminSession();
Node root = session.getRootNode();
Node node1 = root.addNode("node1");
session.save();
node1.remove();
Node node2 = root.addNode("node2");
assertTrue("The Node is just added", node2.isNew());
Node node1Again = root.addNode("node1");
assertTrue("The Node is just added but has a remove in same commit", node1Again.isNew());
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if a node, that has be transiently added and removed is not 'New'.
*/
public void testNotNewRemovedNode() throws RepositoryException {
removeNode.remove();
assertFalse("Removed transient node must not be 'new'.", removeNode.isNew());
}
代码示例来源:origin: apache/jackrabbit-oak
public void testCheckoutWithPendingChanges() throws Exception {
Node node = testRootNode.addNode(nodeName1, testNodeType);
node.addMixin(mixVersionable);
superuser.save();
node.checkin();
Node newNode = testRootNode.addNode(nodeName2, testNodeType);
assertTrue(newNode.isNew());
node.checkout();
assertTrue(node.isCheckedOut());
assertTrue(newNode.isNew());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testIsNewReturnsFalseByDefault() throws Exception {
Node newNode = new MockNode("qux");
assertFalse(newNode.isNew());
}
代码示例来源:origin: apache/jackrabbit
public void testMove() throws RepositoryException {
String srcPath = moveNode.getPath();
testRootNode.getSession().move(srcPath, destinationPath);
assertTrue(destParentNode.isNew());
assertTrue(moveNode.isModified());
assertTrue(testRootNode.getSession().itemExists(destinationPath));
assertFalse(testRootNode.getSession().itemExists(srcPath));
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void savedNodeShouldHaveNoNewOrModifiedProperties() throws Exception {
assertThat(savedNode.isNew(), is(false));
assertThat(savedNode.isModified(), is(false));
assertNoModifiedOrNewProperties(savedNode);
assertNoModifiedOrNewOrRemovedChildren(savedNode);
}
代码示例来源:origin: apache/jackrabbit
public void testMoveSaved() throws RepositoryException {
String srcPath = moveNode.getPath();
testRootNode.getSession().move(srcPath, destinationPath);
testRootNode.save();
assertFalse(destParentNode.isNew());
assertFalse(srcParentNode.isModified());
assertFalse(moveNode.isModified());
assertTrue(testRootNode.getSession().itemExists(destinationPath));
assertFalse(testRootNode.getSession().itemExists(srcPath));
}
代码示例来源:origin: apache/jackrabbit
public void testRemoveDestParent() throws RepositoryException {
String srcPath = moveNode.getPath();
testRootNode.getSession().move(srcPath, destinationPath);
destParentNode.remove();
assertFalse(destParentNode.isNew());
assertFalse(destParentNode.isModified());
assertFalse(moveNode.isModified());
assertTrue(srcParentNode.isModified());
assertFalse(testRootNode.getSession().itemExists(srcPath));
}
内容来源于网络,如有侵权,请联系作者删除!