Created
November 29, 2012 18:13
-
-
Save eduardolundgren/4170873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void addCalendarJSONObject( | |
PortletRequest portletRequest, JSONArray jsonArray, | |
long classNameId, long classPK, String permissionAction) | |
throws PortalException, SystemException { | |
CalendarResource calendarResource = | |
CalendarResourceUtil.getCalendarResource( | |
portletRequest, classNameId, classPK); | |
if (calendarResource == null) { | |
return; | |
} | |
ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute( | |
WebKeys.THEME_DISPLAY); | |
PermissionChecker permissionChecker = | |
themeDisplay.getPermissionChecker(); | |
List<Calendar> calendars = | |
CalendarLocalServiceUtil.getCalendarResourceCalendars( | |
calendarResource.getGroupId(), | |
calendarResource.getCalendarResourceId()); | |
for (Calendar calendar : calendars) { | |
if (Validator.isNotNull(permissionAction) && | |
!CalendarPermission.contains( | |
permissionChecker, calendar, permissionAction)) { | |
continue; | |
} | |
JSONObject jsonObject = CalendarUtil.toCalendarJSONObject( | |
themeDisplay, calendar); | |
jsonArray.put(jsonObject); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment