Tabnine Logo
RendererManager.getRenderedContent
Code IndexAdd Tabnine to your IDE (free)

How to use
getRenderedContent
method
in
com.atlassian.jira.issue.RendererManager

Best Java code snippets using com.atlassian.jira.issue.RendererManager.getRenderedContent (Showing top 20 results out of 315)

origin: com.atlassian.jira/jira-rest-plugin

private String doGetPreviewHtml(final String rendererType, final String unrenderedMarkup, final IssueRenderContext renderContext)
{
  // The issueRenderContext allows us to resolve links to attached files and is also used by the wiki renderer, if
  // the issue is null then it is probably the case that we are on the CreateIssue screen and therefore we will
  // not have any attachments. The worst that will happen rendering wiki markup without an issue context is that some links
  // will not render. JRA-11464(JIRA), JST-763(JIRA Studio).
  final String result = rendererManager.getRenderedContent(rendererType, unrenderedMarkup, renderContext);
  return (StringUtils.isBlank(result)) ? RenderersResource.NBSP : result;
}
origin: com.atlassian.jira/jira-core

  public String getDescription(String fieldDescription)
  {
    String description = fieldDescription;
    if (featureManager.isOnDemand())
    {
      description = rendererManager.getRenderedContent(AtlassianWikiRenderer.RENDERER_TYPE, fieldDescription, null);
    }
    return description;
  }
}
origin: com.atlassian.jira/jira-core

private String getActionHtml(Comment comment)
{
  return rendererManager.getRenderedContent(new CommentFieldRenderContext(comment));
}
origin: com.atlassian.jira/jira-core

private Object getRendererCustomFieldValue(FieldLayoutItem fieldLayoutItem, Issue issue, Map displayParams)
{
  Object customFieldValue = issue.getCustomFieldValue(this);
  if (isRenderable() && displayParams.get("excel_view") == null)
  {
    String renderedContent = rendererManager.getRenderedContent(fieldLayoutItem, issue);
    if (StringUtils.isNotBlank(renderedContent))
    {
      // JRA-12479 - probably the custom field is in value creation process
      customFieldValue = renderedContent;
    }
  }
  return customFieldValue;
}
origin: com.atlassian.jira/jira-core

public String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)
{
  Map velocityParams = getVelocityParams(fieldLayoutItem, action, issue, displayParameters);
  if (isRenderable())
  {
    velocityParams.put("value", rendererManager.getRenderedContent(fieldLayoutItem, issue));
  }
  else
  {
    velocityParams.put("value", getValueFromIssue(issue));
  }
  return getViewHtml(velocityParams);
}
origin: com.atlassian.jira/jira-core

@Override
public void send() throws MailException
{
  String format = recipient.getFormat();
  String bodyTemplatePath = "templates/email/" + format + "/issuementioned.vm";
  String comment = (String) context.get("comment");
  String content = rendererManager.getRenderedContent(
      AtlassianWikiRenderer.RENDERER_TYPE, comment, issueRenderContext);
  context.put("htmlComment", content);
  MailQueueItem item = new MailServiceQueueItemBuilder(from, recipient, subjectTemplatePath,
      bodyTemplatePath, context).buildQueueItemUsingProjectEmailAsReplyTo();
  mailQueue.addItem(item);
}
origin: com.atlassian.jira/jira-core

private Object getRendererCustomFieldValue(FieldLayoutItem fieldLayoutItem, Issue issue, Object value)
{
  Object customFieldValue;
  if (isRenderable() && value instanceof String)
  {
    String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null;
    customFieldValue = rendererManager.getRenderedContent(rendererType, (String) value, issue.getIssueRenderContext());
  }
  else
  {
    customFieldValue = value;
  }
  return customFieldValue;
}
origin: com.atlassian.jira.plugins/jira-fisheye-plugin

public String render(String text, boolean linkCruKeys) {
  if (linkCruKeys) {
    text = CrucibleRenderer.linkCrucibleKeys(text, fishEyeConfig.getCrucibleProjectToUrlMappings());
  }
  IssueRenderContext renderContext = resolveContext(text);
  return rendererManager.getRenderedContent(MESSAGE_RENDERER, text, renderContext);
}
origin: com.atlassian.jira/jira-core

/**
 * Returns the view HTML for this renderable application property.
 *
 * @return a String containing the view HTML
 */
@Override
public final String getViewHtml()
{
  if (isOnDemand())
  {
    return rendererManager.getRenderedContent(AtlassianWikiRenderer.RENDERER_TYPE, getValue(), null);
  }
  // no OnDemand == no encoding
  return getValue();
}
origin: com.atlassian.jira/jira-core

protected void populateVelocityParams(Map params)
{
  params.put("action", this);
  params.put("worklog", this.getWorklog());
  params.put("content", worklog.getComment());
  params.put("userformats", userFormats);
  try
  {
    final FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(IssueFieldConstants.WORKLOG);
    if (fieldLayoutItem != null)
    {
      params.put("content", rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), worklog.getComment(), issue.getIssueRenderContext()));
    }
  }
  catch (DataAccessException e)
  {
    log.error(e.getMessage(), e);
  }
}
origin: com.atlassian.jira/jira-core

  @Override
  public String call()
  {
    CustomField customField = fieldConfig.getCustomField();
    Object value = customField.getCustomFieldType().getDefaultValue(fieldConfig);
    if (customField.isRenderable())
    {
      String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null;
      return rendererManager.getRenderedContent(rendererType, (String) value, null);
    }
    return getViewHtmlByValue(fieldLayoutItem, value, customField, null, TEMPLATE_NAME_VIEW, null);
  }
});
origin: com.atlassian.jira/jira-core

  @Override
  public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequired, FieldLayoutItem fieldLayoutItem)
  {
    FieldJsonRepresentation fieldJsonRepresentation = new FieldJsonRepresentation(new JsonData(getValueFromIssue(issue)));
    if (renderedVersionRequired && isRenderable() && fieldLayoutItem != null && org.apache.commons.lang.StringUtils.isNotBlank(fieldLayoutItem.getRendererType()))
    {
      fieldJsonRepresentation.setRenderedData(new JsonData(rendererManager.getRenderedContent(fieldLayoutItem, issue)));
    }
    return fieldJsonRepresentation;
  }
}
origin: com.atlassian.jira/jira-api

@Override
public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem)
{
  String value = getValueFromIssue(field, issue);
  FieldJsonRepresentation bean = new FieldJsonRepresentation(new JsonData(value));
  if (field.isRenderable() && renderedVersionRequested && fieldLayoutItem != null)
  {
    final String content = ComponentAccessor.getComponent(RendererManager.class).getRenderedContent(fieldLayoutItem, issue);
    bean.setRenderedData(new JsonData(content));
  }
  return bean;
}
origin: com.atlassian.jira/jira-api

  @Override
  public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem)
  {
    Object value = getValueFromIssue(field, issue);
    FieldJsonRepresentation bean = new FieldJsonRepresentation(new JsonData(value));

    if (field.isRenderable() && renderedVersionRequested && fieldLayoutItem != null)
    {
      final String content = ComponentAccessor.getComponent(RendererManager.class).getRenderedContent(fieldLayoutItem, issue);
      bean.setRenderedData(new JsonData(content));
    }

    return bean;
  }
}
origin: com.atlassian.jira/jira-core

  @Override
  public String call()
  {
    final Map<String, Object> combinedMap = getCombinedMap(field.getCustomFieldType().getVelocityParameters(issue, field, fieldLayoutItem), MapBuilder.build(VELOCITY_VALUE_PARAM, field.getValue(issue)));
    if (field.isRenderable() && !raw)
    {
      String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null;
      combinedMap.put("renderedValue", rendererManager.getRenderedContent(rendererType, (String) field.getValue(issue), issue.getIssueRenderContext()));
    }
    return getHtml(TEMPLATE_NAME_XML, combinedMap);
  }
});
origin: com.atlassian.jira/jira-core

@Override
public String getFieldName()
{
  //xss is allowed on BTF until 6.0 so we use wiki renderer to allow simple markup only in OD
  if (featureManager.isOnDemand())
  {
    final IssueRenderContext renderContext = new IssueRenderContext(null);
    renderContext.addParam(IssueRenderContext.INLINE_PARAM, Boolean.TRUE);
    return rendererManager.getRenderedContent(AtlassianWikiRenderer.RENDERER_TYPE, getName(), renderContext);
  } else {
    return TextUtils.htmlEncode(getName());
  }
}
origin: com.atlassian.jira/jira-core

/**
 * Retrieves the html formatted description.
 * <p/>
 * A simple string (with linked bug keys displayed) is returned if a rendered version cannot be generated.
 *
 * @return String   the html formatted description.
 */
public String getHtmlDescription()
{
  // Try to generate rendered values for description
  try
  {
    FieldLayout fieldLayout = fieldLayoutManager.getFieldLayout(issue);
    FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(IssueFieldConstants.DESCRIPTION);
    String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null;
    String renderedContent = rendererManager.getRenderedContent(rendererType, issue.getDescription(), issue.getIssueRenderContext());
    return renderedContent.replaceAll("<p>", "<p style='margin-top:0;margin-bottom:10px;'>");
  }
  catch (Exception e)
  {
    log.warn("Unable to produce rendered version of the description for the issue " + issue.getKey(), e);
    return JiraKeyUtils.linkBugKeys(issue.getDescription());
  }
}
origin: com.atlassian.streams/streams-jira-plugin

public Html renderIssueFieldValue(Issue issue, String fieldId, String value)
{
  FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue.getProjectObject(), issue.getIssueTypeObject().getId()).getFieldLayoutItem(fieldId);
  if (fieldLayoutItem == null)
  {
    return new Html(value);
  }
  return new Html(rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), value, issue.getIssueRenderContext()));
}
origin: com.atlassian.jira/jira-api

/**
 * @return null if the input is null
 */
public static CommentJsonBean renderedShortBean(Comment comment, JiraBaseUrls urls,
    ProjectRoleManager projectRoleManager, DateTimeFormatterFactory dateTimeFormatterFactory,
    RendererManager rendererManager, String rendererType, IssueRenderContext renderContext,
    ApplicationUser loggedInUser, EmailFormatter emailFormatter)
{
  if (comment == null)
  {
    return null;
  }
  final CommentJsonBean bean = new CommentJsonBean();
  addNonRenderableStuff(bean, comment, urls, projectRoleManager, loggedInUser, emailFormatter);
  if (StringUtils.isNotBlank(rendererType))
  {
    bean.body = rendererManager.getRenderedContent(rendererType, comment.getBody(), renderContext);
  }
  else
  {
    bean.body = comment.getBody();
  }
  bean.created = comment.getCreated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(comment.getCreated());
  bean.updated = comment.getUpdated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(comment.getUpdated());
  return bean;
}
origin: com.atlassian.jira/jira-api

public static WorklogJsonBean getRenderedWorklog(final Worklog log, final JiraBaseUrls baseUrls,
     String rendererType, IssueRenderContext renderContext, final ApplicationUser loggedInUser, final EmailFormatter emailFormatter)
{
  final WorklogJsonBean bean = new WorklogJsonBean();
  addNonRenderableData(bean, log, baseUrls, ComponentAccessor.getUserManager(), loggedInUser, emailFormatter);
  if (StringUtils.isNotBlank(rendererType))
  {
     RendererManager rendererManager = ComponentAccessor.getComponent(RendererManager.class);
     bean.comment = rendererManager.getRenderedContent(rendererType, log.getComment(), renderContext);
  }
  else
  {
     bean.comment = log.getComment();
  }
  JiraDurationUtils jiraDurationUtils = ComponentAccessor.getComponent(JiraDurationUtils.class);
  bean.timeSpent = jiraDurationUtils.getFormattedDuration(log.getTimeSpent(), ComponentAccessor.getJiraAuthenticationContext().getLocale());
  DateTimeFormatterFactory dateTimeFormatterFactory = ComponentAccessor.getComponent(DateTimeFormatterFactory.class);
  bean.created = log.getCreated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getCreated());
  bean.updated = log.getUpdated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getUpdated());
  bean.started = log.getStartDate() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getStartDate());
  return bean;
}
com.atlassian.jira.issueRendererManagergetRenderedContent

Javadoc

A convienience method that is the equivilant of calling the getRendererForField method and then invoking the render method on the returned renderer, using the value of the field that is associated with the issue. This will make sure that the passed context is initialized.

Popular methods of RendererManager

  • getRendererForType
    Will return a field renderer for the given renderer type. If the renderer does not exist for the typ
  • getAllActiveRenderers
    Gets all the renderers in the system that have a RenderConfiguration in which the renderer is set as

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now