留言板

Setting Organization Site Public and Private pages programatically

Aldi Sulova,修改在11 年前。

Setting Organization Site Public and Private pages programatically

Junior Member 帖子: 25 加入日期: 12-10-23 最近的帖子
Hello,

i want to set programatically organization site public pages. I developed a new portlet and defined a new method inside the class that extends MVCPortlet.

Inside that method i defined the code that should do the assignement of 'publicLayoutSetPrototypeId' and 'privateLayoutSetPrototypeId'.

MethodKey key = new MethodKey("com.liferay.portlet.sites.util.SitesUtil", "applyLayoutSetPrototypes", 
							Group.class, long.class, long.class, ServiceContext.class );
					
PortalClassInvoker.invoke(true, key, newOrg.getGroup(), 12008, 12008, context);

But the execution of the above code raises an exception:

java.lang.NoSuchMethodException: com.liferay.portlet.sites.util.SitesUtil.applyLayoutSetPrototypes(com.liferay.portal.model.Group, long, long, com.liferay.portal.service.ServiceContext)
	at java.lang.Class.getMethod(Class.java:1605)
	at com.liferay.portal.kernel.util.MethodCache._get(MethodCache.java:123)
	at com.liferay.portal.kernel.util.MethodCache.get(MethodCache.java:51)
	at com.liferay.portal.kernel.util.MethodHandler.invoke(MethodHandler.java:63)
	at com.liferay.portal.kernel.util.PortalClassInvoker.invoke(PortalClassInvoker.java:42)
	at com.procedureKrijimitOrganizatave.KrijimiOrganizatavePortlet.procedureKrijimitTeOrganizatave(KrijimiOrganizatavePortlet.java:121)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Can anyone explain this situation?

Thanks.
thumbnail
Jan Geißler,修改在11 年前。

RE: Setting Organization Site Public and Private pages programatically

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
The stack clearly states, that you are trying to invoke a method via reflection which does not exist.
thumbnail
meera prince,修改在11 年前。

RE: Setting Organization Site Public and Private pages programatically

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
HI

Use LocalServiceUtil classes those are directly available in global class path instead of reflection calling.



Regards,
Meera Prince
http://www.liferaysavvy.com/
Aldi Tirane,修改在11 年前。

RE: Setting Organization Site Public and Private pages programatically

Junior Member 帖子: 25 加入日期: 12-10-23 最近的帖子
Here is my solution for who is interested.

Create class SiteUtil into your portlet and copy "com.liferay.portlet.sites.util.SitesUtil". Remove all methods not needed and remove errors. Then call the method "applyLayoutSetPrototypes(com.liferay.portal.model.Group, long, long, com.liferay.portal.service.ServiceContext)".

Hope it helps. Aldi