jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomasz Dabrowski" <Tomasz.Dabrow...@cognifide.com>
Subject RE: adding two time the same label for history...
Date Thu, 10 Nov 2005 12:18:05 GMT
> can you provide your code example?
here is it...

    /**
     * Adds labels to all nodes in chosen subtree.
     * 
     * @param node root node of subtree.
     * @param label label to be set.
     */
    public static void addLabel(Node node, String label) {
        try {
            String versionName = node.getBaseVersion().getName();
            node.getVersionHistory().addVersionLabel(versionName, label,
false);

            for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
                addLabel(iter.nextNode(), label);
            }

        }
        catch (UnsupportedRepositoryOperationException e) {
            ;
        }
        catch (RepositoryException e) {
            throw ExceptionMapper.map(e);
        }
    }

Node myRoot = session.getRootNode().getNode("myRoot");
addLabel(myRoot, "MY_LABEL"); 

// this should throw exception
addLabel(myRoot, "MY_LABEL"); 


--
Tomasz Dabrowski
email: tomasz.dabrowski@cognifide.com
www: www.cognifide.com

Mime
View raw message