You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by abhishek reddy <ab...@gmail.com> on 2010/01/29 11:32:20 UTC

Regarding Versioning File Node

hi every one,

Need help in versioning FileNode....... How to version the FileNode?


-- 
Abhishek

Re: Regarding Versioning File Node

Posted by Tobias Bocanegra <tr...@day.com>.
On Sat, Jan 30, 2010 at 6:51 AM, abhishek reddy
<ab...@gmail.com> wrote:
> here is the code which i tried....
>
> // Get the destinationNode to which the file to be added
>                        Node destinationNode = rootNode.addNode(
> destinationNodeName);
>                        Node file = destinationNode.addNode(fileName,
> "nt:file");
>                        Node contentNode = file.addNode("jcr:content",
> "nt:resource");
>
>                        // Make a stream object using the file path
>                        InputStream fileStream = new
> FileInputStream(filePath);
>
>                        // set the mandatory properties
>                        contentNode.setProperty("jcr:data", fileStream);
>                        contentNode.setProperty("jcr:lastModified",
> Calendar.getInstance());
>                        contentNode.setProperty("jcr:mimeType", mimeType);
>
>                        session.save();
>
> Inorder to make node versionable......... do i need to add
>
> destinationNode.addMixin( "mix:versionable" );
> (or)
> contentNode .addMixin( "mix:versionable" );

it depends what you want to version. if you want to version the entire
destinationNodeName "folder", you add it there. if you on;y wnat to
version the file conten, you add it there.

regards, toby


>
>
>
>
> On Fri, Jan 29, 2010 at 4:02 PM, abhishek reddy <ab...@gmail.com>
> wrote:
>>
>> hi every one,
>>
>> Need help in versioning FileNode....... How to version the FileNode?
>>
>>
>> --
>> Abhishek
>
>
>
> --
> Abhishek
>

Re: Regarding Versioning File Node

Posted by abhishek reddy <ab...@gmail.com>.
here is the code which i tried....

// Get the destinationNode to which the file to be added
                       *Node destinationNode = rootNode.addNode(*
*destinationNodeName);
                       Node file = destinationNode.addNode(**fileName,
"nt:file");*
                       Node contentNode = file.addNode("jcr:content",
"nt:resource");

                       // Make a stream object using the file path
                       InputStream fileStream = new
FileInputStream(filePath);

                       // set the mandatory properties
                       contentNode.setProperty("jcr:data", fileStream);
                       contentNode.setProperty("jcr:lastModified",
Calendar.getInstance());
                       contentNode.setProperty("jcr:mimeType", mimeType);

                       session.save();

Inorder to make node versionable......... do i need to add

*destinationNode.addMixin( "mix:versionable" );
(or)
contentNode .addMixin( "mix:versionable" );*




On Fri, Jan 29, 2010 at 4:02 PM, abhishek reddy <ab...@gmail.com>wrote:

> hi every one,
>
> Need help in versioning FileNode....... How to version the FileNode?
>
>
> --
> Abhishek
>



-- 
Abhishek