Class ImmutableCustomField
- All Implemented Interfaces:
ConfigurableField<Object>
,CustomField
,DefaultValueField<Object>
,Field
,HideableField
,NavigableField
,OrderableField<Object>
,RenderableField
,RequirableField
,RestAwareField
,RestFieldOperations
,SearchableField
,Comparable
CustomFieldManager
.-
Field Summary
Fields inherited from interface com.atlassian.jira.issue.fields.CustomField
ENTITY_CF_TYPE_KEY, ENTITY_CUSTOM_FIELD_SEARCHER, ENTITY_DESCRIPTION, ENTITY_ID, ENTITY_ISSUES_WITH_VALUE, ENTITY_ISSUETYPE, ENTITY_LAST_VALUE_UPDATE, ENTITY_NAME, ENTITY_PROJECT, ENTITY_TABLE_NAME
Fields inherited from interface com.atlassian.jira.issue.fields.NavigableField
ORDER_ASCENDING, ORDER_DESCENDING, TEMPLATE_DIRECTORY_PATH
Fields inherited from interface com.atlassian.jira.issue.fields.OrderableField
MOVE_ISSUE_PARAM_KEY, NO_HEADER_PARAM_KEY, TEMPLATE_DIRECTORY_PATH
-
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean
areDifferent
(Object obj1, Object obj2) Compare two objects - return false if both are null or equal.availableForBulkEdit
(BulkEditBean bulkEditBean) Checks if custom field is available for bulk edit operation, whether 'shown' and if user has bulk update permission.boolean
Returnstrue
if a call toOrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue)
will actually remove the value.int
This method compares the values of this custom field in two given issues.int
ReturnSearchHandler
for the field.void
createValue
(Issue issue, Object value) Create the value of the issue in the data store.boolean
Returns a list ofIssueType
s directly associated with thisCustomField
.Returns a list ofProject
s directly associated with thisCustomField
.getBulkEditHtml
(OperationContext operationContext, webwork.action.Action action, BulkEditBean bulkEditBean, Map displayParameters) Returns HTML that should be shown when the issue is being bulk edited.Return the JQL clause names that this custom field should be recognized by.getColumnViewHtml
(FieldLayoutItem fieldLayoutItem, Map displayParams, Issue issue) Returns a List ofFieldConfigItemType
objects.Returns a list of configuration schemes.getCreateHtml
(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue) Returns the HTML that should be shown when the issue is being created.getCreateHtml
(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map dispayParameters) Returns the HTML that should be shown when the issue is being created.Retrieves theCustomFieldSearcher
for this custom field looking it up in the customFieldManager by the searcher key retrieved fromCustomField.ENTITY_CUSTOM_FIELD_SEARCHER
underlying generic value attribute.Looks up theCustomFieldType
in thecustomFieldTypeModuleDescriptors
by the key retrieved from theCustomField.ENTITY_CF_TYPE_KEY
attribute of the underlying generic value.getCustomFieldValues
(Map customFieldValuesHolder) Get the custom field string values that are relevant to this particular custom fieldReturnsNavigableField.ORDER_ASCENDING
.getDefaultValue
(Issue issue) The value that should be set on the issue if the field is not shown for some reason.Returns the i18n'ed description of this custom field.Returns aRenderableProperty
for rendering this custom field's description.getEditHtml
(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue) Returns HTML that should be shown when the issue is being edited.getEditHtml
(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map dispayParameters) Returns HTML that should be shown when the issue is being edited.protected com.atlassian.event.api.EventPublisher
Overridable location to retrieve anEventPublisher
to publish events through.Returns the title of this custom field.getFieldTypeInfo
(FieldTypeInfoContext fieldTypeInfoContext) Returns lower level Information about the field.org.ofbiz.core.entity.GenericValue
Returns a generic value that represents this custom field.Returns the id of the field to check for visibility.protected I18nHelper
getId()
The unique id of the fieldReturns ID of this custom field.Returns number of issues containing at least one non empty value for the custom field.getJsonDefaultValue
(IssueContext issueCtx) Return The default data for this system field.getJsonFromIssue
(Issue issue, boolean renderedVersionRequested, 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.Return a description of the shape of this field when represented as JSON.Returns the latest date of either: - creation date of an issue with a non default value of the custom field - issue update date when value of the custom field has been changedgetName()
Returns the name of this custom field.The i18n key that is used to lookup the field's name when it is displayedgetOptions
(FieldConfig config) Returns options for this custom field if it is ofMultipleCustomFieldType
type.getOptions
(String key, JiraContextNode jiraContextNode) Returns options for this custom field if it is ofMultipleCustomFieldType
type.getOptions
(String key, FieldConfig config, JiraContextNode contextNode) Returns options for this custom field if it is ofMultipleCustomFieldType
type.com.opensymphony.module.propertyset.PropertySet
getRelevantConfig
(IssueContext issueContext) Returns the relevant field config of this custom field for the give issue contextgetRelevantConfig
(Issue issue) Returns a relevantFieldConfig
for the given issue.getReleventConfig
(SearchContext searchContext) Return the relevant field config for the search context specified.org.apache.lucene.search.FieldComparatorSource
Return a SortComparatorSource that uses either a custom field searcher that implementsSortableCustomFieldSearcher
or a custom field that implementsSortableCustomField
.If this field has a searcher, and this searcher implementsSortableCustomFieldSearcher
then returnSortableCustomFieldSearcher.getSorter(CustomField)
.List<org.apache.lucene.search.SortField>
getSortFields
(boolean sortOrder) Return a list of Lucene SortFields to be used for sorting search results.Returns the description of this custom field by readingCustomField.ENTITY_DESCRIPTION
of the underlying generic value.Returns aRenderableProperty
for rendering this custom field's description.Returns the name of this custom field by readingCustomField.ENTITY_NAME
of the underlying generic value.Retrieves and returns the Object representing the this CustomField value for the given issue.getValueFromIssue
(Issue issue) Gets the value stored for this field on the provided issue.getValueFromParams
(Map params) Get a field value from the map of parameters passed.getViewHtml
(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue) getViewHtml
(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Object value, Map displayParameters) getViewHtml
(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Map displayParameters) protected boolean
hasBulkUpdatePermission
(BulkEditBean bulkEditBean, Issue issue) Checks whether the user has the permission to execute the bulk operation for the provided issue.int
hashCode()
boolean
Checks to see if the (web) parameters contains a relevant value with which to populate the issueboolean
Determines if the field has a value for the given issue.boolean
Returns true if it applies for all issue types, false otherwise.boolean
Checks whether this custom field applies for all projects.boolean
Returns true if this custom field has an edit template, false otherwise.boolean
Returns true if any configuration scheme returned bygetConfigurationSchemes()
is enabled.boolean
isGlobal()
Returns true if this custom field applies for all projects and all issue types.boolean
Determines if this custom field is within the scope of the given project, and Issue Type.boolean
isInScope
(SearchContext searchContext) Determines whether this custom field is in scope.boolean
Determines if this custom field is within the scope of the given project, and list of Issue Types.boolean
isInScopeForSearch
(Project project, List<String> issueTypeIds) Determines if this custom field is within the scope of the given project, and list of Issue Types.boolean
isRelevantForIssueContext
(IssueContext issueContext) Returns true if the custom field has a config for the Project and Issue Type of the given IssueContext.boolean
This is the conjunction point with CustomFieldTypes and this is delegated off to customField Types.boolean
Tests field specific way to determine if it should be shown or not.needsMove
(Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem) Used to determine if the field needs input from user to be moved to the new project and/or issue type.void
populateDefaults
(Map<String, Object> customFieldValuesHolder, Issue issue) Populate the fieldValueHolder with a value that should be shown by default when the issue has not been created yet.void
Used to populate the fieldValueHolder with parameters for move issue screen.void
populateFromIssue
(Map<String, Object> customFieldValuesHolder, Issue issue) Puts the custom field parameters retrieved from the given issue to the given customFieldValuesHolder map.void
Puts the relevant parameters from the given params map to the given customFieldValuesHolder map.void
Does nothing.prettyPrintChangeHistory
(String changeHistory) Returns the same string.prettyPrintChangeHistory
(String changeHistory, I18nHelper i18nHelper) Returns the same string.remove()
Removes this custom field and returns a set of issue IDs of all issues that are affected by removal of this custom field.void
Removes the field value from the given MutableIssue object.toString()
void
updateIssue
(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder) Record the value on the issue (not saving it to the database, see updateValue).void
updateValue
(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder) Update the issue in the data store.void
validateFromActionParams
(Map actionParameters, ErrorCollection errorCollection, FieldConfig config) Validates relevant parameters on custom field type of this custom field.void
validateParams
(OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem) Ensure that the parameters are validMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.atlassian.jira.issue.fields.CustomField
getOptions
Methods inherited from interface com.atlassian.jira.issue.fields.NavigableField
prettyPrintChangeHistory
-
Method Details
-
isInScope
Description copied from interface:CustomField
Determines if this custom field is within the scope of the given project, and list of Issue Types.- Specified by:
isInScope
in interfaceCustomField
- Parameters:
project
- The project.issueTypeIds
- A list of IssueType ids.- Returns:
true
if this custom field is within the given scope.
-
isInScope
Description copied from interface:CustomField
Determines if this custom field is within the scope of the given project, and Issue Type.- Specified by:
isInScope
in interfaceCustomField
- Parameters:
projectId
- The project.issueTypeId
- The issueTypeId- Returns:
true
if this custom field is within the given scope.- See Also:
-
isInScopeForSearch
Description copied from interface:CustomField
Determines if this custom field is within the scope of the given project, and list of Issue Types.If the project is null, then it is treated as any project. If the issueTypeIds list is null or an empty list, then it is treated as any issue type.
If the passed project is any project, this method will search in all the
FieldConfigScheme
of this custom field, ignoring the projects that they apply to (since the given project is any) and looking for at least one of them that applies to at least one of the given issue type ids.If the passed list of issue types is any issue type, this method will search for at least one
FieldConfigScheme
that applies to the given project, ignoring the issue types that it applies to (since the given issue type ids are any).If both the project and issue types are any, the question being asked is "is this custom field in the scope of any project and any issue type?", which will always be true.
- Specified by:
isInScopeForSearch
in interfaceCustomField
-
getReleventConfig
Return the relevant field config for the search context specified. Checks that all configs within search context are the same - i.e. all null or all the same config. Returns null if any two configs are different. Note: null config is not equal to non-null config. Previously, a non-null config was returned even if the first config(s) was null.- Specified by:
getReleventConfig
in interfaceCustomField
- Parameters:
searchContext
- search context- Returns:
- null if any two configs are different
-
getClauseNames
Description copied from interface:CustomField
Return the JQL clause names that this custom field should be recognized by.- Specified by:
getClauseNames
in interfaceCustomField
- Returns:
- the clause names this custom field should be recognized by.
-
isInScope
Description copied from interface:CustomField
Determines whether this custom field is in scope.- Specified by:
isInScope
in interfaceCustomField
- Parameters:
searchContext
- search context- Returns:
- true if this field is in scope
-
validateFromActionParams
public void validateFromActionParams(Map actionParameters, ErrorCollection errorCollection, FieldConfig config) Validates relevant parameters on custom field type of this custom field. Any errors found are added to the given errorCollection. SeeCustomFieldType.validateFromParams(CustomFieldParams, ErrorCollection, FieldConfig)
- Specified by:
validateFromActionParams
in interfaceCustomField
- Parameters:
actionParameters
- action parameterserrorCollection
- error collection to add errors toconfig
- field config
-
getValue
Retrieves and returns the Object representing the this CustomField value for the given issue. SeeCustomFieldType.getValueFromIssue(CustomField, Issue)
- Specified by:
getValue
in interfaceCustomField
- Parameters:
issue
- issue to retrieve the value from- Returns:
- Object representing the this CustomField value for the given issue
- See Also:
-
isRenderable
public boolean isRenderable()This is the conjunction point with CustomFieldTypes and this is delegated off to customField Types.- Specified by:
isRenderable
in interfaceRenderableField
- Returns:
- true if the custom field supports interaction with the renderers, false otherwise. Text based fields will be able to interact with the renderers.
-
updateValue
public void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder) Description copied from interface:OrderableField
Update the issue in the data store.Fields that are simply stored in the JIRAISSUE DB table, need not do anything here as this table is written to one time to include all fields that changed. Fields using other DB tables must update that table with the appropriate values.
- Specified by:
updateValue
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- for this field within this contextissue
- Issue this field is part ofmodifiedValue
- new value to set field to. Cannot be null.issueChangeHolder
- an object to record any changes made to the issue by this method.
-
prettyPrintChangeHistory
Returns the same string.- Specified by:
prettyPrintChangeHistory
in interfaceNavigableField
- Parameters:
changeHistory
- change history string- Returns:
- change history string
-
prettyPrintChangeHistory
Returns the same string.- Specified by:
prettyPrintChangeHistory
in interfaceNavigableField
- Parameters:
changeHistory
- change history stringi18nHelper
- not used- Returns:
- change history string
-
isEditable
public boolean isEditable()Returns true if this custom field has an edit template, false otherwise.- Specified by:
isEditable
in interfaceCustomField
- Returns:
- true if this custom field has an edit template, false otherwise.
-
getOptions
Returns options for this custom field if it is ofMultipleCustomFieldType
type. Otherwise returns null.- Specified by:
getOptions
in interfaceCustomField
- Parameters:
key
- not usedjiraContextNode
- JIRA context node - used to retrieve the relevant field config- Returns:
- options for this custom field if it is of
MultipleCustomFieldType
type, null otherwise
-
getOptions
Returns options for this custom field if it is ofMultipleCustomFieldType
type. Otherwise, returns null.- Specified by:
getOptions
in interfaceCustomField
- Parameters:
key
- not usedconfig
- relevant field configcontextNode
- JIRA context node (not used)- Returns:
- options for this custom field if it is of
MultipleCustomFieldType
type, null otherwise
-
getOptions
Description copied from interface:CustomField
Returns options for this custom field if it is ofMultipleCustomFieldType
type. Null otherwise.As this is just used by the view layer, it can be a list of objects
- Specified by:
getOptions
in interfaceCustomField
- Parameters:
config
- relevant field config- Returns:
- options for this custom field if it is of
MultipleCustomFieldType
type, null otherwise
-
populateDefaults
Description copied from interface:OrderableField
Populate the fieldValueHolder with a value that should be shown by default when the issue has not been created yet.- Specified by:
populateDefaults
in interfaceOrderableField<Object>
- Parameters:
customFieldValuesHolder
- The fieldValuesHolder Map to be populated.issue
- The Issue.
-
isRelevantForIssueContext
Description copied from interface:CustomField
Returns true if the custom field has a config for the Project and Issue Type of the given IssueContext.This is equivalent to calling
getRelevantConfig(issueContext) != null
but in general can run faster because it does not have to resolve the actual FieldConfig.- Specified by:
isRelevantForIssueContext
in interfaceCustomField
- Parameters:
issueContext
- IssueContext whose project and issue type will be used to check if the field has a config- Returns:
- an instance of
FieldConfig
representing the configuration of the field for issue's project/issue type. If the field does not have a config for issue's project/issue type, null is returned. - See Also:
-
getRelevantConfig
Returns the relevant field config of this custom field for the give issue context- Specified by:
getRelevantConfig
in interfaceConfigurableField<Object>
- Specified by:
getRelevantConfig
in interfaceCustomField
- Parameters:
issueContext
- issue context to find the relevant field config for- Returns:
- the relevant field config of this custom field for the give issue context
- See Also:
-
getRelevantConfig
Description copied from interface:CustomField
Returns a relevantFieldConfig
for the given issue. If the field has a config for the issue then one will be returned, otherwise null is returned.For example, if we have 2 projects: project A and project B, and a custom field is configured to be only applicable to project A, calling getRelevantConfig with an issue from project A should return the config (i.e. not null). Calling this method with an issue from project B should return null.
- Specified by:
getRelevantConfig
in interfaceCustomField
- Parameters:
issue
- issue whose project and issue type will be used to check if the field has a config- Returns:
- an instance of
FieldConfig
representing the configuration of the field for issue's project/issue type. If the field does not have a config for issue's project/issue type, null is returned. - See Also:
-
hasParam
Description copied from interface:OrderableField
Checks to see if the (web) parameters contains a relevant value with which to populate the issue- Specified by:
hasParam
in interfaceOrderableField<Object>
- Parameters:
parameters
- Map of HTTP request parameters ("Action parameters").
-
populateFromParams
public void populateFromParams(Map<String, Object> customFieldValuesHolder, Map<String, String[]> params) Puts the relevant parameters from the given params map to the given customFieldValuesHolder map.- Specified by:
populateFromParams
in interfaceOrderableField<Object>
- Parameters:
customFieldValuesHolder
- map of custom field valuesparams
- map of parameters
-
populateFromIssue
Puts the custom field parameters retrieved from the given issue to the given customFieldValuesHolder map.- Specified by:
populateFromIssue
in interfaceOrderableField<Object>
- Parameters:
customFieldValuesHolder
- map of custom field valuesissue
- issue to get the custom field parameters from
-
getValueFromParams
Description copied from interface:OrderableField
Get a field value from the map of parameters passed. The params map may contain other parameters that are not relevant to this custom field.- Specified by:
getValueFromParams
in interfaceOrderableField<Object>
- Parameters:
params
- the map of parameters.- Returns:
- Value for this field from the map of parameters.
- Throws:
FieldValidationException
- if there is a problem with Field Validation.
-
populateParamsFromString
public void populateParamsFromString(Map<String, Object> fieldValuesHolder, String stringValue, Issue issue) Does nothing. Throws UnsupportedOperationException.- Specified by:
populateParamsFromString
in interfaceOrderableField<Object>
- Parameters:
fieldValuesHolder
- not usedstringValue
- not usedissue
- not used- Throws:
UnsupportedOperationException
- always
-
getConfigurationItemTypes
Description copied from interface:ConfigurableField
Returns a List ofFieldConfigItemType
objects. This opens up possibilties for configurable custom fields- Specified by:
getConfigurationItemTypes
in interfaceConfigurableField<Object>
- Returns:
- List of
FieldConfigItemType
@Nonnull
-
createAssociatedSearchHandler
Description copied from interface:SearchableField
ReturnSearchHandler
for the field. This object tells JIRA how to search for values within the field.- Specified by:
createAssociatedSearchHandler
in interfaceSearchableField
- Returns:
- the SearchHandler associated with the field. Can return
null
when no searcher is associated with the field. This will mainly happen when a customfield is configured to have no searcher.
-
createValue
Description copied from interface:OrderableField
Create the value of the issue in the data store.- Specified by:
createValue
in interfaceOrderableField<Object>
- Parameters:
issue
- Issue this field is part ofvalue
- Value to store in this field (eg. Collection for Version fields). Cannot be null.
-
validateParams
public void validateParams(OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem) Description copied from interface:OrderableField
Ensure that the parameters are valid- Specified by:
validateParams
in interfaceOrderableField<Object>
- Parameters:
operationContext
- OperationContexterrorCollectionToAddTo
- ErrorCollection to add to.i18n
- I18nHelperissue
- This is passed to get the value of other fields that may or may not have been modified.fieldScreenRenderLayoutItem
- FieldScreenRenderLayoutItem
-
getCustomFieldValues
Description copied from interface:CustomField
Get the custom field string values that are relevant to this particular custom field- Specified by:
getCustomFieldValues
in interfaceCustomField
- Parameters:
customFieldValuesHolder
- containing all params- Returns:
- a
CustomFieldParams
ofString
objects
-
remove
Description copied from interface:CustomField
Removes this custom field and returns a set of issue IDs of all issues that are affected by removal of this custom field.- Specified by:
remove
in interfaceCustomField
- Returns:
- a set of issue IDs of affected issues
- Throws:
DataAccessException
- if removal of generic value fails
-
toString
-
getColumnViewHtml
- Specified by:
getColumnViewHtml
in interfaceNavigableField
-
getI18nHelper
-
getHiddenFieldId
Description copied from interface:NavigableField
Returns the id of the field to check for visibility. For example, with original estimate field need to ensure that the timetracking field is not hidden. With most fields, this is the same as their id.- Specified by:
getHiddenFieldId
in interfaceNavigableField
-
getCreateHtml
public String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue) Description copied from interface:OrderableField
Returns the HTML that should be shown when the issue is being created.- Specified by:
getCreateHtml
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- FieldLayoutItemoperationContext
- OperationContextaction
- Actionissue
- Issue- Returns:
- the HTML that should be shown when the issue is being created.
-
getCreateHtml
public String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map dispayParameters) Description copied from interface:OrderableField
Returns the HTML that should be shown when the issue is being created.- Specified by:
getCreateHtml
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- FieldLayoutItemoperationContext
- OperationContextaction
- Actionissue
- IssuedispayParameters
- Map of display parameters.- Returns:
- the HTML that should be shown when the issue is being created.
-
getEditHtml
public String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue) Description copied from interface:OrderableField
Returns HTML that should be shown when the issue is being edited.- Specified by:
getEditHtml
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- FieldLayoutItemoperationContext
- OperationContextaction
- Actionissue
- Issue- Returns:
- HTML that should be shown when the issue is being edited.
-
getEditHtml
public String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map dispayParameters) Description copied from interface:OrderableField
Returns HTML that should be shown when the issue is being edited.- Specified by:
getEditHtml
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- FieldLayoutItemoperationContext
- OperationContextaction
- Actionissue
- IssuedispayParameters
- Map of display parameters.- Returns:
- HTML that should be shown when the issue is being edited.
-
getBulkEditHtml
public String getBulkEditHtml(OperationContext operationContext, webwork.action.Action action, BulkEditBean bulkEditBean, Map displayParameters) Description copied from interface:OrderableField
Returns HTML that should be shown when the issue is being bulk edited.- Specified by:
getBulkEditHtml
in interfaceOrderableField<Object>
- Parameters:
operationContext
- OperationContextaction
- ActionbulkEditBean
- BulkEditBeandisplayParameters
- Map of display parameters.- Returns:
- HTML that should be shown when the issue is being edited.
-
getViewHtml
public String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue) - Specified by:
getViewHtml
in interfaceOrderableField<Object>
-
getViewHtml
public String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Map displayParameters) - Specified by:
getViewHtml
in interfaceOrderableField<Object>
-
getViewHtml
public String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Object value, Map displayParameters) - Specified by:
getViewHtml
in interfaceOrderableField<Object>
-
isShown
Description copied from interface:OrderableField
Tests field specific way to determine if it should be shown or not.- Specified by:
isShown
in interfaceOrderableField<Object>
- Parameters:
issue
- The Issue.- Returns:
- true if it should be shown.
-
getDefaultValue
Description copied from interface:OrderableField
The value that should be set on the issue if the field is not shown for some reason.For example: The user does not have permission to see the field, or the field is not part of the create screen.
- Specified by:
getDefaultValue
in interfaceOrderableField<Object>
- Parameters:
issue
- the Issue.- Returns:
- The default value. It can be null, or an empty collection.
-
updateIssue
Description copied from interface:OrderableField
Record the value on the issue (not saving it to the database, see updateValue).- Specified by:
updateIssue
in interfaceOrderableField<Object>
- Parameters:
fieldLayoutItem
- FieldLayoutItemissue
- MutableIssuefieldValueHolder
- Field Value Holder Map- See Also:
-
needsMove
public MessagedResult needsMove(Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem) Description copied from interface:OrderableField
Used to determine if the field needs input from user to be moved to the new project and/or issue type. This method is called only if the field is visible in the target project/issue type.- Specified by:
needsMove
in interfaceOrderableField<Object>
- Parameters:
originalIssues
- Collection of original Issues.targetIssue
- Nonexistent issue object with values representing those of issue(s) after movetargetFieldLayoutItem
- FieldLayoutItem- Returns:
- A MessagedResult with result=true if the field needs input to be moved.
-
populateForMove
public void populateForMove(Map<String, Object> fieldValuesHolder, Issue originalIssue, Issue targetIssue) Description copied from interface:OrderableField
Used to populate the fieldValueHolder with parameters for move issue screen. This field is only called if the issue needs to be updated during move, i.e.OrderableField.needsMove(java.util.Collection, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
returned true, and the remote user (the one performing the move) has the permission to actually update this field.- Specified by:
populateForMove
in interfaceOrderableField<Object>
- Parameters:
fieldValuesHolder
- Map of field Values.originalIssue
- orignal IssuetargetIssue
- target Issue
-
removeValueFromIssueObject
Description copied from interface:OrderableField
Removes the field value from the given MutableIssue object.Note that this operation does not actually persist the change, it just clears the value from the given Issue object. The caller will still need to call #updateValue() in order to persist the change.
Some Fields may choose to quietly ignore this request. eg The SecurityLevel Field will not remove Security Level from subtasks because the subtask must always take the Security Level of its parent issue.
- Specified by:
removeValueFromIssueObject
in interfaceOrderableField<Object>
- Parameters:
issue
- The issue object to be effected.- See Also:
-
canRemoveValueFromIssueObject
Description copied from interface:OrderableField
Returnstrue
if a call toOrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue)
will actually remove the value.There a few different reasons why this method may return false:
- The OrderableField can sometimes remove the value, but it decides that it is not relevant for this Issue. eg: Security Level will ignore remove requests on a subtask, as the subtask Security is not set explicitly (it is always inherited from its parent issue).
- It may possible to remove this value, but the OrderableField does not actually do the job, it is done through some special mechanism. eg Attachments.
- This field is some special system field which it is invalid to remove. eg Project. In these cases calling removeValueFromIssueObject() would normally raise an UnsupportedOperationException.
- Specified by:
canRemoveValueFromIssueObject
in interfaceOrderableField<Object>
- Parameters:
issue
- The Issue object.- Returns:
true
if a call toOrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue)
will actually remove the value.- See Also:
-
hasValue
Description copied from interface:OrderableField
Determines if the field has a value for the given issue.- Specified by:
hasValue
in interfaceOrderableField<Object>
- Parameters:
issue
- the Issue.- Returns:
- true if the given Issue has a value for this field.
-
getId
Description copied from interface:Field
The unique id of the field- Specified by:
getId
in interfaceField
- Specified by:
getId
in interfaceRenderableField
- Returns:
- the identifier for this RenderableField.
-
getValueFromIssue
Description copied from interface:RenderableField
Gets the value stored for this field on the provided issue.- Specified by:
getValueFromIssue
in interfaceRenderableField
- 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.
-
getIdAsLong
Returns ID of this custom field.- Specified by:
getIdAsLong
in interfaceCustomField
- Returns:
- ID of this custom field
-
getLastValueUpdate
Description copied from interface:CustomField
Returns the latest date of either: - creation date of an issue with a non default value of the custom field - issue update date when value of the custom field has been changed- Specified by:
getLastValueUpdate
in interfaceCustomField
- Returns:
- last update of the custom field
-
getIssuesWithValue
Description copied from interface:CustomField
Returns number of issues containing at least one non empty value for the custom field.- Specified by:
getIssuesWithValue
in interfaceCustomField
- Returns:
- number of issues with the non empty custom field
-
getConfigurationSchemes
Returns a list of configuration schemes.- Specified by:
getConfigurationSchemes
in interfaceCustomField
- Returns:
- a list of
FieldConfigScheme
objects
-
getNameKey
Description copied from interface:Field
The i18n key that is used to lookup the field's name when it is displayed- Specified by:
getNameKey
in interfaceField
-
getAssociatedProjectObjects
Description copied from interface:CustomField
Returns a list ofProject
s directly associated with thisCustomField
.This method can return an empty result when the
CustomField
is associated with allProject
s. Please useCustomField.isAllProjects()
prior to this method to detect this."- Specified by:
getAssociatedProjectObjects
in interfaceConfigurableField<Object>
- Specified by:
getAssociatedProjectObjects
in interfaceCustomField
- Returns:
- a list of
Project
s directly associated with thisCustomField
.
-
getAssociatedIssueTypes
Description copied from interface:CustomField
Returns a list ofIssueType
s directly associated with thisCustomField
.In case when this
CustomField
CustomField.isAllIssueTypes()
it will be associated with allIssueType
s but this method can still return empty result.- Specified by:
getAssociatedIssueTypes
in interfaceCustomField
- Returns:
- a list of
IssueType
s directly associated with thisCustomField
.
-
getAssociatedIssueTypeObjects
- Specified by:
getAssociatedIssueTypeObjects
in interfaceCustomField
- See Also:
-
isGlobal
public boolean isGlobal()Returns true if this custom field applies for all projects and all issue types.- Specified by:
isGlobal
in interfaceCustomField
- Returns:
- true if it is in all projects and all issue types, false otherwise.
-
isAllProjects
public boolean isAllProjects()Checks whether this custom field applies for all projects. It returns true if it applies for all projects for any field configuration scheme, false otherwise.- Specified by:
isAllProjects
in interfaceCustomField
- Returns:
- true if it applies for all projects for any field configuration scheme, false otherwise.
-
isAllIssueTypes
public boolean isAllIssueTypes()Returns true if it applies for all issue types, false otherwise. The actual check test if the list returned bygetAssociatedIssueTypes()
contains null - all issue types.- Specified by:
isAllIssueTypes
in interfaceCustomField
- Returns:
- true if it applies for all issue types, false otherwise.
-
isEnabled
public boolean isEnabled()Returns true if any configuration scheme returned bygetConfigurationSchemes()
is enabled.- Specified by:
isEnabled
in interfaceCustomField
- Returns:
- true if any configuration scheme is enabled, false otherwise
-
availableForBulkEdit
Checks if custom field is available for bulk edit operation, whether 'shown' and if user has bulk update permission. Also checks that all selected issues have the same field config for this custom field. All field configs must be the same or all null.- Specified by:
availableForBulkEdit
in interfaceOrderableField<Object>
- Parameters:
bulkEditBean
- bulk edit bean- Returns:
- null if available for bulk edit or an appropriate 'unavailable' string
-
areDifferent
Compare two objects - return false if both are null or equal. Return true otherwise.- Parameters:
obj1
- the first object to compareobj2
- the second object to compare- Returns:
- false if both are null or equal. Return true otherwise.
-
hasBulkUpdatePermission
Checks whether the user has the permission to execute the bulk operation for the provided issue. In case of Bulk Workflow Transition checks for nothing. In case of all others (e.g. Bulk Edit) checks for Edit permission.- Parameters:
bulkEditBean
- bulk edit beanissue
- issue to check permission on- Returns:
- true if has permission, false otherwise
-
getName
Returns the name of this custom field. -
getUntranslatedName
Returns the name of this custom field by readingCustomField.ENTITY_NAME
of the underlying generic value.- Specified by:
getUntranslatedName
in interfaceCustomField
- Returns:
- the name of this custom field
-
getFieldName
Description copied from interface:CustomField
Returns the title of this custom field.- Specified by:
getFieldName
in interfaceCustomField
- Returns:
- the title of this custom field
-
getDescription
Returns the i18n'ed description of this custom field.- Specified by:
getDescription
in interfaceCustomField
- Returns:
- the description of this custom field
-
getUntranslatedDescription
Returns the description of this custom field by readingCustomField.ENTITY_DESCRIPTION
of the underlying generic value.- Specified by:
getUntranslatedDescription
in interfaceCustomField
- Returns:
- the description of this custom field
-
getDescriptionProperty
Returns aRenderableProperty
for rendering this custom field's description.- Specified by:
getDescriptionProperty
in interfaceCustomField
- Returns:
- a read-only RenderableProperty
- Since:
- v5.0.7
-
getUntranslatedDescriptionProperty
Returns aRenderableProperty
for rendering this custom field's description.- Specified by:
getUntranslatedDescriptionProperty
in interfaceCustomField
- Returns:
- a read-only RenderableProperty
- Since:
- v5.0.7
-
getCustomFieldSearcher
Retrieves theCustomFieldSearcher
for this custom field looking it up in the customFieldManager by the searcher key retrieved fromCustomField.ENTITY_CUSTOM_FIELD_SEARCHER
underlying generic value attribute. The seracher, if found is initialized with this custom field before it is returned.Before v7.3.6 this would execute once and then return the value forever.
After v7.3.6 this will execute each time until a value is returned, and if the module can not be found, it is treated as returning null from this call, but re-attempt to find a value the next time it is called.
- Specified by:
getCustomFieldSearcher
in interfaceCustomField
- Returns:
- found custom field searcher or null, if none found
-
getCustomFieldType
Looks up theCustomFieldType
in thecustomFieldTypeModuleDescriptors
by the key retrieved from theCustomField.ENTITY_CF_TYPE_KEY
attribute of the underlying generic value. This only happens iftypeRef
is null, then the custom field type is set and returned each time. It can return null if the custom field type cannot be found by that key.Before v7.3.6 this would execute once and then return the value forever.
After v7.3.6 this will execute each time until a value is returned, and if the module can not be found, it is treated as returning null from this call, but re-attempt to find a value the next time it is called.
- Specified by:
getCustomFieldType
in interfaceCustomField
- Returns:
- custom field type
-
getColumnHeadingKey
- Specified by:
getColumnHeadingKey
in interfaceNavigableField
-
getColumnCssClass
- Specified by:
getColumnCssClass
in interfaceNavigableField
-
getDefaultSortOrder
ReturnsNavigableField.ORDER_ASCENDING
.- Specified by:
getDefaultSortOrder
in interfaceNavigableField
- Returns:
- ascending order as
NavigableField.ORDER_ASCENDING
value
-
compare
This method compares the values of this custom field in two given issues. Returns a negative integer, zero, or a positive integer as the value of first issue is less than, equal to, or greater than the value of the second issue. This method returns 0 if this custom field is not sortable, or its customFieldType is not an instance ofSortableCustomField
If either of given issues is null a IllegalArgumentException is thrown.- Specified by:
compare
in interfaceCustomField
- Parameters:
issue1
- issue to compareissue2
- issue to compare- Returns:
- a negative integer, zero, or a positive integer as the value of first issue is less than, equal to, or greater than the value of the second issue
- Throws:
IllegalArgumentException
- if any of given issues is null
-
getSorter
If this field has a searcher, and this searcher implementsSortableCustomFieldSearcher
then returnSortableCustomFieldSearcher.getSorter(CustomField)
. Else return null.- Specified by:
getSorter
in interfaceNavigableField
- Returns:
- A sorter that can be used to sort this field, or null depending on the value of
NavigableField.getSortComparatorSource()
- See Also:
-
getSortComparatorSource
public org.apache.lucene.search.FieldComparatorSource getSortComparatorSource()Return a SortComparatorSource that uses either a custom field searcher that implementsSortableCustomFieldSearcher
or a custom field that implementsSortableCustomField
. If neither are found, this method returns null.- Specified by:
getSortComparatorSource
in interfaceNavigableField
- Returns:
- A SortComparatorSource that can be used to sort, or null if this field does not use custom sorting
-
getSortFields
Description copied from interface:NavigableField
Return a list of Lucene SortFields to be used for sorting search results.Using this method allows the field to specify the most performant way to perform a search. If a field can be sorted directly using the term in the index then this should just return a singleton list with the sort field.
return Collections.singletonList(new SortField(fieldName, sortOrder));
The default implementation builds this using the FieldComparatorSource returned by
NavigableField.getSortComparatorSource()
If you implement this method there is no need to implement
NavigableField.getSortComparatorSource()
.- Specified by:
getSortFields
in interfaceNavigableField
- Returns:
- The name of the indexed term to be used for native Lucene sorting.
-
equals
-
hashCode
public int hashCode() -
getGenericValue
public org.ofbiz.core.entity.GenericValue getGenericValue()Returns a generic value that represents this custom field. (only for internal use, it is deprecated on interface)- Specified by:
getGenericValue
in interfaceCustomField
- Returns:
- generic value of this custom field
-
compareTo
- Specified by:
compareTo
in interfaceComparable
-
getFieldTypeInfo
Description copied from interface:RestAwareField
Returns lower level Information about the field. This information contains allowed values and/or the autocomplete url- Specified by:
getFieldTypeInfo
in interfaceRestAwareField
- Parameters:
fieldTypeInfoContext
- theFieldTypeInfoContext
contains context information that is relevant to generate theFieldTypeInfo
-
getJsonSchema
Description copied from interface:RestAwareField
Return a description of the shape of this field when represented as JSON.- Specified by:
getJsonSchema
in interfaceRestAwareField
-
getJsonFromIssue
public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem) Description copied from interface:RestAwareField
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.- Specified by:
getJsonFromIssue
in interfaceRestAwareField
- Parameters:
issue
- to get field data fromrenderedVersionRequested
- whether the use requested the return of rendered/pretty data as well as raw datafieldLayoutItem
- 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.
-
getRestFieldOperation
- Specified by:
getRestFieldOperation
in interfaceRestFieldOperations
- Returns:
- the RestFieldOperationsHandler for this field.
-
getJsonDefaultValue
Description copied from interface:RestFieldOperations
Return The default data for this system field. May be null if there is no default.- Specified by:
getJsonDefaultValue
in interfaceRestFieldOperations
- Parameters:
issueCtx
- Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.
-
getDefaultValueOperations
- Specified by:
getDefaultValueOperations
in interfaceDefaultValueField<Object>
-
getEventPublisher
protected com.atlassian.event.api.EventPublisher getEventPublisher()Overridable location to retrieve anEventPublisher
to publish events through. It's not injected via the constructor because it has too many adverse impacts on APIs and existing usages.- Returns:
- an
EventPublisher
.
-
getPropertySet
public com.opensymphony.module.propertyset.PropertySet getPropertySet()- Specified by:
getPropertySet
in interfaceCustomField
-