-
1. Re: Display the groupId in the bannerPortlet
haint May 23, 2012 5:37 AM (in response to nadiaperez)Did you import org.exoplatform.services.organization.Membership in template ?
-
2. Re: Display the groupId in the bannerPortlet
nadiaperez May 23, 2012 5:48 AM (in response to haint)Thanks for your answer, I have actuyally added import org.exoplatform.webui.organization.UIGroupMembershipSelector;
and I just tryed by importing org.exoplatform.services.organization.Membership
And I still got an error :
Caused by: groovy.lang.MissingMethodException: No signature of method: org.exoplatform.portal.webui.application.UIGroovyPortlet.getMembership() is applicable for argument types: () values: []
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at UIBannerPortlet.run(UIBannerPortlet.gtmpl:41)
at org.exoplatform.groovyscript.GroovyScript.render(GroovyScript.java:111)
... 204 more
Maybe some other suggestion?
-
3. Re: Display the groupId in the bannerPortlet
haint May 23, 2012 6:09 AM (in response to nadiaperez)Where did you declare getMembership() method ? I see only getListMembership() in UIGroupMembershipSelector
-
4. Re: Display the groupId in the bannerPortlet
kien_nguyen May 23, 2012 6:38 AM (in response to haint)To get groups of user, you can use service OrganizationService:
import org.exoplatform.services.organization.OrganizationService;
def service = uicomponent.getApplicationComponent(OrganizationService.class);
Collection groups = service.getGroupHandler().findGroupsOfUser(userId);
Also, you can get userId from request context:
def userId = prContext.getRemoteUser();
-
5. Re: Display the groupId in the bannerPortlet
hoang_to May 29, 2012 9:56 PM (in response to kien_nguyen)It's important to keep in mind that the variable 'uicomponent' refers to the UI component associated with rendering template. As Hai mentionned that the method getListMembership() in UIGroupMembershipSelector, you could invoke this method only in Groovy template of UIGroupMembershipSelector.