/**
   * Adds the s c product version to the database. Also notifies the appropriate model listeners.
   *
   * @param scProductVersion the s c product version
   * @return the s c product version that was added
   * @throws SystemException if a system exception occurred
   */
  @Indexable(type = IndexableType.REINDEX)
  @Override
  public SCProductVersion addSCProductVersion(SCProductVersion scProductVersion)
      throws SystemException {
    scProductVersion.setNew(true);

    return scProductVersionPersistence.update(scProductVersion);
  }
コード例 #2
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);
    }
  }