本文整理匯總了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
}
}