Question

I'm working with jackrabbit (v2.6.0).

What I'm trying to do is get a document repository from a UUID.

I'm reading the jackrabbit api and does not seem to have a method that performs this task.

Any tips?

Thanks

Was it helpful?

Solution 2

The document is a Node too. So you can just:

String pdfUUID = "put-uuid-here";
Node pdfNode = session.getNodeByIdentifier(pdfUUID);
Node jcrContent = pdfNode.getNode("jcr:content");
Property dataProperty = jcrContent.getProperty("jcr:data");
Binary dataBinary = dataProperty.getBinary();
InputStream dataInputStream = dataBinary.getStream();
//do something
dataInputStream.close();
dataBinary.dispose();

OTHER TIPS

As of JCR 2.0, you can get a node by identifier using Session.getNodeByIdentifier(). Also possible is Session.getNodeByUUID, but it is deprecated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top