cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Versioning (folders and nodes)

al_fresco
Champ in-the-making
Champ in-the-making
Hi all,
i have a problem that concerns with node Versioning in Alfresco.
I try to explain my scenario: using the Java Foundation API, I want to create a version of a folder node and all its child (content) node. I'm doing that with the follow code:

(Assuming that "folder" is for example the root folder Company_home)


        // create PARENT node
        NodeRef parent = nodeService.createNode(folder,
              ContentModel.ASSOC_CONTAINS,
              QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
                ContentModel.TYPE_FOLDER,
                contentProps).getChildRef();
      nodeService.addAspect(parent,ContentModel.ASPECT_VERSIONABLE, null);
      
      // create first CHILD node
        NodeRef firstChild = nodeService.createNode(parent,
              ContentModel.ASSOC_CONTAINS,
              QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, parent.getId()),
                ContentModel.TYPE_CONTENT).getChildRef();
        nodeService.addAspect(firstChild,ContentModel.ASPECT_VERSIONABLE, null);

      Map<String, Serializable> versionProps = new HashMap<String, Serializable>();
       
      //create the first version
      versionProps.put("NomeVersione", "prima");
      versionService.createVersion(parent, versionProps, false);
      
      //create second CHILD node
      NodeRef secondChild = nodeService.createNode(parent,
            ContentModel.ASSOC_CONTAINS,
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, parent.getId()),
              ContentModel.TYPE_CONTENT).getChildRef();
      nodeService.addAspect(secondChild,ContentModel.ASPECT_VERSIONABLE, null);
      
      //crea the second version
      versionProps.put("NomeVersione", "seconda");
        versionService.createVersion(parent, versionProps, false);
      
      // END OF ADD OPERATIONS
      
      nodeService.removeChild(parent, firstChild);
      
After the end of add operations, I want to remove a particular node (the one called "firstChild").
It happens, but this deletion occurs even in all previous versions!
But the remove should happen only on the "live" SpaceStore and not on the "frozen" VersionStore.
How can I leave unaltered the first and second version?
Can anybody help me?
Many thanks!
Alessandro
1 REPLY 1

dooman
Champ in-the-making
Champ in-the-making
I have the same problem. Has anybody solution for it?

Alfresco 4.0.d