コード例 #1
0
  @Override
  protected String getBody(SocialActivity activity, ServiceContext serviceContext)
      throws Exception {

    String link = getLink(activity, serviceContext);

    String text = StringPool.BLANK;

    int activityType = activity.getType();

    if (activityType == JIRAActivityKeys.ADD_CHANGE) {
      JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(activity.getExtraData());

      text =
          interpretJIRAChangeItems(
              extraDataJSONObject.getJSONArray("jiraChangeItems"), serviceContext);
    } else if (activityType == JIRAActivityKeys.ADD_COMMENT) {
      long jiraActionId = GetterUtil.getLong(getJSONValue(activity.getExtraData(), "jiraActionId"));

      JIRAAction jiraAction = JIRAActionLocalServiceUtil.getJIRAAction(jiraActionId);

      text = HtmlUtil.escape(jiraAction.getBody());
    } else if (activityType == JIRAActivityKeys.ADD_ISSUE) {
      JIRAIssue jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(activity.getClassPK());

      text = HtmlUtil.escape(jiraIssue.getSummary());
    }

    return wrapLink(link, text);
  }
コード例 #2
0
  @Override
  protected String getLink(SocialActivity activity, ServiceContext serviceContext)
      throws Exception {

    StringBundler sb = new StringBundler(5);

    sb.append(PortletPropsValues.JIRA_URL);
    sb.append("/browse/");

    JIRAIssue jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(activity.getClassPK());

    sb.append(jiraIssue.getKey());

    int activityType = activity.getType();

    if (activityType == JIRAActivityKeys.ADD_COMMENT) {
      sb.append("#action_");

      long jiraActionId = GetterUtil.getLong(getJSONValue(activity.getExtraData(), "jiraActionId"));

      JIRAAction jiraAction = JIRAActionLocalServiceUtil.getJIRAAction(jiraActionId);

      sb.append(jiraAction.getJiraActionId());
    }

    return sb.toString();
  }
コード例 #3
0
  @Override
  protected Object[] getTitleArguments(
      String groupName,
      SocialActivity activity,
      String link,
      String title,
      ServiceContext serviceContext)
      throws Exception {

    String creatorUserName = getUserName(activity.getUserId(), serviceContext);

    JIRAIssue jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(activity.getClassPK());

    return new Object[] {creatorUserName, jiraIssue.getKey()};
  }