protected void setupPermissionChecker(long companyId) throws PortalException, SystemException {
PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();
if (permissionChecker == null) {
Role administratorRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR);
User administratorUser = UserLocalServiceUtil.getRoleUsers(administratorRole.getRoleId()).get(0);
try {
permissionChecker = PermissionCheckerFactoryUtil.create(administratorUser);
PermissionThreadLocal.setPermissionChecker(permissionChecker);