jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Dullaart" <marcel.dulla...@gmail.com>
Subject Re: Interlinking content items
Date Wed, 06 Dec 2006 12:24:48 GMT
Hi,

I have that piece in place and working based on uuid's, thanks for the
input.
I coded it as:
NodeIterator nodeIterator = node.getNodes();

List nodes = new ArrayList();
while (nodeIterator.hasNext()) {
   Node currentNode = nodeIterator.nextNode();
   TocBean bean = new TocBean();
   Property propertyTitle = currentNode.getProperty(
BootstrapRepository.PROP_EPO_TITLE);
   String title = propertyTitle.getString();
   bean.setTitle(title);
   String uuid = currentNode.getUUID();
   bean.setUuid(uuid);
   String language = getLanguage(currentNode);
   bean.setLanguage(language);
   nodes.add(bean);
}
request.setAttribute("nodes", nodes);

Wihch made me think about storing html content. This content can have anchor
tags that refer to other items in the repo.
These links need to be resolved, but preferably during the rendering phase
to allow the referred items move within the repo and still keep the links
working.
So how are these links resolved?
Well I was thinking of 2 possible solutions, first the complete xhtml is
broken down in nodes for each html tag. These nodes would have all html
attributes as attributes, including the content, and child nodes that
reflect the contained tags.
This solution makes replacing the href attributes UUID with a proper link
handled by the servlet easy, but the drawback is peformance. Each html tag
must itself be retrieved from the repository, care must be taken that the
ordering is as stored, otherwise different paragraphs might be mixed for
instance.

The other possible solution is to store the HTML snippet as data of a node,
and when rendering the node, the data is searched for placeholders
containing UUID's which are then replaced by actual anchor tags, in my
portlet this could be :

<a href="<portlet:actionURL><portlet:param name="selectedContentUUID"
value="<%=uuid%>"/></portlet:actionURL>">

This scanning also its performance.
Now what is the best approach in your opinion.

Kind Regards,
Marcel Dullaart
On 12/4/06, Marcel Dullaart <marcel.dullaart@gmail.com> wrote:
>
> Thanks for you quick responses.
> I'll try that.
>
> Marcel
>
> On 12/4/06, Jukka Zitting <jukka.zitting@gmail.com > wrote:
> >
> > Hi,
> >
> > On 12/4/06, Marcel Dullaart < marcel.dullaart@gmail.com> wrote:
> > > So that means that my custom rendering engine, in my case a portlet,
> > is
> > > repsonsible for handling the references, using the uuid in the anchor
> > tag of
> > > the action URL for instance?
> >
> > Yes. In any case your application needs to be aware of and handle the
> > reference. The exact mechanism of doing so is up to you.
> >
> > If your portlet uses JCR paths for navigation, then you can simply
> > link to the path of the target node instead of exposing the UUID if
> > you like:
> >
> >     String path = source.getProperty
> > ("my:reference").getNode().getPath();
> >     // separate request
> >     Node target = (Node) session.getItem(path);
> >
> > However, if the portlet uses UUIDs for identifying nodes, then you can
> > simply expose that:
> >
> >     String uuid = source.getProperty("my:reference").getString()
> >     // separate request
> >     Node target = session.getNodeByUUID(uuid);
> >
> > Or if the reference property is known, then you can also use the
> > source node to identify the target:
> >
> >     String path = source.getPath();
> >     // separate request
> >     Node target = ((Node)
> > session.getItem(path)).getProperty("my:reference").getNode();
> >
> > These all assume that the target node is rendered in a separate
> > portlet or request.
> >
> > BR,
> >
> > Jukka Zitting
> >
>
>

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