本文整理汇总了Java中info.magnolia.jcr.util.NodeUtil.renameNode方法的典型用法代码示例。如果您正苦于以下问题:Java NodeUtil.renameNode方法的具体用法?Java NodeUtil.renameNode怎么用?Java NodeUtil.renameNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类info.magnolia.jcr.util.NodeUtil
的用法示例。
在下文中一共展示了NodeUtil.renameNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNodeName
import info.magnolia.jcr.util.NodeUtil; //导入方法依赖的package包/类
@Override
protected void setNodeName(final Node node, final JcrNodeAdapter item) throws RepositoryException {
try {
if (item.isNew() || NewsWorkspaceUtil.hasNameChanged(node, getDefinition().getPropertyName())) {
final String newNodeName = NewsWorkspaceUtil.generateUniqueNodeName(node, getDefinition().getPropertyName());
item.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
} catch (PathNotFoundException e) {
LOGGER.error("Trying to fetch value of a non-existant propertyName", e);
}
}
示例2: setNodeName
import info.magnolia.jcr.util.NodeUtil; //导入方法依赖的package包/类
@Override
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
JcrNodeAdapter itemChanged = item;
// Set the Node Composite Name
if (itemChanged instanceof JcrNewNodeAdapter || !node.getName().startsWith(defineNodeName(node))) {
final String newNodeName = generateUniqueNodeNameForTag(node);
itemChanged.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
}
示例3: setNodeName
import info.magnolia.jcr.util.NodeUtil; //导入方法依赖的package包/类
@Override
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
try {
if (item.isNew() || BlogWorkspaceUtil.hasNameChanged(node, getDefinition().getPropertyName())) {
final String newNodeName = BlogWorkspaceUtil.generateUniqueNodeName(node, getDefinition().getPropertyName());
item.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
} catch (PathNotFoundException e) {
LOGGER.error("Trying to fetch value of a non-existent propertyName", e);
}
}
示例4: setNodeName
import info.magnolia.jcr.util.NodeUtil; //导入方法依赖的package包/类
/**
* Set the node Name. Node name is set to: <br>
* the value of the property 'name' if it is present.
*/
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
String propertyName = "name";
if (node.hasProperty(propertyName) && !node.hasProperty(ModelConstants.JCR_NAME)) {
Property property = node.getProperty(propertyName);
String newNodeName = property.getString();
if (!node.getName().equals(Path.getValidatedLabel(newNodeName))) {
newNodeName = Path.getUniqueLabel(node.getSession(), node.getParent().getPath(), Path.getValidatedLabel(newNodeName));
item.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
}
}
示例5: setNodeName
import info.magnolia.jcr.util.NodeUtil; //导入方法依赖的package包/类
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
if (node.hasProperty(PN_VANITY_URL) && !node.hasProperty("jcrName")) {
String newNodeName = _nodeNameHelper.getValidatedName(getNormalizedVanityUrl(node));
if (!node.getName().equals(newNodeName)) {
newNodeName = _nodeNameHelper.getUniqueName(node.getParent(), newNodeName);
item.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
}
}