Folder-File relationship in versioning

View: New views
2 Messages — Rating Filter:   Alert me  

Folder-File relationship in versioning

by Ruchi Goel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
     My Folder is  non-versionable but Files under the folder are
versionable. The test which is in PersistenceManagerJcrNodeTypeTest.java
adds file as child of folder .So, you do
persistenceManager.insert(folder);    *
*persistenceManager.save();

How will I do the checkout and checkin separately for file ? I believe
,  I need to do  save and checkin  the file independently from folder.

 *//---------------------------------------------------------------------------------------------------------
            // Insert a  folder (class mapped to jcr:folder) with one
file (class mapped to jcr:file)
           
 //---------------------------------------------------------------------------------------------------------  
         
            Resource resource = new Resource();
            resource.setData(new ByteArrayInputStream("this is the
content".getBytes()));            
            resource.setLastModified(Calendar.getInstance());
            resource.setMimeType("plain/text");
            File file = new File();    
            file.setResource(resource);
           
           
            Folder folder = new Folder();
            folder.setPath("/folder1");
            folder.addChild(file);
           
            persistenceManager.insert(folder);            
            persistenceManager.save();

*
Thanks,
Ruchi*
*

Re: Folder-File relationship in versioning

by Christophe Lombart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 3/9/07, ruchi goel <Ruchi.Goel@...> wrote:

>
> Hi,
>      My Folder is  non-versionable but Files under the folder are
> versionable. The test which is in PersistenceManagerJcrNodeTypeTest.java
> adds file as child of folder .So, you do
> persistenceManager.insert(folder);    *
> *persistenceManager.save();
>
> How will I do the checkout and checkin separately for file ? I believe
> ,  I need to do  save and checkin  the file independently from folder.


yes. See the class PersistenceManagerBasicVersionning for more examples.


*//---------------------------------------------------------------------------------------------------------

>             // Insert a  folder (class mapped to jcr:folder) with one
> file (class mapped to jcr:file)
>
>
> //---------------------------------------------------------------------------------------------------------
>
>             Resource resource = new Resource();
>             resource.setData(new ByteArrayInputStream("this is the
> content".getBytes()));
>             resource.setLastModified(Calendar.getInstance());
>             resource.setMimeType("plain/text");
>             File file = new File();
>             file.setResource(resource);
>
>
>             Folder folder = new Folder();
>             folder.setPath("/folder1");
>             folder.addChild(file);
>
>             persistenceManager.insert(folder);
>             persistenceManager.save();
>
> *
> Thanks,
> Ruchi*
> *
>
LightInTheBox - Buy quality products at wholesale price