本文整理汇总了Java中javax.jcr.Node.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Node.remove方法的具体用法?Java Node.remove怎么用?Java Node.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jcr.Node
的用法示例。
在下文中一共展示了Node.remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeNamespace
import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void removeNamespace( String repositoryId, String projectId )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String path = getNamespacePath( repositoryId, projectId );
if ( root.hasNode( path ) )
{
Node node = root.getNode( path );
if ( node.isNodeType( NAMESPACE_NODE_TYPE ) )
{
node.remove();
}
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例2: removeMetadataFacet
import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void removeMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String path = getFacetPath( repositoryId, facetId, name );
if ( root.hasNode( path ) )
{
Node node = root.getNode( path );
do
{
// also remove empty container nodes
Node parent = node.getParent();
node.remove();
node = parent;
}
while ( !node.hasNodes() );
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例3: removeProjectVersion
import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException
{
try
{
String path = getProjectPath( repoId, namespace, projectId );
Node root = getJcrSession().getRootNode();
Node nodeAtPath = root.getNode( path );
for ( Node node : JcrUtils.getChildNodes( nodeAtPath ) )
{
if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) && StringUtils.equals( projectVersion,
node.getName() ) )
{
node.remove();
}
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例4: deleteFile
import javax.jcr.Node; //导入方法依赖的package包/类
public void deleteFile(String path,User user) throws Exception{
if(!permissionService.fileHasWritePermission(path)){
throw new NoPermissionException();
}
repositoryInteceptor.deleteFile(path);
path = processPath(path);
Node rootNode=getRootNode();
if (!rootNode.hasNode(path)) {
throw new RuleException("File [" + path + "] not exist.");
}
String[] subpaths = path.split("/");
Node fileNode = rootNode;
for (String subpath : subpaths) {
if (StringUtils.isEmpty(subpath)) {
continue;
}
String subDirs[] = subpath.split("\\.");
for (String dir : subDirs) {
if (StringUtils.isEmpty(dir)) {
continue;
}
if (!fileNode.hasNode(dir)) {
continue;
}
fileNode = fileNode.getNode(dir);
lockCheck(fileNode,user);
if (!fileNode.isCheckedOut()) {
versionManager.checkout(fileNode.getPath());
}
}
}
fileNode = rootNode.getNode(path);
lockCheck(fileNode,user);
if (!fileNode.isCheckedOut()) {
versionManager.checkout(fileNode.getPath());
}
fileNode.remove();
session.save();
}
示例5: removeProject
import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void removeProject( String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String namespacePath = getNamespacePath( repositoryId, namespace );
if ( root.hasNode( namespacePath ) )
{
Iterator<Node> nodeIterator = JcrUtils.getChildNodes( root.getNode( namespacePath ) ).iterator();
while ( nodeIterator.hasNext() )
{
Node node = nodeIterator.next();
if ( node.isNodeType( PROJECT_NODE_TYPE ) && projectId.equals( node.getName() ) )
{
node.remove();
}
}
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例6: removeArtifact
import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void removeArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
String id )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String path = getArtifactPath( repositoryId, namespace, projectId, projectVersion, id );
if ( root.hasNode( path ) )
{
root.getNode( path ).remove();
}
// remove version
path = getProjectPath( repositoryId, namespace, projectId );
Node nodeAtPath = root.getNode( path );
for ( Node node : JcrUtils.getChildNodes( nodeAtPath ) )
{
if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) //
&& StringUtils.equals( node.getName(), projectVersion ) )
{
node.remove();
}
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例7: removeWithExistingNodeRemovesNode
import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void removeWithExistingNodeRemovesNode() throws Exception {
Node target = aNode("/content");
Node testObj = target.addNode("foobar123");
assertThat(testObj, nodeExistsAt("/content/foobar123"));
testObj.remove();
try {
testObj.getNode("foobar123");
fail();
} catch (PathNotFoundException ex) {
// passed
}
}