You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by ruchi goel <Ru...@Sun.COM> on 2007/03/09 12:30:19 UTC
Folder-File relationship in versioning
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
Posted by Christophe Lombart <ch...@gmail.com>.
On 3/9/07, ruchi goel <Ru...@sun.com> 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*
> *
>