@Override
  public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    PortletURL portletURL =
        PortalUtil.getControlPanelPortletURL(
            portletRequest, MBPortletKeys.MESSAGE_BOARDS_ADMIN, PortletRequest.ACTION_PHASE);

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/message_boards/edit_message");

    try {
      MBMessage message = ActionUtil.getMessage(portletRequest);

      MBThread thread = message.getThread();

      if (thread.isLocked()) {
        portletURL.setParameter(Constants.CMD, Constants.UNLOCK);
      } else {
        portletURL.setParameter(Constants.CMD, Constants.LOCK);
      }

      portletURL.setParameter("redirect", PortalUtil.getCurrentURL(portletRequest));
      portletURL.setParameter("threadId", String.valueOf(thread.getThreadId()));
    } catch (Exception e) {
      return null;
    }

    return portletURL.toString();
  }
  @Override
  public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    try {
      MBMessage message = ActionUtil.getMessage(portletRequest);

      return MBCategoryPermission.contains(
          themeDisplay.getPermissionChecker(),
          themeDisplay.getScopeGroupId(),
          message.getCategoryId(),
          ActionKeys.LOCK_THREAD);
    } catch (Exception e) {
    }

    return false;
  }
  @Override
  public String getMessage(PortletRequest portletRequest) {
    try {
      MBMessage message = ActionUtil.getMessage(portletRequest);

      MBThread thread = message.getThread();

      String key = "lock";

      if (thread.isLocked()) {
        key = "unlock";
      }

      return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), key);
    } catch (Exception e) {
      return null;
    }
  }