Esempio n. 1
0
  public static List<Calendar> getSelectedCalendars(long userId)
      throws PortalException, SystemException {

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

    String otherCalendarPreferences = "calendar-portlet-other-calendars";

    if (_calendarVersion == 0) {
      Portlet calendarPortlet = PortletLocalServiceUtil.getPortletById(PortletKeys.CALENDAR);

      String calendarVersionStr = calendarPortlet.getPluginPackage().getVersion();

      Version calendarVersion = Version.getInstance(calendarVersionStr);

      _calendarVersion = GetterUtil.getInteger(calendarVersion.getBuildNumber(), 1);
    }

    if (_calendarVersion < 10) {
      otherCalendarPreferences = "otherCalendars";
    }

    long[] calendarIds =
        GetterUtil.getLongValues(
            StringUtil.split(
                PortletPreferencesFactoryUtil.getPortalPreferences(userId, true)
                    .getValue(SessionClicks.class.getName(), otherCalendarPreferences)));

    for (long calendarId : calendarIds) {
      calendars.add(CalendarServiceUtil.getCalendar(calendarId));
    }

    return calendars;
  }
  public static com.liferay.calendar.model.CalendarSoap getCalendar(long calendarId)
      throws RemoteException {
    try {
      com.liferay.calendar.model.Calendar returnValue = CalendarServiceUtil.getCalendar(calendarId);

      return com.liferay.calendar.model.CalendarSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }