I think I have confused a bit, I'm not replicating anything.

We have a multi user scenario where every user gets a home folder. Users
can share contents from his/her home with other users. For every
file/folder to be shared we are mixing referenceable and creating a
linkedFile as below:

Node shareable = //get the node to share
shareable.addMixin("mix:referenceable").

Then create a link in another users home

Node linkedNode =
sharedfolder.addNode(shareable.getName,JcrConstants.NT_LINKEDFILE)
linkedNode.setProperty("jcr:content", contentNode)

I don't know how to dereference and descent a linked folder for a query:
"select f.* from [nt:base] as f where ISDESCENDANTNODE(f,'/folder')".

I'm having a look at your github project.

Rahul.

On Sun, Apr 3, 2016 at 1:56 AM, Clay Ferguson <[email protected]> wrote:

> ​If you want to create a replica of your data, chances are (no offence)
> that you are misunderstanding something. If you can please share why you
> think the duplicate data is necessary.
>
> But if you really want to duplicate using links to the actual nodes, one
> way is to just use a property on the "shadow tree" that points to the real
> node via jcr:uuid value as a property. So the property is on the node that
> 'points to' the other node. Read up also on "mix:referenceable" before you
> get started.
>
> check out my meta64.com codebase. That app is all about JCR/tree editing,
> and has some searching examples also using isdescendantnode a lot.
>
> Best regards,
> Clay Ferguson
> [email protected]
>
>
> On Sat, Apr 2, 2016 at 10:41 AM, Rahul Raj <
> [email protected]>
> wrote:
>
> > I can add a  node property to the leaf nodes. Will it help in
> dereferencing
> > the linked files?
> >
> > Let me make the question clear with the structure below.
> >
> > rootfolder
> >          -nt:file(file1)
> >          -nt:folder(folder1)
> >                            -nt:file(file2)
> >                            -nt:file(file3)
> >          -nt:file(file4)
> >
> > Here, a query like select f.* from [nt:file] as f where
> > ISDESCENDANTNODE(f,'/rootfolder')
> > fetches all files from root folder.
> >
> > Now the same files are linked to form a sharedfolder as below:
> >
> > sharedfolder
> >          -nt:linkedfile(to file1)
> >          -nt:linkedfile(to folder1)
> >                               -file2
> >                               -file3
> >          -nt:linkedfile(to file4)
> >
> > What query would achieve similar results?
> >
> > Rahul
> >
> > On Sat, Apr 2, 2016 at 8:29 PM, Clay Ferguson <[email protected]> wrote:
> >
> > > probably the way that makes most sense is make your files (leaf nodes)
> a
> > > specific node type, or else let them all have a property that you can
> > test
> > > for like "objType=file" or something. Even if you found a solution
> based
> > on
> > > finding nodes that are leaf nodes, or have no children or whatever, i
> > would
> > > still go with the approach I just said, because it's clean, and allows
> > more
> > > nodes to be attached to the tree later on without "breaking your logic"
> > > about how to find all files under some branch.
> > >
> > > Best regards,
> > > Clay Ferguson
> > > [email protected]
> > >
> > >
> > > On Fri, Apr 1, 2016 at 11:30 PM, Rahul Raj <
> > > [email protected]>
> > > wrote:
> > >
> > > > We have a shared directory structure as shown below. The shared
> folder
> > > has
> > > > links to files and folders.
> > > >
> > > > sharedfolder
> > > >          -nt:linkedfile(file1)
> > > >          -nt:linkedfile(folder1)
> > > >                               -file2
> > > >                               -file3
> > > >          -nt:linkedfile(file4)
> > > >
> > > > How to write a jcr sql2 query that will fetch all of
> file1,file2,file3
> > > and
> > > > file4 while performing a  ISDESCENDANTNODE on the sharedfolder
> > > > I could not figure out a way to de-reference the linkedFiles while
> > using
> > > > ISDESCENDANTNODE.
> > > >
> > > >
> > > > Regards,
> > > > Rahul
> > > >
> > > > --
> > > > **** This email and any files transmitted with it are confidential
> and
> > > > intended solely for the use of the individual or entity to whom it is
> > > > addressed. If you are not the named addressee then you should not
> > > > disseminate, distribute or copy this e-mail. Please notify the sender
> > > > immediately and delete this e-mail from your system.****
> > > >
> > >
> >
> > --
> > **** This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom it is
> > addressed. If you are not the named addressee then you should not
> > disseminate, distribute or copy this e-mail. Please notify the sender
> > immediately and delete this e-mail from your system.****
> >
>

-- 
**** This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is 
addressed. If you are not the named addressee then you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately and delete this e-mail from your system.****

Reply via email to