jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "oliver.gregory@gmail.com" <oliver.greg...@gmail.com>
Subject Re: JCR_SQL2, query on jcr:mimeType
Date Thu, 15 Nov 2012 21:26:58 GMT
Finally, i found the query with Jackrabbit :

select node.* from [nt:unstructured] as node
inner join [nt:file] as file on ischildnode(file, node)
inner join [nt:resource] as content on ischildnode(content, file)
where content.[jcr:mimeType] = 'application/pdf'

Thank you,

Grégory OLIVER



2012/11/13 joe verderber <jjverderber@gmail.com>

> I have a local CQ5 instance running and the following seems to work for me:
>
> Repository r = JcrUtils.getRepository("http://localhost:4502/crx/server/
> ");
>
> Session s = r.login( new SimpleCredentials("admin", "admin".toCharArray())
>   ,"crx.default");
>
> System.out.println("logged in!!!");
>
> NodeIterator ni =  s.getWorkspace().getQueryManager().createQuery("select *
> from [nt:unstructured] where" +
>
> " [nt:unstructured].'jcr:mimeType' like '%/%' ", "JCR-SQL2"
> ).execute().getNodes();
>
> while(ni.hasNext())
>
> {
>
>  System.out.println("currentNode.path='"+ni.nextNode().getPath()+"'");
>
>  System.out.println("currentNode.mimeType='"+ni.nextNode().getProperty(
> "jcr:mimeType").getString()+"'");
>
>   }
>
> s.logout();
>
> System.out.println("logged out.");
>
> On Sun, Nov 11, 2012 at 5:55 PM, oliver.gregory@gmail.com <
> oliver.gregory@gmail.com> wrote:
>
> > Hello,
> >
> > I would like to know if it's possible in Jackrabbit with JCR_SQL2 to
> query
> > a node according to the jcr:mimeType property.
> > Something like :
> > SELECT * FROM [nt:unstructured] AS node WHERE node.id = 2 and
> > node.file.jcr:content[jcr:mimeType] = 'application/xml'
> >
> > Thanks,
> >
> > Grégory OLIVER
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message