public static void deleteProductEntry(long productEntryId) throws RemoteException {
    try {
      SCProductEntryServiceUtil.deleteProductEntry(productEntryId);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
Beispiel #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);
    }
  }
Beispiel #3
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());
    }
  }
  public static com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap addProductEntry(
      java.lang.String name,
      java.lang.String type,
      java.lang.String tags,
      java.lang.String shortDescription,
      java.lang.String longDescription,
      java.lang.String pageURL,
      java.lang.String author,
      java.lang.String repoGroupId,
      java.lang.String repoArtifactId,
      long[] licenseIds,
      java.util.List<byte[]> thumbnails,
      java.util.List<byte[]> fullImages,
      com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      com.liferay.portlet.softwarecatalog.model.SCProductEntry returnValue =
          SCProductEntryServiceUtil.addProductEntry(
              name,
              type,
              tags,
              shortDescription,
              longDescription,
              pageURL,
              author,
              repoGroupId,
              repoArtifactId,
              licenseIds,
              thumbnails,
              fullImages,
              serviceContext);

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

      throw new RemoteException(e.getMessage());
    }
  }
  protected void deleteProductEntry(ActionRequest actionRequest) throws Exception {

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

    SCProductEntryServiceUtil.deleteProductEntry(productEntryId);
  }
  protected void updateProductEntry(ActionRequest actionRequest) throws Exception {

    UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);

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

    String name = ParamUtil.getString(actionRequest, "name");
    String type = ParamUtil.getString(actionRequest, "type");
    String tags = ParamUtil.getString(actionRequest, "tags");
    String shortDescription = ParamUtil.getString(actionRequest, "shortDescription");
    String longDescription = ParamUtil.getString(actionRequest, "longDescription");
    String pageURL = ParamUtil.getString(actionRequest, "pageURL");
    String author = ParamUtil.getString(actionRequest, "author");
    String repoGroupId = ParamUtil.getString(actionRequest, "repoGroupId");
    String repoArtifactId = ParamUtil.getString(actionRequest, "repoArtifactId");

    long[] licenseIds = ParamUtil.getLongValues(actionRequest, "licenses");

    List<byte[]> thumbnails = getThumbnails(uploadPortletRequest);
    List<byte[]> fullImages = getFullImages(uploadPortletRequest);

    ServiceContext serviceContext =
        ServiceContextFactory.getInstance(SCProductEntry.class.getName(), actionRequest);

    if (productEntryId <= 0) {

      // Add product entry

      SCProductEntryServiceUtil.addProductEntry(
          name,
          type,
          tags,
          shortDescription,
          longDescription,
          pageURL,
          author,
          repoGroupId,
          repoArtifactId,
          licenseIds,
          thumbnails,
          fullImages,
          serviceContext);
    } else {

      // Update product entry

      SCProductEntryServiceUtil.updateProductEntry(
          productEntryId,
          name,
          type,
          tags,
          shortDescription,
          longDescription,
          pageURL,
          author,
          repoGroupId,
          repoArtifactId,
          licenseIds,
          thumbnails,
          fullImages);
    }
  }