[jboss-user] [JBoss Portal] - Re: Access CMS trought a Portlet
DragonSk1ll
do-not-reply at jboss.com
Wed Apr 30 04:15:17 EDT 2008
I found how to proceed to access the CMS by a programatic way but i had to look in source of JBoss Portal... I don't found any documentation about that.
Here is my solution if that can help somebody:
| CMS CMSService = (CMS)this.getPortletContext().getAttribute("CMS");
| Command listCMD = CMSService.getCommandFactory().createFolderGetListCommand("/");
| Folder mainFolder = (Folder)CMSService.execute(listCMD);
| List l=mainFolder.getFolders();
| Iterator it=l.iterator();
| while(it.hasNext())
| {
| System.out.println(((Folder)(it.next())).getName());
| }
|
jboss-portlet.xml
| <portlet-app>
| <portlet>
| <portlet-name>NewsWithCms</portlet-name>
| <transaction>
| <trans-attribute>Required</trans-attribute>
| </transaction>
| </portlet>
| <service>
| <service-name>CMS</service-name>
| <service-class>org.jboss.portal.cms.CMS</service-class>
| <service-ref>portal:service=CMS</service-ref>
| </service>
| </portlet-app>
|
It's work but there always a litle problem, I must include the jboss-portal.sar\portal-cms.sar\portal-cms-lib to compile my portlet but when I deploy it I must remove that jar to avoid a Class Cast Exeption during the execution (java.lang.ClassCastException org.jboss.portal.cms.impl.jcr.JCRCommandFactory).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147738#4147738
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147738
More information about the jboss-user
mailing list