The method I was referring to is actually:

container.getPortletApplicationDescriptor(applicationId);

My abbr. may have been confusing :)

David H. DeWolf wrote:


Charles Severance wrote:
This was what it took:

PortletDD pdd = PortletContextManager.getManager().getPortletDescriptor(appName, portletName);

I'm not sure that would be the "recommended" approach. The PCM is really an internal structure. It definitely will work though.


I had to stash the appName and portletName in Sakai data structures so I could regurgitate them at the right time.

You mean after parsing through to OM?


It is too bad that I had to go to such effort - in a sense the doRender call does not need as much information:

           portletContainer.doRender(window, req, bufferedResponse);

doRender finds find all the necessary data about this Portlet- it would be nice someday to have the container to be able to hand me back a PortletDD with no more information than that which is present in the doRender.

Well, it does, just at a little lower level.

portletContainer.getPortletAppDD(applicationId);

Then, from the PortletAppDD you can get all of the PortletDDs. This would definitely be the recommended approach.


now perhaps I am complaining about what is *my* responsibility and what is the container's responsibility - but if the container has the right code to resolve form effectively the windowId - then I theoretically should be able to ask for PortletDD knowing just the window id and request(perhaps).

Basically all that's missing is the convenience method which iterates through the PortletApp portlets and retrieves the correct one for you. If that would be really helpful to other portals we could definately add it, but my fear with adding convenience methods is that we could easily explode the container api for no good reason. In other words, portlet is definitely as far as I would go.


Just thinking out loud.

Did you miss the container method? Or were you just looking for a way not to have to iterate?

Thoughts?

D

/Chuck

On Mar 14, 2007, at 10:24 PM, David H. DeWolf wrote:

Try:  PortletContainer.getPortletAppDescriptor(applicationId)



Charles Severance wrote:
I am in my portal and trying to decide whether or not to put out a Help icon and/or an Edit icon. I would like to only do so if the Portlet supports the HELP or Edit modes.
I am in the render code about to call
         portletContainer.doRender(window, req, bufferedResponse);
and have access to all of the following structures:
PortletContainer portletContainer = getPortletContainer(context);
RequiredContainerServices rs = portletContainer.getRequiredContainerServices();
PortalCallbackService pcs = rs.getPortalCallbackService();
PortletURLProvider pup = pcs.getPortletURLProvider(request, window);
pup.setPortletMode(new PortletMode("edit"));
String editUrl = pup.toString();
pup = pcs.getPortletURLProvider(request, window);
pup.setPortletMode(new PortletMode("help"));
String helpUrl = pup.toString();
So I can derive what the right URLs are - but cannot figure out whether I should emit these URLs. I could figure this out if I could get my hands in the InternalPortletWindow or the PortletDD. But it seems that I cannot access these things until the Container has built the PortletRequest structures - at which point it is trivial because I can call isPortletModeAllowed() if I had those structures. It would seem to me that I should be able to lookup a PortletDD somehow...
/Chuck





Reply via email to