Beispiel #1
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);
    }
  }
Beispiel #2
0
  public static void getProductEntry(HttpServletRequest request) throws Exception {

    long productEntryId = ParamUtil.getLong(request, "productEntryId");

    SCProductEntry productEntry = null;

    if (productEntryId > 0) {
      productEntry = SCProductEntryServiceUtil.getProductEntry(productEntryId);
    }

    request.setAttribute(WebKeys.SOFTWARE_CATALOG_PRODUCT_ENTRY, productEntry);
  }
  public static com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap getProductEntry(
      long productEntryId) throws RemoteException {
    try {
      com.liferay.portlet.softwarecatalog.model.SCProductEntry returnValue =
          SCProductEntryServiceUtil.getProductEntry(productEntryId);

      return com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

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