Using velocity Template in liferay
Template Code:
#set($groupLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.GroupLocalService"))
#set($group =
$groupLocalService.getGroup($getterUtil.getLong($groupId))) ##
$groupId is already available in the context
#if ($group.isUser())
#set($userLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.UserLocalService"))
#set($user = $userLocalService.getUserById($group.getClassPK()))
#set($name = $user.getFullName())
#else if ($group.isOrganization())
#set($orgLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.OrganizationLocalService"))
#set($org = $orgLocalService.getOrganization($group.getClassPK()))
#set($name = $org.getName())
#else
#set($name = $group.getName())
#end
Template Code:
#set($groupLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.GroupLocalService"))
#set($group =
$groupLocalService.getGroup($getterUtil.getLong($groupId))) ##
$groupId is already available in the context
#if ($group.isUser())
#set($userLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.UserLocalService"))
#set($user = $userLocalService.getUserById($group.getClassPK()))
#set($name = $user.getFullName())
#else if ($group.isOrganization())
#set($orgLocalService =
$serviceLocator.findExceptionSafeService("com.liferay.portal.service.OrganizationLocalService"))
#set($org = $orgLocalService.getOrganization($group.getClassPK()))
#set($name = $org.getName())
#else
#set($name = $group.getName())
#end
No comments:
Post a Comment