I understand how getChildren() works in conjunction with ContentFilter, which is what the docs explain. What I'm asking is how do I set up ContentFilter to begin with. What arguments do I pass to ContentFilter's constructor method to get it to filter?
Perhaps I'm misunderstanding what ContentFilter is for? Mike D. Jones Vice President, Technology (845) 440-3201 Dulcinea Media > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: Friday, October 19, 2007 4:57 AM > To: [email protected] > Subject: Re: [magnolia-user] ContentFilter > > Wait, I thought my example made it clearer; as I said, "Each children > of "myNode" is passed as a parameter to the accept method." Please > elaborate on what's still unclear. > > As for your query question, I have very little experience with xpath > queries, but I suspect a read of the appropriate chapter in the jcr > spec will help. > > Cheers > > g > > > On Oct 18, 2007, at 23:59 , Mike D. Jones wrote: > > > Anyone? Even if you know where I can find more information on > > ContentFilter...that would be a huge help. > > > > Mike D. Jones > > Vice President, Technology > > (845) 440-3201 > > Dulcinea Media > > > > > >> -----Original Message----- > >> From: Mike D. Jones > >> Sent: Wednesday, October 17, 2007 2:22 PM > >> To: '[email protected]' > >> Subject: RE: [magnolia-user] ContentFilter > >> > >> Thanks, Greg, > >> > >>> Collection result = myNode.getChildren(new Content.ContentFiler() { > >>> public boolean accept(Content content) { > >>> return content.hasNodeData("foo"); > >>> } > >>> }); > >>> //---- > >>> > >> Actually need to know who to create the filter. I got the > >> getChildren() part. Like you said, that's straightforward. But > what > >> arguments does the ContentFilter take? What types of filters can I > >> create with it. That was what has me stumped. > >> > >> 1) When using SQL in JSP to execute a query against the repository, > >>>> is it possible to limit the number of "records" pulled from the > >>>> cms? That is, I know how to identify which specific nodes to pull > >>>> based on their path. However, if say there are 100 nodes that > >>>> match that path, I only want to pull out 10 -- anything like a > >>>> LIMIT keyword available? > >> Hm, thanks. Any idea how to apply XPath in a query like this? > >> The JCR > >> doc shows the Xpath args, but not how to apply them (which makes > >> sense). I think that if I used the XPath position() function I > could > >> achieve similar enough results. I'm just trying to limit the > >> amount of > >> data I need to grab only to display 3 or 5. > >> > >> Mike D. Jones > >> Vice President, Technology > >> (845) 440-3201 > >> Dulcinea Media > >> > >> > >>> -----Original Message----- > >>> From: [email protected] [mailto:[EMAIL PROTECTED] > >>> Sent: Wednesday, October 17, 2007 2:13 PM > >>> To: [email protected] > >>> Subject: Re: [magnolia-user] ContentFilter > >>> > >>> > >>> On Oct 17, 2007, at 19:51 , Mike D. Jones wrote: > >>> > >>>> Hi all, > >>>> > >>>> Thanks in advance for any insight you can give me. > >>>> > >>>> I have two questions; both of which deal with pulling specific > >>>> subsets of nodes from the source content via code. > >>>> > >>>> 1) When using SQL in JSP to execute a query against the > repository, > >>>> is it possible to limit the number of "records" pulled from the > >>>> cms? That is, I know how to identify which specific nodes to pull > >>>> based on their path. However, if say there are 100 nodes that > >>>> match that path, I only want to pull out 10 -- anything like a > >>>> LIMIT keyword available? > >>> > >>> AFAIK, the jcr-1 spec does not provide this. Maybe repository > >>> specific extensions do, or maybe that'll be in jcr 2. > >>> > >>>> 2) Can someone provide an example of how to use ContentFilter in > >>>> the Content.getChildren() method? What arguments does it accept > >>>> and how? > >>> > >>> Please tell us what's unclear so we can write proper javadoc > >>> (admittedly the current one isn't perfect, but I'm not sure I could > >>> improve it more than by just improving the grammar...) > >>> > >>> Just a silly example: > >>> > >>> //---- > >>> Collection result = myNode.getChildren(new Content.ContentFiler() { > >>> public boolean accept(Content content) { > >>> return content.hasNodeData("foo"); > >>> } > >>> }); > >>> //---- > >>> > >>> The "result" collection will contain the children nodes of the > >>> "myNode" node which have a property called "foo". So basically the > >>> getChildren(filter) method returns the children of the node for > >>> which > >>> the accept method returns true. Each children of "myNode" is passed > >>> as a parameter to the accept method. (*) > >>> > >>> > >>> hth > >>> > >>> greg > >>> > >>> > >>> * Note that I use the terms Node and Content interchangeably, as > >>> I do > >>> for NodeData and Property. > >>> > >>> ---------------------------------------------------------------- > >>> for list details see > >>> http://documentation.magnolia.info/docs/en/editor/stayupdated.html > >>> ---------------------------------------------------------------- > > > > ---------------------------------------------------------------- > > for list details see > > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > > ---------------------------------------------------------------- > > > ---------------------------------------------------------------- > for list details see > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > ---------------------------------------------------------------- ---------------------------------------------------------------- for list details see http://documentation.magnolia.info/docs/en/editor/stayupdated.html ----------------------------------------------------------------
