private Version _getVersion(String version) {
    if (version.equals("${current-version}")) {
      version = ReleaseInfo.getVersion();
    }

    return Version.getInstance(version);
  }
Пример #2
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;
  }
Пример #3
0
  public static void getProductVersion(HttpServletRequest request) throws Exception {

    long productVersionId = ParamUtil.getLong(request, "productVersionId");
    long copyProductVersionId = ParamUtil.getLong(request, "copyProductVersionId");

    SCProductVersion productVersion = null;
    SCProductEntry productEntry = null;

    if (productVersionId > 0) {
      productVersion = SCProductVersionServiceUtil.getProductVersion(productVersionId);

      productEntry = SCProductEntryServiceUtil.getProductEntry(productVersion.getProductEntryId());

      request.setAttribute(WebKeys.SOFTWARE_CATALOG_PRODUCT_VERSION, productVersion);

      request.setAttribute(WebKeys.SOFTWARE_CATALOG_PRODUCT_ENTRY, productEntry);
    } else if (copyProductVersionId > 0) {
      productVersion = SCProductVersionServiceUtil.getProductVersion(copyProductVersionId);

      productEntry = SCProductEntryServiceUtil.getProductEntry(productVersion.getProductEntryId());

      String oldVersion = productVersion.getVersion();

      Version version = Version.getInstance(oldVersion);

      version = Version.incrementBuildNumber(version);

      String newVersion = version.toString();

      productVersion.setVersion(newVersion);

      String directDownloadURL = productVersion.getDirectDownloadURL();

      directDownloadURL = StringUtil.replace(directDownloadURL, oldVersion, newVersion);

      productVersion.setDirectDownloadURL(directDownloadURL);

      request.setAttribute(WebKeys.SOFTWARE_CATALOG_PRODUCT_VERSION, productVersion);

      request.setAttribute(WebKeys.SOFTWARE_CATALOG_PRODUCT_ENTRY, productEntry);
    } else {
      getProductEntry(request);
    }
  }