Ejemplo n.º 1
0
  public void deleteMeetupsEntry(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!permissionChecker.isCompanyAdmin()) {
      return;
    }

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

    // Delete Meetups Entry
    MeetupsEntryLocalServiceUtil.deleteMeetupsEntry(meetupsEntryId);
  }
Ejemplo n.º 2
0
  public void updateMeetupsEntry(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(uploadRequest);
    ThemeDisplay themeDisplay = (ThemeDisplay) uploadRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    // get selected tags
    String[] assetTagNames = null;

    String assetTagCSV = ParamUtil.getString(uploadRequest, "assetTagNames");

    assetTagNames = assetTagCSV != null ? assetTagCSV.split(",") : null;

    // set asset tag names in service context
    serviceContext.setAssetTagNames(
        (null != assetTagCSV && !assetTagCSV.equals("")) ? assetTagNames : null);

    if (!permissionChecker.isCompanyAdmin()) {
      return;
    }

    long meetupsEntryId = ParamUtil.getLong(uploadRequest, "meetupsEntryId");

    String title = ParamUtil.getString(uploadRequest, "title");
    String description = ParamUtil.getString(uploadRequest, "description");

    int startDateMonth = ParamUtil.getInteger(uploadRequest, "startDateMonth");
    int startDateDay = ParamUtil.getInteger(uploadRequest, "startDateDay");
    int startDateYear = ParamUtil.getInteger(uploadRequest, "startDateYear");
    int startDateHour = ParamUtil.getInteger(uploadRequest, "startDateHour");
    int startDateMinute = ParamUtil.getInteger(uploadRequest, "startDateMinute");
    int startDateAmPm = ParamUtil.getInteger(uploadRequest, "startDateAmPm");

    if (startDateAmPm == Calendar.PM) {
      startDateHour += 12;
    }

    int endDateMonth = ParamUtil.getInteger(uploadRequest, "endDateMonth");
    int endDateDay = ParamUtil.getInteger(uploadRequest, "endDateDay");
    int endDateYear = ParamUtil.getInteger(uploadRequest, "endDateYear");
    int endDateHour = ParamUtil.getInteger(uploadRequest, "endDateHour");
    int endDateMinute = ParamUtil.getInteger(uploadRequest, "endDateMinute");
    int endDateAmPm = ParamUtil.getInteger(uploadRequest, "endDateAmPm");

    if (endDateAmPm == Calendar.PM) {
      endDateHour += 12;
    }

    int totalAttendees = ParamUtil.getInteger(uploadRequest, "totalAttendees");
    int maxAttendees = ParamUtil.getInteger(uploadRequest, "maxAttendees");
    double price = ParamUtil.getDouble(uploadRequest, "price");

    File file = uploadRequest.getFile("fileName");
    byte[] bytes = FileUtil.getBytes(file);

    if (meetupsEntryId <= 0) {
      // Add Meetups Entry
      MeetupsEntryLocalServiceUtil.addMeetupsEntry(
          themeDisplay.getUserId(),
          title,
          description,
          startDateMonth,
          startDateDay,
          startDateYear,
          startDateHour,
          startDateMinute,
          endDateMonth,
          endDateDay,
          endDateYear,
          endDateHour,
          endDateMinute,
          totalAttendees,
          maxAttendees,
          price,
          bytes,
          serviceContext);

    } else {
      MeetupsEntryLocalServiceUtil.updateMeetupsEntry(
          themeDisplay.getUserId(),
          meetupsEntryId,
          title,
          description,
          startDateMonth,
          startDateDay,
          startDateYear,
          startDateHour,
          startDateMinute,
          endDateMonth,
          endDateDay,
          endDateYear,
          endDateHour,
          endDateMinute,
          totalAttendees,
          maxAttendees,
          price,
          bytes,
          serviceContext);
    }
  }