I would like to remove the child node by keeping the parent node hierarchy as is. can someone help how to achieve this.
For e.g.
/content
/person
/name
/age
I would like to remove only child node "/name" here
you can use various ways via code using java JCR API
----
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 );
}
---------------
I would like to retain the parent structure for e.g.
/content
/person
/name
/age
/content/person should retain while "name" is removed only
Views
Replies
Total Likes
Another way would be to run the groovy script to remove a node from a specific path. check [1] and "Remove corrupted nodes manually" at [2] on how to use it.
This should only remove the child node
[1] Groovy script to remove a node at a given path · GitHub
[2] Offline Compaction fails with SegmentNotFoundException & IllegalArgumentException
Views
Likes
Replies