Exemple #1
0
  public static void getLicense(HttpServletRequest request) throws Exception {
    long licenseId = ParamUtil.getLong(request, "licenseId");

    SCLicense license = null;

    if (licenseId > 0) {
      license = SCLicenseServiceUtil.getLicense(licenseId);
    }

    request.setAttribute(WebKeys.SOFTWARE_CATALOG_LICENSE, license);
  }
  protected void updateLicense(ActionRequest actionRequest) throws Exception {
    long licenseId = ParamUtil.getLong(actionRequest, "licenseId");

    String name = ParamUtil.getString(actionRequest, "name");
    String url = ParamUtil.getString(actionRequest, "url");
    boolean openSource = ParamUtil.getBoolean(actionRequest, "openSource");
    boolean active = ParamUtil.getBoolean(actionRequest, "active");
    boolean recommended = ParamUtil.getBoolean(actionRequest, "recommended");

    if (licenseId <= 0) {

      // Add license

      SCLicenseServiceUtil.addLicense(name, url, openSource, active, recommended);
    } else {

      // Update license

      SCLicenseServiceUtil.updateLicense(licenseId, name, url, openSource, active, recommended);
    }
  }
  protected void deleteLicense(ActionRequest actionRequest) throws Exception {
    long licenseId = ParamUtil.getLong(actionRequest, "licenseId");

    SCLicenseServiceUtil.deleteLicense(licenseId);
  }