本文整理了Java中javax.jcr.Node.removeMixin()
方法的一些代码示例,展示了Node.removeMixin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.removeMixin()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:removeMixin
[英]Removes the specified mixin node type from this node and removes mixinName
from this node's jcr:mixinTypes
property. Both the semantic change in effective node type and the persistence of the change to the jcr:mixinTypes
property occur on persist.
If this node does not have the specified mixin, a NoSuchNodeTypeException
is thrown either immediately, on dispatch or on persist. Implementations may differ on when this validation is done.
A ConstraintViolationException
will be thrown either immediately, on dispatch or on persist, if the removal of a mixin is not allowed. Implementations are free to enforce any policy with regard to mixin removal and may differ on when this validation is done.
A VersionException
is thrown either immediately, on dispatch or on persist, if this node is read-only due to a checked-in node. Implementations may differ on when this validation is done.
A LockException
is thrown either immediately or on save
if a lock prevents the removal of the mixin. Implementations may differ on when this validation is done.
[中]从此节点中删除指定的mixin节点类型,并从此节点的jcr:mixinTypes
属性中删除mixinName
。有效节点类型的语义更改和jcr:mixinTypes
属性更改的持久性都发生在persist上。
如果此节点没有指定的mixin,则在分派或持久化时立即抛出NoSuchNodeTypeException
。在完成此验证时,实现可能会有所不同。
如果不允许删除mixin,则ConstraintViolationException
将在分派或持久化时立即抛出。实现可以自由执行与mixin删除相关的任何策略,并且在完成此验证时可能会有所不同。
如果此节点由于签入节点而为只读,则在分派或持久化时立即抛出VersionException
。在完成此验证时,实现可能会有所不同。
如果锁阻止移除mixin,则会立即或在save
上抛出LockException
。在完成此验证时,实现可能会有所不同。
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public void removeMixin(String mixinName) throws NoSuchNodeTypeException, VersionException,
ConstraintViolationException, LockException, RepositoryException {
node.removeMixin(mixinName);
}
代码示例来源:origin: org.chromattic/chromattic.core
public boolean removeMixin(Node node, String mixinTypeName) throws RepositoryException {
try {
node.removeMixin(mixinTypeName);
return true;
} catch (NoSuchNodeTypeException ignore) {
// Mixin was not here
return false;
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void removeMixin(String type) throws RepositoryException {
this.node.removeMixin(type);
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
/**
* Removes the cq:ReplicationStatus mixin from the node if it has it.
*
* @param node the node
* @throws RepositoryException
*/
private void removeReplicationStatusMixin(final Node node) throws RepositoryException {
if (this.hasMixin(node, ReplicationStatus.NODE_TYPE)) {
node.removeMixin(ReplicationStatus.NODE_TYPE);
}
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public void removeMixin(String name)
throws RepositoryException, RemoteException {
try {
node.removeMixin(name);
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
/**
* Removes the cq:ReplicationStatus mixin from the node if it has it.
*
* @param node the node
* @throws RepositoryException
*/
private void removeReplicationStatusMixin(final Node node) throws RepositoryException {
if (this.hasMixin(node, ReplicationStatus.NODE_TYPE)) {
node.removeMixin(ReplicationStatus.NODE_TYPE);
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine
private void removeMixin(final Node node, final String mixin) throws RepositoryException {
for (NodeType mixinType : node.getMixinNodeTypes()) {
if (mixinType.getName().equals(mixin)) {
node.removeMixin(mixin);
return;
}
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-editor-repository
void checkout() throws RepositoryException {
// copy nodetype
if (draft == null) {
if (current == null) {
throw new ItemNotFoundException("Remodel node " + HippoNodeType.HIPPOSYSEDIT_NODETYPE
+ ", current version was not found for type " + subject.getPath());
}
draft = ((HippoSession) current.getSession()).copy(current, current.getParent().getPath() + "/"
+ HippoNodeType.HIPPOSYSEDIT_NODETYPE);
draft.removeMixin(HippoNodeType.NT_REMODEL);
}
}
代码示例来源:origin: info.magnolia/magnolia-core
private void removeHasVersionMixin(String destAbsPath) throws RepositoryException {
Node node = getSession().getNode(destAbsPath);
NodeUtil.visit(node, nodeToVisit -> {
if (NodeUtil.hasMixin(nodeToVisit, NodeTypes.HasVersion.NAME)) {
nodeToVisit.removeMixin(NodeTypes.HasVersion.NAME);
nodeToVisit.getSession().save();
}
});
}
}
代码示例来源: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: apache/jackrabbit-oak
public void testRemoveMixVersionable() throws Exception {
Node node = testRootNode.addNode(nodeName1);
node.addMixin(mixVersionable);
superuser.save();
node.removeMixin(mixVersionable);
superuser.save();
}
代码示例来源:origin: apache/jackrabbit-oak
public void testRemoveMixVersionable1() throws Exception {
Node node = testRootNode.addNode(nodeName1);
node.addMixin(mixReferenceable);
node.addMixin(mixVersionable);
superuser.save();
node.removeMixin(mixVersionable);
superuser.save();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveMixin() throws Exception {
((Node) superuser.getItem(childNode.getPath())).addMixin(mixinName);
superuser.save();
testSession.refresh(false);
modify(childNode.getPath(), Privilege.JCR_NODE_TYPE_MANAGEMENT, true);
childNode.removeMixin(mixinName);
testSession.save();
}
代码示例来源:origin: apache/jackrabbit-oak
public void testRemoveAddMixVersionable() throws Exception {
Node node = testRootNode.addNode(nodeName1);
node.addMixin(mixVersionable);
superuser.save();
String vhId = node.getVersionHistory().getUUID();
node.removeMixin(mixVersionable);
node.addMixin(mixVersionable);
superuser.save();
assertFalse(vhId.equals(node.getVersionHistory().getUUID()));
}
代码示例来源:origin: ModeShape/modeshape
@Test( expected = ConstraintViolationException.class )
public void shouldNotAllowRemovalIfExistingChildNodeWouldHaveNoDefinition() throws Exception {
Node a = session.getRootNode().addNode("a", BASE_PRIMARY_TYPE);
a.addMixin(MIXIN_TYPE_B);
a.addNode(CHILD_NODE_B);
session.save();
Node rootNode = session.getRootNode();
Node nodeA = rootNode.getNode("a");
nodeA.removeMixin(MIXIN_TYPE_B);
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldAllowRemovalIfExistingChildNodeWouldHaveDefinition() throws Exception {
Node a = session.getRootNode().addNode("a", "nt:unstructured");
a.addMixin(MIXIN_TYPE_B);
a.addNode(CHILD_NODE_B);
session.save();
Node rootNode = session.getRootNode();
Node nodeA = rootNode.getNode("a");
nodeA.removeMixin(MIXIN_TYPE_B);
}
代码示例来源:origin: apache/jackrabbit-oak
public void testRemoveAddMixVersionable1() throws Exception {
Node node = testRootNode.addNode(nodeName1);
node.addMixin(mixReferenceable);
node.addMixin(mixVersionable);
superuser.save();
String vhId = node.getVersionHistory().getUUID();
node.removeMixin(mixVersionable);
node.addMixin(mixVersionable);
superuser.save();
assertEquals(vhId, node.getVersionHistory().getUUID());
}
}
代码示例来源:origin: ModeShape/modeshape
@Test( expected = ConstraintViolationException.class )
public void shouldNotAllowRemovalIfExistingPropertyWouldHaveNoDefinition() throws Exception {
Node a = session.getRootNode().addNode("a", BASE_PRIMARY_TYPE);
a.addMixin(MIXIN_TYPE_B);
a.setProperty(PROPERTY_B, "true");
session.save();
Node rootNode = session.getRootNode();
Node nodeA = rootNode.getNode("a");
nodeA.removeMixin(MIXIN_TYPE_B);
session.save();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveMixin() throws Exception {
Node n = superuser.getNode(path);
deny(path, readPrivileges);
assertTrue(n.hasNode("rep:policy"));
assertTrue(n.isNodeType("rep:AccessControllable"));
n.removeMixin("rep:AccessControllable");
superuser.save();
assertFalse(n.hasNode("rep:policy"));
assertFalse(n.isNodeType("rep:AccessControllable"));
}
}
代码示例来源:origin: apache/jackrabbit
public void testRemoveMixin() throws Exception {
Node n = superuser.getNode(path);
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
withdrawPrivileges(path, privileges, getRestrictions(superuser, path));
assertTrue(n.hasNode("rep:policy"));
assertTrue(n.isNodeType("rep:AccessControllable"));
n.removeMixin("rep:AccessControllable");
superuser.save();
assertFalse(n.hasNode("rep:policy"));
assertFalse(n.isNodeType("rep:AccessControllable"));
}
}
内容来源于网络,如有侵权,请联系作者删除!