jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe verderber <jjverder...@gmail.com>
Subject Re: JCR_SQL2, query on jcr:mimeType
Date Tue, 13 Nov 2012 18:08:47 GMT
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