jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Kofler <roland.kof...@systemone.at>
Subject For restoring a node, a IGNOREed child node throws ConstrainViolationException
Date Sun, 22 Jan 2006 22:20:13 GMT
A version IGNORED child node should remain in the node tree if you 
revert to a previous version. This is stated in the subchapter 8.2.11.5 
of JCR170.
I've found that jackrabbit removes the IGNORED child node after a 
revert, wich is wrong.


Neverthenless I have to say: You are great!
Roland


doing this:

 public void revertToVersion(Node jcrNode, NodeHolder nodeHolder) {
        try {
            jcrNode.restore((Version) 
(nodeHolder.getJcrNode().getParent()), false);
        } catch (RepositoryException e) {
            throw new IllegalStateException(e);
        }
    }

on that:

  <!-- PAGE -->
    <!-- page definition -->
    <nodeType hasOrderableChildNodes="true" isMixin="false" 
name="s1NT:page" primaryItemName="">
        <supertypes>
            <supertype>nt:base</supertype>
            <supertype>mix:referenceable</supertype>
            <supertype>mix:versionable</supertype>
            <supertype>mix:lockable</supertype>
        </supertypes>
        ...
    <!-- similarity results root child node -->
        <childNodeDefinition autoCreated="true" 
defaultPrimaryType="s1NT:similarityRoot" mandatory="true"
                             name="s1:similarityRoot" 
onParentVersion="IGNORE" protected="false" sameNameSiblings="false">
        </childNodeDefinition>
    </nodeType>
...

leads to:

java.lang.IllegalStateException: 
javax.jcr.nodetype.ConstraintViolationException: /s1:pages/s1:page: 
mandatory child node {http://www.systemone.at/jcr}similarityRoot does 
not exist
 ...
    at 
org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:557)
    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1131)
    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:758)
    at 
org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3502)
    at org.apache.jackrabbit.core.NodeImpl.restore(NodeImpl.java:2848)
    at 
at.systemone.wiki.node.PageNodeWorker.revertToVersion(PageNodeWorker.java:21)
    ... 18 more










Mime
View raw message