You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jörn Nettingsmeier <po...@uni-duisburg-essen.de> on 2006/10/01 16:16:32 UTC

get publication from ID in xsp?

hi !


i need to walk the publication templating tree in an xsp serverpage.
the problem is i don't know how to get hold of a Publication object via 
a publicationID.

here's my code so far:

DocumentFactory factory =
     DocumentUtil.createDocumentFactory(this.manager, session);
Publication pub =
     factory.getPublication(parameters.getParameter("pubid", "null"));

while (pub != null) {
   do_something();
   // walk down the template tree:
   // i have no idea why templateIds is an array. multiple inheritance?
   pub = factory.getPublication(pub.getTemplateIds()[0]);
}

the problem is the DocumentFactory. it wants a 
org.apache.lenya.cms.repository.Session, and all i have in an xsp is a 
org.apache.cocoon.environment.Session.

so either i need a way to get a valid repository.Session, or maybe 
someone can point out an altogether simpler approach?

to get the current publication, i know i can also do
   Publication publication = (Publication) <input:get-attribute
      module="page-envelope" as="object" name="publication"/>;
but what if i need to access pubs other than the current?

tia,

jörn




-- 
"It's sad to behold how lately the wonderful English language has,
in the hands of corporate executives and marketing experts, re-
adjusted its prospective itinerary towards mythical subterranean
realms of discomfort, leveraging traditional woven containment
devices."

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org