Пример #1
0
  public void updateKBComment(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

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

    if (!themeDisplay.isSignedIn()) {
      return;
    }

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

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

    long classNameId = ParamUtil.getLong(actionRequest, "classNameId");
    long classPK = ParamUtil.getLong(actionRequest, "classPK");
    String content = ParamUtil.getString(actionRequest, "content");
    boolean helpful = ParamUtil.getBoolean(actionRequest, "helpful");

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

    if (cmd.equals(Constants.ADD)) {
      KBCommentLocalServiceUtil.addKBComment(
          themeDisplay.getUserId(), classNameId, classPK, content, helpful, serviceContext);
    } else if (cmd.equals(Constants.UPDATE)) {
      KBCommentLocalServiceUtil.updateKBComment(
          kbCommentId, classNameId, classPK, content, helpful, serviceContext);
    }
  }
Пример #2
0
  public void deleteKBComment(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

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

    if (!themeDisplay.isSignedIn()) {
      return;
    }

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

    KBCommentLocalServiceUtil.deleteKBComment(kbCommentId);
  }