It would be nice if the portal did provide a facility to do things like a portal wide search. The way I'd invision this is as follows:
* the portal publishes a set of supported features (like search), similar to the way modes and window states are published right now
* the portlet publishes the features it supports (a subset of the ones provided by the portal) in jboss-portal.xml: (features that are not supported by the portal will be ignored)
| <portlet>
| ...
| <features>
| <doEvent/>
| <doSearch/>
| </features>
|
The portlet would need to implement additional interfaces that correlate with the feature, like
| public Class MySearchablePortlet
| extends GenericPortlet
| implements JBPSearch {
| ....
| public SearchResult doSearch(SearchCriteria crit){
| // do something useful
| }
| }
|
Code that wants to search the portal could do that at various scopes:
| Context ctx = new PageContext(); // current Page
| // Context ctx = new PortalContext(); // current Portal
| // Context ctx = new PageContext("portal:portalName/page:pageName"); // specified Page
| List searchablePortlets sp = (List)ctx.lookup("java:comp/feature/search");
| for (Iterator i=sp.iterator();i.hasNext(); ){
| PortletSearchLink link = (PortletSearchLink)i.next();
| SearchResult result = link.execute("some criteria");
| html.append(result.toLinkURL().toString());
| }
| // or List searchResults = PortalSearch.execute(sp, "some criteria");
|
similarly events could be handled:
|
| public void processEvent (PortletEvent ev){
| ev.getParameterNames();
| ev.setRenderParameters();
| ev.setPortletMode(Mode.VIEW);
| ev.setWindowState(State.NORMAL);
| ev.getSession(Session.APPLICATION_SCOPE).setAttribute("blah", "blahblah");
| }
|
Events can only be fired from action requests of another portlet.
process event is very similar to processAction, except that it only has a subset of the ActionRequest functionality available (there is no Response)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884601#3884601
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884601
|