コード例 #1
1
ファイル: CalendarUtil.java プロジェクト: smclab/caldav-sync
  public static List<Calendar> getUserGroupCalendars(PermissionChecker permissionChecker)
      throws PortalException, SystemException {

    List<Calendar> calendars = new ArrayList<Calendar>();

    long classNameId = PortalUtil.getClassNameId(Group.class.getName());

    List<CalendarResource> calendarResources =
        CalendarResourceServiceUtil.search(
            permissionChecker.getCompanyId(),
            new long[] {},
            new long[] {classNameId},
            null,
            true,
            true,
            QueryUtil.ALL_POS,
            QueryUtil.ALL_POS,
            null);

    for (CalendarResource calendarResource : calendarResources) {
      for (Calendar calendar : calendarResource.getCalendars()) {
        if (CalendarPermission.contains(permissionChecker, calendar, ActionKeys.VIEW)) {

          calendars.add(calendar);
        }
      }
    }

    return calendars;
  }
コード例 #2
1
  protected void doExportStagedModel(
      PortletDataContext portletDataContext, CalendarResource calendarResource) throws Exception {

    Element calendarResourceElement = portletDataContext.getExportDataElement(calendarResource);

    for (Calendar calendar : calendarResource.getCalendars()) {
      StagedModelDataHandlerUtil.exportReferenceStagedModel(
          portletDataContext, calendarResource, calendar, PortletDataContext.REFERENCE_TYPE_STRONG);
    }

    if (calendarResource.getClassNameId() == PortalUtil.getClassNameId(User.class)) {

      User user = UserLocalServiceUtil.getUser(calendarResource.getClassPK());

      portletDataContext.addReferenceElement(
          calendarResource,
          calendarResourceElement,
          user,
          User.class,
          PortletDataContext.REFERENCE_TYPE_DEPENDENCY_DISPOSABLE,
          true);
    }

    portletDataContext.addClassedModel(
        calendarResourceElement,
        ExportImportPathUtil.getModelPath(calendarResource),
        calendarResource);
  }
コード例 #3
1
ファイル: CalendarUtil.java プロジェクト: smclab/caldav-sync
  public static List<Calendar> getUserCalendars(long userId)
      throws PortalException, SystemException {

    long classNameId = PortalUtil.getClassNameId(User.class.getName());

    CalendarResource calendarResource =
        CalendarResourceServiceUtil.fetchCalendarResource(classNameId, userId);

    return calendarResource.getCalendars();
  }