java.lang.Object
com.atlassian.greenhopper.web.rapid.issue.fields.FieldHelper

@Service public class FieldHelper extends Object
Contains methods which are useful for the FieldEntryFactory classes in rendering and updating their values.
Author:
mtokar
  • Constructor Details

    • FieldHelper

      public FieldHelper()
  • Method Details

    • renderListField

      public static <T> String renderListField(Collection<T> values, com.google.common.base.Function<T,String> toStringFunction)
      Transforms a list of values into a comma-separated string representation
      Type Parameters:
      T - a property of an issue e.g. Version, ProjectComponent
      Parameters:
      values - the value objects
      toStringFunction - the function which converts the value object to its String representation
      Returns:
      the comma-separated string; null if there were no values
    • getRenderedText

      public String getRenderedText(com.atlassian.jira.issue.Issue issue, String fieldId, String value)
      Renders a text using the field layout defined for the given field/issue.
      Parameters:
      issue - the issue containing this field
      fieldId - the ID of the field to render
      value - the value to render
      Returns:
      the rendered text, html encoded?
    • updateField

      @Nonnull public ServiceResult updateField(com.atlassian.jira.user.ApplicationUser user, com.atlassian.jira.issue.Issue issue, SimpleEditableFieldEntryFactory editableField, String newValue)
      Updates the value of a SimpleEditableFieldEntryFactory for the specified Issue using the IssueUpdateService.
      Parameters:
      user - the user performing the update
      issue - the issue to be updated
      editableField - the field we are updating
      newValue - the new value for that field
      Returns:
      the outcome - may contain errors if update failed.
    • createDateFieldViewEntry

      public HtmlFieldEntry createDateFieldViewEntry(I18n2 i18n, com.atlassian.jira.user.ApplicationUser user, @Nullable Timestamp date, String id, String labelKey)
      Factory method for creating FieldEntry's for date fields.
    • getFieldLayoutItem

      public com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem getFieldLayoutItem(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.Field field)
    • getFieldLayoutItem

      public com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem getFieldLayoutItem(com.atlassian.jira.issue.Issue issue, String fieldId)
    • isFieldVisible

      public boolean isFieldVisible(com.atlassian.jira.issue.fields.Field field, com.atlassian.jira.issue.Issue issue)
    • isCustomFieldValid

      public boolean isCustomFieldValid(com.atlassian.jira.issue.fields.CustomField field, com.atlassian.jira.issue.Issue issue)
    • isFieldVisible

      public boolean isFieldVisible(String id, com.atlassian.jira.issue.Issue issue)