java.lang.Object
   ↳ com.atlassian.jira.issue.fields.AbstractField
     ↳ com.atlassian.jira.issue.fields.AbstractOrderableField<V>
       ↳ com.atlassian.jira.issue.fields.CommentSystemField

Class Overview

Defines a comment in Jira.

Summary

Constants
String CREATE_COMMENT
String EDIT_COMMENT
String PARAM_COMMENT_ID
String PARAM_COMMENT_LEVEL The parameter name of the user-chosen group or role-type "level" for restricting the comment visibility
String PARAM_COMMENT_OBJECT
String PARAM_COMMENT_PROPERTY
String PARAM_GROUP_LEVEL The parameter name of the user-chosen group-type "level" for restricting the comment visibility
String PARAM_LEVEL_PRESENT
String PARAM_ROLE_LEVEL The parameter name of the user-chosen role-type "level" for restricting the comment visibility
String REMOVE_COMMENT
[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.fields.OrderableField
[Expand]
Inherited Fields
From class com.atlassian.jira.issue.fields.AbstractField
Public Constructors
CommentSystemField(VelocityTemplatingEngine templatingEngine, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, RendererManager rendererManager, PermissionManager permissionManager, CommentService commentService, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory, CommentSearchHandlerFactory searchHandlerFactory, GroupManager groupManager, JiraBaseUrls jiraBaseUrls, CommentManager commentManager, DateTimeFormatterFactory dateTimeFormatterFactory, MentionService mentionService, CommentFieldRenderer commentFieldRenderer, DefaultCommentPropertyService commentPropertyService, I18nHelper.BeanFactory i18nFactory, EmailFormatter emailFormatter)
Public Methods
String availableForBulkEdit(BulkEditBean bulkEditBean)
boolean canRemoveValueFromIssueObject(Issue issue)
void createValue(Issue issue, Map<StringObject> value)
static ImmutableMap<StringJSONObject> getCommentPropertiesFromParameters(Map<StringObject> commentParams)
String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)
Map<StringObject> getDefaultValue(Issue issue)
String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
JsonData getJsonDefaultValue(IssueContext issueCtx)
Return The default data for this system field.
FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequired, FieldLayoutItem fieldLayoutItem)
Return a FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.
JsonType getJsonSchema()
Return a description of the shape of this field when represented as JSON.
RestFieldOperationsHandler getRestFieldOperation()
String getValueFromIssue(Issue issue)
Gets the value stored for this field on the provided issue.
Map<StringObject> getValueFromParams(Map params)
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map<StringObject> value, Map displayParameters)
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)
boolean hasValue(Issue issue)
boolean isRenderable()
Defines if a field determines itself as renderable.
boolean isShown(Issue issue)
MessagedResult needsMove(Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem)
void populateAdditionalInputs(Map fieldValuesHolder, Map<StringObject> additionalInputs)
Extracts comment values from the fieldValuesHolder and places them in another map to be used by the WorkflowManager.
void populateDefaults(Map<StringObject> fieldValuesHolder, Issue issue)
void populateForMove(Map<StringObject> fieldValuesHolder, Issue originalIssue, Issue targetIssue)
void populateFromIssue(Map<StringObject> fieldValuesHolder, Issue issue)
void populateParamsFromString(Map<StringObject> fieldValuesHolder, String stringValue, Issue issue)
void removeValueFromIssueObject(MutableIssue issue)
void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder)
Sets the value as a modified external field in the issue so that this field will be updated along with all the other modified issue values.
void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)
void validateCommentProperties(Map<StringObject> properties, ErrorCollection errorCollection)
void validateParams(OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem)
Protected Methods
Object getRelevantParams(Map<StringString[]> params)
Defines the object that will be passed through to the create method
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.fields.AbstractOrderableField
From class com.atlassian.jira.issue.fields.AbstractField
From class java.lang.Object
From interface com.atlassian.jira.issue.fields.Field
From interface com.atlassian.jira.issue.fields.OrderableField
From interface com.atlassian.jira.issue.fields.SearchableField
From interface com.atlassian.jira.issue.fields.renderer.RenderableField
From interface com.atlassian.jira.issue.fields.rest.RestAwareField
From interface com.atlassian.jira.issue.fields.rest.RestFieldOperations
From interface java.lang.Comparable

Constants

public static final String CREATE_COMMENT

Constant Value: "comment.create.param"

public static final String EDIT_COMMENT

Constant Value: "comment.edit.param"

public static final String PARAM_COMMENT_ID

Constant Value: "comment:id"

public static final String PARAM_COMMENT_LEVEL

The parameter name of the user-chosen group or role-type "level" for restricting the comment visibility

Constant Value: "commentLevel"

public static final String PARAM_COMMENT_OBJECT

Constant Value: "commentObject"

public static final String PARAM_COMMENT_PROPERTY

Constant Value: "commentProperty"

public static final String PARAM_GROUP_LEVEL

The parameter name of the user-chosen group-type "level" for restricting the comment visibility

Constant Value: "groupLevel"

public static final String PARAM_LEVEL_PRESENT

Constant Value: "levelPresent"

public static final String PARAM_ROLE_LEVEL

The parameter name of the user-chosen role-type "level" for restricting the comment visibility

Constant Value: "roleLevel"

public static final String REMOVE_COMMENT

Constant Value: "comment.remove.param"

Public Constructors

public CommentSystemField (VelocityTemplatingEngine templatingEngine, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, RendererManager rendererManager, PermissionManager permissionManager, CommentService commentService, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory, CommentSearchHandlerFactory searchHandlerFactory, GroupManager groupManager, JiraBaseUrls jiraBaseUrls, CommentManager commentManager, DateTimeFormatterFactory dateTimeFormatterFactory, MentionService mentionService, CommentFieldRenderer commentFieldRenderer, DefaultCommentPropertyService commentPropertyService, I18nHelper.BeanFactory i18nFactory, EmailFormatter emailFormatter)

Public Methods

public String availableForBulkEdit (BulkEditBean bulkEditBean)

public boolean canRemoveValueFromIssueObject (Issue issue)

public void createValue (Issue issue, Map<StringObject> value)

public static ImmutableMap<StringJSONObject> getCommentPropertiesFromParameters (Map<StringObject> commentParams)

Throws
JSONException

public String getCreateHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)

public Map<StringObject> getDefaultValue (Issue issue)

public String getEditHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)

public FieldTypeInfo getFieldTypeInfo (FieldTypeInfoContext fieldTypeInfoContext)

Returns lower level Information about the field. This information contains allowed values and/or the autocomplete url

Parameters
fieldTypeInfoContext the FieldTypeInfoContext contains context information that is relevant to generate the FieldTypeInfo

public JsonData getJsonDefaultValue (IssueContext issueCtx)

Return The default data for this system field. May be null if there is no default.

Parameters
issueCtx Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.

public FieldJsonRepresentation getJsonFromIssue (Issue issue, boolean renderedVersionRequired, FieldLayoutItem fieldLayoutItem)

Return a FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.

Parameters
issue to get field data from
renderedVersionRequired whether the use requested the return of rendered/pretty data as well as raw data
fieldLayoutItem field layout for this field. Will only be supplied if the field is also an ordereable field.
Returns
  • FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.

public JsonType getJsonSchema ()

Return a description of the shape of this field when represented as JSON.

public RestFieldOperationsHandler getRestFieldOperation ()

public String getValueFromIssue (Issue issue)

Gets the value stored for this field on the provided issue.

Parameters
issue identifies the issue that will contain the value for this field.
Returns
  • the value stored on this issue for this field, null if not applicable.

public Map<StringObject> getValueFromParams (Map params)

public String getViewHtml (FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map<StringObject> value, Map displayParameters)

public String getViewHtml (FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)

public boolean hasValue (Issue issue)

public boolean isRenderable ()

Defines if a field determines itself as renderable. This is needed because of the way that customfields are implemented. Since all the real work is done in CustomFieldTypes, if we want to treat system fields and custom fields the same way in the renderers then all custom fields must implement this interface. We therefore provide this method so that the CustomFieldImpl can delegate to the CustomFieldTypes to determine if a given custom field is renderable.

Returns
  • true if the field is renderable, false otherwise.

public boolean isShown (Issue issue)

public MessagedResult needsMove (Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem)

public void populateAdditionalInputs (Map fieldValuesHolder, Map<StringObject> additionalInputs)

Extracts comment values from the fieldValuesHolder and places them in another map to be used by the WorkflowManager. These additional inputs are required by the CreateCommentFunction to successfully create a comment.

Parameters
fieldValuesHolder a map containing comment values from a BulkEdit. Obtained from BulkEditBean.
additionalInputs a map to be passed onto a WorkflowManager.

public void populateDefaults (Map<StringObject> fieldValuesHolder, Issue issue)

public void populateForMove (Map<StringObject> fieldValuesHolder, Issue originalIssue, Issue targetIssue)

public void populateFromIssue (Map<StringObject> fieldValuesHolder, Issue issue)

public void populateParamsFromString (Map<StringObject> fieldValuesHolder, String stringValue, Issue issue)

public void removeValueFromIssueObject (MutableIssue issue)

public void updateIssue (FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder)

Sets the value as a modified external field in the issue so that this field will be updated along with all the other modified issue values.

public void updateValue (FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)

public void validateCommentProperties (Map<StringObject> properties, ErrorCollection errorCollection)

public void validateParams (OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem)

Protected Methods

protected Object getRelevantParams (Map<StringString[]> params)

Defines the object that will be passed through to the create method

Parameters
params is a representation of the request params that are available
Returns
  • an object that holds the params we need for this Field.