Class FieldHelper
java.lang.Object
com.atlassian.greenhopper.web.rapid.issue.fields.FieldHelper
Contains methods which are useful for the
FieldEntryFactory
classes in rendering and updating their values.- Author:
- mtokar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDateFieldViewEntry
(I18n2 i18n, com.atlassian.jira.user.ApplicationUser user, Timestamp date, String id, String labelKey) Factory method for creating FieldEntry's for date fields.com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem
getFieldLayoutItem
(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.Field field) com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem
getFieldLayoutItem
(com.atlassian.jira.issue.Issue issue, String fieldId) getRenderedText
(com.atlassian.jira.issue.Issue issue, String fieldId, String value) Renders a text using the field layout defined for the given field/issue.boolean
isCustomFieldValid
(com.atlassian.jira.issue.fields.CustomField field, com.atlassian.jira.issue.Issue issue) boolean
isFieldVisible
(com.atlassian.jira.issue.fields.Field field, com.atlassian.jira.issue.Issue issue) boolean
isFieldVisible
(String id, com.atlassian.jira.issue.Issue issue) 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 representationupdateField
(com.atlassian.jira.user.ApplicationUser user, com.atlassian.jira.issue.Issue issue, SimpleEditableFieldEntryFactory editableField, String newValue) Updates the value of aSimpleEditableFieldEntryFactory
for the specifiedIssue
using theIssueUpdateService
.
-
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 objectstoStringFunction
- the function which converts the value object to its String representation- Returns:
- the comma-separated string; null if there were no values
-
getRenderedText
Renders a text using the field layout defined for the given field/issue.- Parameters:
issue
- the issue containing this fieldfieldId
- the ID of the field to rendervalue
- 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 aSimpleEditableFieldEntryFactory
for the specifiedIssue
using theIssueUpdateService
.- Parameters:
user
- the user performing the updateissue
- the issue to be updatededitableField
- the field we are updatingnewValue
- 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
-