I'm using the IBM Portal API for developing some pages in the Websphere Portal Server, but I want to work in the context of a virtual portal that is nested in my principal portal. I already read the documentation from IBM, but I don't understand how it work, so I decide to ask you guys. Does anyone of you did that already? This is how I'm trying to get a ContentNode from my virtual portal:
private void createPortalContent(HttpServletRequest request, HttpServletResponse response) throws InterruptedException, ModelException{
Context ctx = null;
try {
ctx = new InitialContext();
portletModelHome = (PortletModelHome) ctx.lookup(PortletModelHome.JNDI_NAME);
if(portletModelHome == null){
Thread.sleep(5000);
portletModelHome = (PortletModelHome) ctx.lookup(PortletModelHome.JNDI_NAME);
}
contentModelHome = (ContentModelHome) ctx.lookup(ContentModelHome.JNDI_NAME);
if(contentModelHome == null){
Thread.sleep(5000);
contentModelHome = (ContentModelHome) ctx.lookup(ContentModelHome.JNDI_NAME);
}
contentModelControllerHome = (ContentModelControllerHome) ctx.lookup(ContentModelControllerHome.JNDI_NAME);
if(contentModelControllerHome == null){
Thread.sleep(5000);
contentModelControllerHome = (ContentModelControllerHome) ctx.lookup(ContentModelControllerHome.JNDI_NAME);
}
contentMappingInfoHome = (ContentMappingInfoHome) ctx.lookup(ContentMappingInfoHome.JNDI_NAME);
if(contentMappingInfoHome == null){
Thread.sleep(5000);
contentMappingInfoHome = (ContentMappingInfoHome) ctx.lookup(ContentMappingInfoHome.JNDI_NAME);
}
virtualPortalList = (VirtualPortalListHome) ctx.lookup(VirtualPortalListHome.VIRTUAL_PORTAL_LIST_JNDI_NAME);
} catch (NamingException e) {
e.printStackTrace();
}
ContentModelController contentModelController = getController(request, response);
//LOGGER.info("### CONTENT MODEL CONTROLLER: " + contentModelController.getLocator() + " " + contentModelController.getRoot().toString());
ContentNode contentNode = (ContentNode) contentModelController.getLocator().findByUniqueName("ro.ram.comunicate");
//LOGGER.info("### CONTENT NODE: " + contentNode);
// LOGGER.info("#### VIRTUAL PORTAL LIST: " + virtualPortalList);
//VirtualPortal virtualPortal = virtualPortalList.getVirtualPortalListProvider().getVirtualPortalList().getLocator().findByUniqueName("");
// LOGGER.info("### VIRTUAL PORTAL: " + virtualPortal.getTitle(Locale.ENGLISH));
//Iterator<VirtualPortal> it=virtualPortalList.getVirtualPortalListProvider().getVirtualPortalList().iterator();
// while(it.hasNext()){
// LOGGER.info("### VIRTUAL PORTAL LIST ITERATOR: " + it.next().getDescription(Locale.ENGLISH) + " " + " " + it.next().getTitle(Locale.ENGLISH));
// it.next();
//}
}
Thank you,
For everyone who wants to do something like that, the solution (this was for me) might be:
thx all of you :) I hope this will help you!