コード例 #1
0
  public static void deleteEntry(long entryId) throws RemoteException {
    try {
      AnnouncementsEntryServiceUtil.deleteEntry(entryId);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
コード例 #2
0
  public void deleteEntry(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

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

    AnnouncementsEntryServiceUtil.deleteEntry(entryId);

    SessionMessages.add(actionRequest, "announcementDeleted");

    sendRedirect(actionRequest, actionResponse);
  }
コード例 #3
0
  public static com.liferay.portlet.announcements.model.AnnouncementsEntrySoap addEntry(
      long plid,
      long classNameId,
      long classPK,
      java.lang.String title,
      java.lang.String content,
      java.lang.String url,
      java.lang.String type,
      int displayDateMonth,
      int displayDateDay,
      int displayDateYear,
      int displayDateHour,
      int displayDateMinute,
      int expirationDateMonth,
      int expirationDateDay,
      int expirationDateYear,
      int expirationDateHour,
      int expirationDateMinute,
      int priority,
      boolean alert)
      throws RemoteException {
    try {
      com.liferay.portlet.announcements.model.AnnouncementsEntry returnValue =
          AnnouncementsEntryServiceUtil.addEntry(
              plid,
              classNameId,
              classPK,
              title,
              content,
              url,
              type,
              displayDateMonth,
              displayDateDay,
              displayDateYear,
              displayDateHour,
              displayDateMinute,
              expirationDateMonth,
              expirationDateDay,
              expirationDateYear,
              expirationDateHour,
              expirationDateMinute,
              priority,
              alert);

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

      throw new RemoteException(e.getMessage());
    }
  }
コード例 #4
0
  public static com.liferay.portlet.announcements.model.AnnouncementsEntrySoap getEntry(
      long entryId) throws RemoteException {
    try {
      com.liferay.portlet.announcements.model.AnnouncementsEntry returnValue =
          AnnouncementsEntryServiceUtil.getEntry(entryId);

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

      throw new RemoteException(e.getMessage());
    }
  }
コード例 #5
0
  protected void doSaveEntry(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

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

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

    String[] distributionScopeParts =
        StringUtil.split(ParamUtil.getString(actionRequest, "distributionScope"));

    long classNameId = 0;
    long classPK = 0;

    if (distributionScopeParts.length == 2) {
      classNameId = GetterUtil.getLong(distributionScopeParts[0]);

      if (classNameId > 0) {
        classPK = GetterUtil.getLong(distributionScopeParts[1]);
      }
    }

    String title = ParamUtil.getString(actionRequest, "title");
    String content = ParamUtil.getString(actionRequest, "content");
    String url = ParamUtil.getString(actionRequest, "url");
    String type = ParamUtil.getString(actionRequest, "type");

    int displayDateMonth = ParamUtil.getInteger(actionRequest, "displayDateMonth");
    int displayDateDay = ParamUtil.getInteger(actionRequest, "displayDateDay");
    int displayDateYear = ParamUtil.getInteger(actionRequest, "displayDateYear");
    int displayDateHour = ParamUtil.getInteger(actionRequest, "displayDateHour");
    int displayDateMinute = ParamUtil.getInteger(actionRequest, "displayDateMinute");
    int displayDateAmPm = ParamUtil.getInteger(actionRequest, "displayDateAmPm");

    if (displayDateAmPm == Calendar.PM) {
      displayDateHour += 12;
    }

    boolean displayImmediately = ParamUtil.getBoolean(actionRequest, "displayImmediately");

    int expirationDateMonth = ParamUtil.getInteger(actionRequest, "expirationDateMonth");
    int expirationDateDay = ParamUtil.getInteger(actionRequest, "expirationDateDay");
    int expirationDateYear = ParamUtil.getInteger(actionRequest, "expirationDateYear");
    int expirationDateHour = ParamUtil.getInteger(actionRequest, "expirationDateHour");
    int expirationDateMinute = ParamUtil.getInteger(actionRequest, "expirationDateMinute");
    int expirationDateAmPm = ParamUtil.getInteger(actionRequest, "expirationDateAmPm");

    if (expirationDateAmPm == Calendar.PM) {
      expirationDateHour += 12;
    }

    int priority = ParamUtil.getInteger(actionRequest, "priority");
    boolean alert = ParamUtil.getBoolean(actionRequest, "alert");

    if (entryId <= 0) {

      // Add entry

      AnnouncementsEntryServiceUtil.addEntry(
          themeDisplay.getPlid(),
          classNameId,
          classPK,
          title,
          content,
          url,
          type,
          displayDateMonth,
          displayDateDay,
          displayDateYear,
          displayDateHour,
          displayDateMinute,
          displayImmediately,
          expirationDateMonth,
          expirationDateDay,
          expirationDateYear,
          expirationDateHour,
          expirationDateMinute,
          priority,
          alert);
    } else {

      // Update entry

      AnnouncementsEntryServiceUtil.updateEntry(
          entryId,
          title,
          content,
          url,
          type,
          displayDateMonth,
          displayDateDay,
          displayDateYear,
          displayDateHour,
          displayDateMinute,
          expirationDateMonth,
          expirationDateDay,
          expirationDateYear,
          expirationDateHour,
          expirationDateMinute,
          priority);
    }
  }