本文整理了Java中javax.jcr.Property.remove()
方法的一些代码示例,展示了Property.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.remove()
方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:remove
暂无
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void runTest() throws Exception {
Node node = session.getRootNode().getNode(ROOT_NODE_NAME);
for (int i = 1; i < CHILD_COUNT; i++) {
node.getNode("node" + i).setProperty("foo", "bar");
session.save();
node.getNode("node" + i).getProperty("foo").remove();
node.getNode("node0").setProperty("foo", i);
session.save();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
/**
* remove specified property.
*
* @param name of the property to be removed
* @throws PathNotFoundException if property does not exist
* @throws RepositoryException if unable to remove
*/
public void removeProperty(String name) throws PathNotFoundException, RepositoryException {
this.node.getProperty(this.getInternalPropertyName(name)).remove();
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException {
getWrappedProperty().remove();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@MgnlDeprecated(since = "5.6.2", description = "No need to call since #addComment should not be called.")
@Deprecated
protected void cleanComment(final Node node) throws RepositoryException {
synchronized (ExclusiveWrite.getInstance()) {
if (node.hasProperty(NodeTypes.Versionable.COMMENT)
&& !StringUtils.EMPTY.equals(node.getProperty(NodeTypes.Versionable.COMMENT).getString())) {
node.getProperty(NodeTypes.Versionable.COMMENT).remove();
node.getSession().save();
}
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons
public void removeProperty(String key) throws RepositoryException {
Node parent = getParent(key);
Property p = parent.getProperty(key);
p.remove();
treeManager.join(this, parent, p);
if (autoSave) {
parent.getSession().save();
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-api
protected void setStringsProperty(String relPath, String[] values) throws RepositoryException {
if (hasNode()) {
Node node = getCheckedOutNode();
if (values == null) {
if (node.hasProperty(relPath)) {
node.getProperty(relPath).remove();
}
} else {
node.setProperty(relPath, values);
}
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-api
protected void setStringProperty(String relPath, String value) throws RepositoryException {
if (hasNode()) {
Node node = getCheckedOutNode();
if (value == null) {
if (node.hasProperty(relPath)) {
node.getProperty(relPath).remove();
}
} else {
node.setProperty(relPath, value);
}
}
}
代码示例来源:origin: apache/jackrabbit
private void assertNoEffect(Node target, String childName, String propName) throws RepositoryException {
Session s = target.getSession();
Node n = target.addNode(childName);
Value v = getJcrValue(s, RepositoryStub.PROP_PROP_VALUE2, RepositoryStub.PROP_PROP_TYPE2, "test");
Property p = target.setProperty(propName, v);
n.remove();
p.remove();
}
代码示例来源:origin: apache/jackrabbit
public void removeProperty(String key) throws RepositoryException {
Node parent = getParent(key);
Property p = parent.getProperty(key);
p.remove();
treeManager.join(this, parent, p);
if (autoSave) {
parent.getSession().save();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
protected void operateOnNode(InstallContext installContext, Node node) {
try {
node.getProperty("icon").remove();
} catch (RepositoryException e) {
installContext.warn(String.format("The legacy icon property couldn't be removed for the following node: %s", NodeUtil.getNodePathIfPossible(node)));
}
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons
/**
* Move <code>property</code> to the new <code>parent</code>.
*/
protected void move(Property property, Node parent) throws RepositoryException {
parent.setProperty(property.getName(), property.getValue());
property.remove();
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void delete() throws RepositoryException {
if (isExist()) {
getJCRProperty().remove();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
public static Property renameProperty(Property property, String newName) throws RepositoryException {
// Do nothing if the property already has this name, otherwise we would remove the property
if (property.getName().equals(newName)) {
return property;
}
Node node = property.getParent();
Property newProperty = node.setProperty(newName, property.getValue());
property.remove();
return newProperty;
}
代码示例来源:origin: info.magnolia/magnolia-core
public static void moveProperty(Property source, Node targetNode) throws RepositoryException {
// JCR props can't be moved, we gotta recreate w/ same value and delete
if (source.isMultiple()) {
targetNode.setProperty(source.getName(), source.getValues());
} else {
targetNode.setProperty(source.getName(), source.getValue());
}
source.remove();
}
代码示例来源:origin: info.magnolia/magnolia-i18n
private void handleNode(Node node, String[] properties) throws RepositoryException {
PropertyIterator propertyIterator = node.getProperties(properties);
while (propertyIterator.hasNext()) {
Property property = propertyIterator.nextProperty();
if (DEPRECATED_I18N_PROPERTIES.contains(property.getName())) {
log.info("SiteMap i18n property removed: '{}' ", property.getPath());
property.remove();
}
}
}
代码示例来源:origin: info.magnolia/magnolia-core
protected void purgeContent(Node node) throws RepositoryException {
// delete paragraphs & collections
for (Iterator<Node> iter = new FilteringNodeIterator(node.getNodes(), new RuleBasedNodePredicate(getRule())); iter.hasNext(); ) {
iter.next().remove();
}
// delete properties (incl title ??)
for (Iterator<Property> iter = new FilteringPropertyIterator(node.getProperties(), new JCRMgnlPropertyHidingPredicate()); iter.hasNext(); ) {
Property property = iter.next();
property.remove();
}
}
代码示例来源:origin: apache/jackrabbit
public void testRemovedNewProperty() throws RepositoryException, LockException, ConstraintViolationException, VersionException {
Property p = testRootNode.setProperty(propertyName1, testValue);
p.remove();
testRootNode.refresh(false);
try {
p.getString();
fail("Refresh 'false' must not bring a removed new child property back to life.");
} catch (InvalidItemStateException e) {
// ok
}
assertFalse("Refresh 'false' must not bring a removed new child property back to life.", testRootNode.hasProperty(propertyName1));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void descendantSuggestionRequirePathRestrictionIndex() throws Exception {
Node rootIndexDef = root.getNode("oak:index/sugg-idx");
rootIndexDef.getProperty(EVALUATE_PATH_RESTRICTION).remove();
rootIndexDef.setProperty(REINDEX_PROPERTY_NAME, true);
session.save();
//Without path restriction indexing, descendant clause shouldn't be respected
validateSuggestions(
createSuggestQuery(NT_OAK_UNSTRUCTURED, "te", "/content1"),
newHashSet("test1", "test2", "test3", "test4", "test5", "test6"));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void accessRemovedProperty() throws RepositoryException {
Node foo = getNode("/foo");
Property p = foo.setProperty("name", "value");
p.remove();
try {
p.getPath();
fail("Expected InvalidItemStateException");
}
catch (InvalidItemStateException expected) {
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testMoveAndRemovePropertyAtSource2() throws Exception {
setupMovePermissions();
allow(childNPath, privilegesFromName(PrivilegeConstants.REP_REMOVE_PROPERTIES));
testSession.move(nodePath3, siblingDestPath);
Node n = testSession.getNode(childNPath);
assertTrue(n.hasProperty(propertyName1));
n.getProperty(propertyName1).remove();
testSession.save();
}
内容来源于网络,如有侵权,请联系作者删除!