com.atlassian.jira.issue.fields
Class MockCustomField

java.lang.Object
  extended by com.atlassian.jira.issue.fields.MockCustomField
All Implemented Interfaces:
ConfigurableField, CustomField, Field, HideableField, NavigableField, OrderableField, RenderableField, RequirableField, RestAwareField, RestFieldOperations, SearchableField, Comparable

public class MockCustomField
extends Object
implements CustomField

Simple implementation of CustomField for.

Since:
v4.1

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_ISSUETYPE, 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
 
Constructor Summary
MockCustomField()
           
MockCustomField(String id, String name, CustomFieldType customFieldType)
           
 
Method Summary
 String availableForBulkEdit(BulkEditBean bulkEditBean)
          Determines whether the field is available for bulk editing given the BulkEditBean.
 boolean canRemoveValueFromIssueObject(Issue issue)
          Returns true if a call to OrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue) will actually remove the value.
 int compare(Issue issue1, Issue issue2)
          This method compares the values of this custom field in two given issues.
 int compareTo(Object o)
           
 SearchHandler createAssociatedSearchHandler()
          Return SearchHandler for the field.
 MockCustomFieldType createCustomFieldType()
           
 void createValue(Issue issue, Object value)
          Create the value of the issue in the data store.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedIssueTypes()
          Returns a list of issue types associated with this custom field.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedProjectCategories()
          Returns a list of associated project categories for this custom field.
 List<ProjectCategory> getAssociatedProjectCategoryObjects()
          Returns a list of associated project categories for this custom field.
 List<Project> getAssociatedProjectObjects()
          Returns a list of projects associated with this custom field.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedProjects()
          Returns a list of projects associated with this custom field.
 String getBulkEditHtml(OperationContext operationContext, webwork.action.Action action, BulkEditBean bulkEditBean, Map displayParameters)
          Returns HTML that should be shown when the issue is being bulk edited.
 ClauseNames getClauseNames()
          Return the JQL clause names that this custom field should be recognized by.
 String getColumnCssClass()
           
 String getColumnHeadingKey()
           
 String getColumnViewHtml(FieldLayoutItem fieldLayoutItem, Map displayParams, Issue issue)
           
 List<FieldConfigItemType> getConfigurationItemTypes()
          Returns a List of FieldConfigItemType objects.
 List<FieldConfigScheme> getConfigurationSchemes()
          Returns a list of configuration schemes.
 String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue)
          Returns the HTML that should be shown when the issue is being created.
 String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map displayParameters)
          Returns the HTML that should be shown when the issue is being created.
 CustomFieldSearcher getCustomFieldSearcher()
          Retrieves the CustomFieldSearcher for this custom field.
 CustomFieldType getCustomFieldType()
          Looks up the CustomFieldType.
 CustomFieldParams getCustomFieldValues(Map customFieldValuesHolder)
          Get the custom field string values that are relevant to this particular custom field
 String getDefaultSortOrder()
          The order in which to sort the field when it is sorted for the first time.
 Object getDefaultValue(Issue issue)
          The value that should be set on the issue if the field is not shown for some reason.
 String getDescription()
          Returns the 1i8n'ed description of this custom field.
 RenderableProperty getDescriptionProperty()
          Returns a RenderableProperty for rendering this custom field's description.
 String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue)
          Returns HTML that should be shown when the issue is being edited.
 String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, webwork.action.Action action, Issue issue, Map displayParameters)
          Returns HTML that should be shown when the issue is being edited.
 String getFieldName()
          Returns the title of this custom field.
 FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
          Returns lower level Information about the field.
 org.ofbiz.core.entity.GenericValue getGenericValue()
          Returns a generic value that represents this custom field
 String getHiddenFieldId()
          Returns the id of the field to check for visibility.
 String getId()
          The unique id of the field
 Long getIdAsLong()
          Returns ID of this custom field.
 JsonData getJsonDefaultValue(IssueContext issueCtx)
          Return The default data for this system field.
 FieldJsonRepresentation 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.
 JsonType getJsonSchema()
          Return a description of the shape of this field when represented as JSON.
 String getName()
          Returns i18n'ed name of the field.
 String getNameKey()
          The i18n key that is used to lookup the field's name when it is displayed
 Options getOptions(String key, FieldConfig config, JiraContextNode contextNode)
          Returns options for this custom field if it is of MultipleCustomFieldType type.
 Options getOptions(String key, JiraContextNode jiraContextNode)
          Returns options for this custom field if it is of MultipleCustomFieldType type.
 com.opensymphony.module.propertyset.PropertySet getPropertySet()
           
 FieldConfig getRelevantConfig(Issue issue)
          Returns a relevant FieldConfig for the given issue.
 FieldConfig getRelevantConfig(IssueContext issueContext)
          Returns the relevant field config of this custom field for the give issue context
 FieldConfig getReleventConfig(SearchContext searchContext)
          The FieldConfig that is relevent to all issue contexts in the search context Checks that all configs within search context are the same - i.e.
 RestFieldOperationsHandler getRestFieldOperation()
           
 org.apache.lucene.search.FieldComparatorSource getSortComparatorSource()
          A sortComparatorSource object to be used for sorting columns in a table.
 LuceneFieldSorter getSorter()
          A sorter to be used when sorting columns in a table.
 List<org.apache.lucene.search.SortField> getSortFields(boolean sortOrder)
          Return a list of Lucene SortFields to be used for sorting search results.
 String getUntranslatedDescription()
          Returns the description of this custom field by reading CustomField.ENTITY_DESCRIPTION of the underlying generic value.
 RenderableProperty getUntranslatedDescriptionProperty()
          Returns a RenderableProperty for rendering this custom field's untranslated description, for admin.
 String getUntranslatedName()
          Returns the name of this custom field by reading CustomField.ENTITY_NAME of the underlying generic value.
 Object getValue(Issue issue)
          Retrieves and returns the Object representing the this CustomField value for the given issue.
 String getValueFromIssue(Issue issue)
          Gets the value stored for this field on the provided issue.
 Object getValueFromParams(Map params)
          Get a field value from the map of parameters passed.
 String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue)
           
 String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Map displayParameters)
           
 String getViewHtml(FieldLayoutItem fieldLayoutItem, webwork.action.Action action, Issue issue, Object value, Map displayParameters)
           
 boolean hasParam(Map parameters)
          Checks to see if the (web) parameters contains a relevant value with which to populate the issue
 boolean hasValue(Issue issue)
          Determines if the field has a value for the given issue.
 boolean isAllIssueTypes()
          Returns true if it applies for all issue types, false otherwise.
 boolean isAllProjects()
          Checks whether this custom field applies for all projects.
 boolean isEditable()
          Returns true if this custom field can be edited, false otherwise.
 boolean isEnabled()
          Returns true if all configuration schemes returned by CustomField.getConfigurationSchemes() are enabled.
 boolean isGlobal()
          Returns true if this custom field applies for all projects and all issue types.
 boolean isInScope(org.ofbiz.core.entity.GenericValue project, List<String> issueTypeIds)
          This is used for determining whether we can view a custom field in view issue.
 boolean isInScope(Project project, List<String> issueTypeIds)
          Determines if this custom field is within the scope of the given project, and list of Issue Types.
 boolean isInScope(SearchContext searchContext)
          Determines whether this custom field is in scope.
 boolean isInScope(com.atlassian.crowd.embedded.api.User user, SearchContext searchContext)
          Determines whether this custom field is in scope.
 boolean isRenderable()
          Defines if a field determines itself as renderable.
 boolean isShown(Issue issue)
          Tests field specific way to determine if it should be shown or not.
 MessagedResult 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 fieldValuesHolder, Issue issue)
          Populate the fieldValueHolder with a value that should be shown by default when the issue has not been created yet.
 void populateForMove(Map<String,Object> fieldValuesHolder, Issue originalIssue, Issue targetIssue)
          Used to populate the fieldValueHolder with parameters for move issue screen.
 void populateFromIssue(Map fieldValuesHolder, Issue issue)
          Used to initialise the fieldValuesHolder from the current value of teh issue.
 void populateFromParams(Map fieldValuesHolder, Map parameters)
          Populate the fieldValuesHolder with a value from (web) parameters.
 void populateParamsFromString(Map fieldValuesHolder, String stringValue, Issue issue)
          Used to convert from a user friendly string value and put the result into the fieldValuesHolder.
 String prettyPrintChangeHistory(String changeHistory)
           
 String prettyPrintChangeHistory(String changeHistory, I18nHelper i18nHelper)
          Used for email notification templates - allows changelog to be displayed in language of the recipient.
 Set<Long> 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 removeValueFromIssueObject(MutableIssue issue)
          Removes the field value from the given MutableIssue object.
 void setCustomFieldSearcher(CustomFieldSearcher searcher)
          Sets the CustomFieldSearcher for this custom field.
 MockCustomField setCustomFieldType(CustomFieldType type)
           
 void setDescription(String description)
          Sets the description of this custom field.
 MockCustomField setId(String id)
           
 void setName(String name)
          Sets the name of this custom field.
 void store()
          Stores the generic value of this custom field
 String 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 valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockCustomField

public MockCustomField()

MockCustomField

public MockCustomField(String id,
                       String name,
                       CustomFieldType customFieldType)
Method Detail

isInScope

public boolean isInScope(Project project,
                         List<String> issueTypeIds)
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 issueTypeIds list is null or an empty list, then it is treated as a wildcard.

Specified by:
isInScope in interface CustomField
Parameters:
project - The project.
issueTypeIds - List of IssueType ID's.
Returns:
true if this custom field is within the given scope.

isInScope

public boolean isInScope(org.ofbiz.core.entity.GenericValue project,
                         List<String> issueTypeIds)
Description copied from interface: CustomField
This is used for determining whether we can view a custom field in view issue.

Specified by:
isInScope in interface CustomField
Parameters:
project - project generic value
issueTypeIds - issue type IDs, e.g. ["1", "2"] for Bugs and New Features
Returns:
true if the field is to be shown, false if hidden

isInScope

public boolean isInScope(SearchContext searchContext)
Description copied from interface: CustomField
Determines whether this custom field is in scope.

Specified by:
isInScope in interface CustomField
Parameters:
searchContext - search context
Returns:
true if this field is in scope

isInScope

public boolean isInScope(com.atlassian.crowd.embedded.api.User user,
                         SearchContext searchContext)
Description copied from interface: CustomField
Determines whether this custom field is in scope.

Specified by:
isInScope in interface CustomField
Parameters:
user - current user
searchContext - search context
Returns:
true if this field is in scope

getGenericValue

public org.ofbiz.core.entity.GenericValue getGenericValue()
Description copied from interface: CustomField
Returns a generic value that represents this custom field

Specified by:
getGenericValue in interface CustomField
Returns:
generic value of this custom field

compare

public int compare(Issue issue1,
                   Issue issue2)
            throws IllegalArgumentException
Description copied from interface: CustomField
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.

If either of given issues is null a IllegalArgumentException is thrown.

Specified by:
compare in interface CustomField
Parameters:
issue1 - issue to compare
issue2 - 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

getCustomFieldValues

public CustomFieldParams getCustomFieldValues(Map customFieldValuesHolder)
Description copied from interface: CustomField
Get the custom field string values that are relevant to this particular custom field

Specified by:
getCustomFieldValues in interface CustomField
Parameters:
customFieldValuesHolder - containing all params
Returns:
a CustomFieldParams of String objects

getValue

public Object getValue(Issue issue)
Description copied from interface: CustomField
Retrieves and returns the Object representing the this CustomField value for the given issue. See CustomFieldType.getValueFromIssue(CustomField,Issue). This is only used to communicate with the 'view' JSP. Multiselects will return a list, dates a date, etc.

Specified by:
getValue in interface CustomField
Parameters:
issue - issue to retrieve the value from
Returns:
Object representing the this CustomField value for the given issue
See Also:
OrderableField.getValueFromParams(java.util.Map)

remove

public Set<Long> 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 interface CustomField
Returns:
a set of issue IDs of affected issues

getOptions

public Options getOptions(String key,
                          JiraContextNode jiraContextNode)
Description copied from interface: CustomField
Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

As this is just used by the view layer, it can be a list of objects

Specified by:
getOptions in interface CustomField
Parameters:
key - not used
jiraContextNode - JIRA context node
Returns:
options for this custom field if it is of MultipleCustomFieldType type, null otherwise

setName

public void setName(String name)
Description copied from interface: CustomField
Sets the name of this custom field.

Specified by:
setName in interface CustomField
Parameters:
name - name to set

getDescription

public String getDescription()
Description copied from interface: CustomField
Returns the 1i8n'ed description of this custom field. To render views for the custom field description, prefer CustomField.getDescriptionProperty().

Specified by:
getDescription in interface CustomField
Returns:
the description of this custom field

getDescriptionProperty

@Nonnull
public RenderableProperty getDescriptionProperty()
Description copied from interface: CustomField
Returns a RenderableProperty for rendering this custom field's description.

Specified by:
getDescriptionProperty in interface CustomField
Returns:
a read-only RenderableProperty

setDescription

public void setDescription(String description)
Description copied from interface: CustomField
Sets the description of this custom field.

Specified by:
setDescription in interface CustomField
Parameters:
description - description to set

getCustomFieldSearcher

public CustomFieldSearcher getCustomFieldSearcher()
Description copied from interface: CustomField
Retrieves the CustomFieldSearcher for this custom field. The searcher, if found is initialized with this custom field before it is returned.

Specified by:
getCustomFieldSearcher in interface CustomField
Returns:
found custom field searcher or null, if none found

setCustomFieldSearcher

public void setCustomFieldSearcher(CustomFieldSearcher searcher)
Description copied from interface: CustomField
Sets the CustomFieldSearcher for this custom field.

Specified by:
setCustomFieldSearcher in interface CustomField
Parameters:
searcher - custom field searcher to associate with this custom field

store

public void store()
Description copied from interface: CustomField
Stores the generic value of this custom field

Specified by:
store in interface CustomField

isEditable

public boolean isEditable()
Description copied from interface: CustomField
Returns true if this custom field can be edited, false otherwise.

Specified by:
isEditable in interface CustomField
Returns:
true if this custom field can be edited, false otherwise

getIdAsLong

public Long getIdAsLong()
Description copied from interface: CustomField
Returns ID of this custom field.

Specified by:
getIdAsLong in interface CustomField
Returns:
ID of this custom field

getConfigurationSchemes

public List<FieldConfigScheme> getConfigurationSchemes()
Description copied from interface: CustomField
Returns a list of configuration schemes.

Specified by:
getConfigurationSchemes in interface CustomField
Returns:
a list of FieldConfigScheme objects.

getOptions

public Options getOptions(String key,
                          FieldConfig config,
                          JiraContextNode contextNode)
Description copied from interface: CustomField
Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

As this is just used by the view layer, it can be a list of objects

Specified by:
getOptions in interface CustomField
Parameters:
key - not used
config - relevant field config
contextNode - JIRA context node
Returns:
options for this custom field if it is of MultipleCustomFieldType type, null otherwise

getRelevantConfig

public FieldConfig getRelevantConfig(Issue issue)
Description copied from interface: CustomField
Returns a relevant FieldConfig 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 rerurn null.

Specified by:
getRelevantConfig in interface CustomField
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.

validateFromActionParams

public void validateFromActionParams(Map actionParameters,
                                     ErrorCollection errorCollection,
                                     FieldConfig config)
Description copied from interface: CustomField
Validates relevant parameters on custom field type of this custom field. Any errors found are added to the given errorCollection. See CustomFieldType.validateFromParams(CustomFieldParams,ErrorCollection,FieldConfig)

Specified by:
validateFromActionParams in interface CustomField
Parameters:
actionParameters - action parameters
errorCollection - error collection to add errors to
config - field config

getAssociatedProjectCategories

public List<org.ofbiz.core.entity.GenericValue> getAssociatedProjectCategories()
Description copied from interface: CustomField
Returns a list of associated project categories for this custom field. It returns null if CustomField.getConfigurationSchemes() returns null. It returns an empty list if the CustomField.getConfigurationSchemes() returns an empty list. The returned list should be sorted by project category name.

Specified by:
getAssociatedProjectCategories in interface CustomField
Returns:
a list of GenericValue objects that represent associated project categories as ProjectCategoryContext objects

getAssociatedProjectCategoryObjects

public List<ProjectCategory> getAssociatedProjectCategoryObjects()
Description copied from interface: CustomField
Returns a list of associated project categories for this custom field. It returns null if CustomField.getConfigurationSchemes() returns null. It returns an empty list if the CustomField.getConfigurationSchemes() returns an empty list. The returned list should be sorted by project category name.

Specified by:
getAssociatedProjectCategoryObjects in interface CustomField
Returns:
a list of ProjectCategory objects that represent associated project categories as ProjectCategoryContext objects

getConfigurationItemTypes

public List<FieldConfigItemType> getConfigurationItemTypes()
Description copied from interface: ConfigurableField
Returns a List of FieldConfigItemType objects. This opens up possibilties for configurable custom fields

Specified by:
getConfigurationItemTypes in interface ConfigurableField
Returns:
List of FieldConfigItemType @Nonnull

getAssociatedProjects

public List<org.ofbiz.core.entity.GenericValue> getAssociatedProjects()
Description copied from interface: CustomField
Returns a list of projects associated with this custom field. Will be null if the field is global

Specified by:
getAssociatedProjects in interface ConfigurableField
Specified by:
getAssociatedProjects in interface CustomField
Returns:
List of project generic values

getAssociatedProjectObjects

public List<Project> getAssociatedProjectObjects()
Description copied from interface: CustomField
Returns a list of projects associated with this custom field. Will be null if the field is global

Specified by:
getAssociatedProjectObjects in interface ConfigurableField
Specified by:
getAssociatedProjectObjects in interface CustomField
Returns:
a list of projects associated with this custom field.

getAssociatedIssueTypes

public List<org.ofbiz.core.entity.GenericValue> getAssociatedIssueTypes()
Description copied from interface: CustomField
Returns a list of issue types associated with this custom field. Will be null if the field is global

Specified by:
getAssociatedIssueTypes in interface CustomField
Returns:
List of issue type generic values

isGlobal

public boolean isGlobal()
Description copied from interface: CustomField
Returns true if this custom field applies for all projects and all issue types.

Specified by:
isGlobal in interface CustomField
Returns:
true if it is in all projects and all issue types, false otherwise.

isAllProjects

public boolean isAllProjects()
Description copied from interface: CustomField
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 interface CustomField
Returns:
true if it applies for all projects for any field configuration scheme, false otherwise.

isAllIssueTypes

public boolean isAllIssueTypes()
Description copied from interface: CustomField
Returns true if it applies for all issue types, false otherwise.

Specified by:
isAllIssueTypes in interface CustomField
Returns:
true if it applies for all issue types, false otherwise.

isEnabled

public boolean isEnabled()
Description copied from interface: CustomField
Returns true if all configuration schemes returned by CustomField.getConfigurationSchemes() are enabled.

Specified by:
isEnabled in interface CustomField
Returns:
true if all configuration schemes are enabled, false otherwise

getCustomFieldType

public CustomFieldType getCustomFieldType()
Description copied from interface: CustomField
Looks up the CustomFieldType. It can return null if the custom field type cannot be found in the CustomFieldManager.

Specified by:
getCustomFieldType in interface CustomField
Returns:
custom field type

setCustomFieldType

public MockCustomField setCustomFieldType(CustomFieldType type)

createCustomFieldType

public MockCustomFieldType createCustomFieldType()

getRelevantConfig

public FieldConfig getRelevantConfig(IssueContext issueContext)
Description copied from interface: CustomField
Returns the relevant field config of this custom field for the give issue context

Specified by:
getRelevantConfig in interface ConfigurableField
Specified by:
getRelevantConfig in interface CustomField
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

getReleventConfig

public FieldConfig getReleventConfig(SearchContext searchContext)
Description copied from interface: CustomField
The FieldConfig that is relevent to all issue contexts in the search context 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 interface CustomField
Parameters:
searchContext - search context
Returns:
null if any two configs are different

getClauseNames

public ClauseNames getClauseNames()
Description copied from interface: CustomField
Return the JQL clause names that this custom field should be recognized by.

Specified by:
getClauseNames in interface CustomField
Returns:
the clause names this custom field should be recognized by.

getColumnHeadingKey

public String getColumnHeadingKey()
Specified by:
getColumnHeadingKey in interface NavigableField

getColumnCssClass

public String getColumnCssClass()
Specified by:
getColumnCssClass in interface NavigableField

getDefaultSortOrder

public String getDefaultSortOrder()
Description copied from interface: NavigableField
The order in which to sort the field when it is sorted for the first time.

Specified by:
getDefaultSortOrder in interface NavigableField
Returns:
Either NavigableField.ORDER_ASCENDING or NavigableField.ORDER_DESCENDING

getSortComparatorSource

public org.apache.lucene.search.FieldComparatorSource getSortComparatorSource()
Description copied from interface: NavigableField
A sortComparatorSource object to be used for sorting columns in a table. In most cases this will use a MappedSortComparator using the NavigableField.getSorter() method. However, fields can provide any sorting mechanism that they wish. If a field can be sorted directly using terms in the Lucene index then the field should implement NavigableField.getSortFields(boolean sortOrder) rather than this method. In large installations custom sorting may incur a maor performance penalty.

Specified by:
getSortComparatorSource in interface NavigableField
Returns:
A SortComparatorSource that can be used to sort, or null if this field does not use custom sorting

getSorter

public LuceneFieldSorter getSorter()
Description copied from interface: NavigableField
A sorter to be used when sorting columns in a table. This sort uses the Lucene Document Collection and is therefore a lot faster than sorting the issues in memory.

Specified by:
getSorter in interface NavigableField
Returns:
A sorter that can be used to sort this field, or null depending on the value of NavigableField.getSortComparatorSource()
See Also:
DocumentIssueImpl, MappedSortComparator

getSortFields

public List<org.apache.lucene.search.SortField> getSortFields(boolean sortOrder)
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 interface NavigableField
Returns:
The name of the indexed term to be used for native Lucene sorting.

getColumnViewHtml

public String getColumnViewHtml(FieldLayoutItem fieldLayoutItem,
                                Map displayParams,
                                Issue issue)
Specified by:
getColumnViewHtml in interface NavigableField

getHiddenFieldId

public String 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 interface NavigableField

prettyPrintChangeHistory

public String prettyPrintChangeHistory(String changeHistory)
Specified by:
prettyPrintChangeHistory in interface NavigableField

prettyPrintChangeHistory

public String prettyPrintChangeHistory(String changeHistory,
                                       I18nHelper i18nHelper)
Description copied from interface: NavigableField
Used for email notification templates - allows changelog to be displayed in language of the recipient.

Specified by:
prettyPrintChangeHistory in interface NavigableField
Returns:
String change history formatted according to locale in i18nHelper

getValueFromIssue

public String getValueFromIssue(Issue issue)
Description copied from interface: RenderableField
Gets the value stored for this field on the provided issue.

Specified by:
getValueFromIssue in interface RenderableField
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.

isRenderable

public boolean isRenderable()
Description copied from interface: RenderableField
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.

Specified by:
isRenderable in interface RenderableField
Returns:
true if the field is renderable, false otherwise.

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 interface OrderableField
Parameters:
fieldLayoutItem - FieldLayoutItem
operationContext - OperationContext
action - Action
issue - 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 displayParameters)
Description copied from interface: OrderableField
Returns the HTML that should be shown when the issue is being created.

Specified by:
getCreateHtml in interface OrderableField
Parameters:
fieldLayoutItem - FieldLayoutItem
operationContext - OperationContext
action - Action
issue - Issue
displayParameters - 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 interface OrderableField
Parameters:
fieldLayoutItem - FieldLayoutItem
operationContext - OperationContext
action - Action
issue - 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 displayParameters)
Description copied from interface: OrderableField
Returns HTML that should be shown when the issue is being edited.

Specified by:
getEditHtml in interface OrderableField
Parameters:
fieldLayoutItem - FieldLayoutItem
operationContext - OperationContext
action - Action
issue - Issue
displayParameters - 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 interface OrderableField
Parameters:
operationContext - OperationContext
action - Action
bulkEditBean - BulkEditBean
displayParameters - 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 interface OrderableField

getViewHtml

public String getViewHtml(FieldLayoutItem fieldLayoutItem,
                          webwork.action.Action action,
                          Issue issue,
                          Map displayParameters)
Specified by:
getViewHtml in interface OrderableField

getViewHtml

public String getViewHtml(FieldLayoutItem fieldLayoutItem,
                          webwork.action.Action action,
                          Issue issue,
                          Object value,
                          Map displayParameters)
Specified by:
getViewHtml in interface OrderableField

isShown

public boolean isShown(Issue issue)
Description copied from interface: OrderableField
Tests field specific way to determine if it should be shown or not.

Specified by:
isShown in interface OrderableField
Parameters:
issue - The Issue.
Returns:
true if it should be shown.

populateDefaults

public void populateDefaults(Map fieldValuesHolder,
                             Issue issue)
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 interface OrderableField
Parameters:
fieldValuesHolder - The fieldValuesHolder Map to be populated.
issue - The Issue.

hasParam

public boolean hasParam(Map parameters)
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 interface OrderableField
Parameters:
parameters - Map of HTTP request parameters ("Action parameters").

populateFromParams

public void populateFromParams(Map fieldValuesHolder,
                               Map parameters)
Description copied from interface: OrderableField
Populate the fieldValuesHolder with a value from (web) parameters.

Specified by:
populateFromParams in interface OrderableField
Parameters:
fieldValuesHolder - The fieldValuesHolder Map to be populated.
parameters - Map of HTTP parameters.

populateFromIssue

public void populateFromIssue(Map fieldValuesHolder,
                              Issue issue)
Description copied from interface: OrderableField
Used to initialise the fieldValuesHolder from the current value of teh issue. Used, for example, when showing the Edit Issue screen to show the issue's current values.

Specified by:
populateFromIssue in interface OrderableField
Parameters:
fieldValuesHolder - The fieldValuesHolder Map to be populated.
issue - The Issue.

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 interface OrderableField
Parameters:
operationContext - OperationContext
errorCollectionToAddTo - ErrorCollection to add to.
i18n - I18nHelper
issue - This is passed to get the value of other fields that may or may not have been modified.
fieldScreenRenderLayoutItem - FieldScreenRenderLayoutItem

getDefaultValue

public Object getDefaultValue(Issue issue)
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 interface OrderableField
Parameters:
issue - the Issue.
Returns:
The default Value.

createValue

public void createValue(Issue issue,
                        Object value)
Description copied from interface: OrderableField
Create the value of the issue in the data store.

Specified by:
createValue in interface OrderableField
Parameters:
issue - Issue this field is part of
value - Value to store in this field (eg. Collection for Version fields). Cannot be null.

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 interface OrderableField
Parameters:
fieldLayoutItem - for this field within this context
issue - Issue this field is part of
modifiedValue - new value to set field to. Cannot be null.
issueChangeHolder - an object to record any changes made to the issue by this method.

updateIssue

public void updateIssue(FieldLayoutItem fieldLayoutItem,
                        MutableIssue issue,
                        Map fieldValueHolder)
Description copied from interface: OrderableField
Record the value on the issue (not saving it to the database, see updateValue).

Specified by:
updateIssue in interface OrderableField
Parameters:
fieldLayoutItem - FieldLayoutItem
issue - MutableIssue
fieldValueHolder - Field Value Holder Map
See Also:
OrderableField.updateValue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.ModifiedValue, com.atlassian.jira.issue.util.IssueChangeHolder)

removeValueFromIssueObject

public void removeValueFromIssueObject(MutableIssue issue)
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 interface OrderableField
Parameters:
issue - The issue object to be effected.
See Also:
OrderableField.canRemoveValueFromIssueObject(com.atlassian.jira.issue.Issue), OrderableField.updateValue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.ModifiedValue, com.atlassian.jira.issue.util.IssueChangeHolder)

canRemoveValueFromIssueObject

public boolean canRemoveValueFromIssueObject(Issue issue)
Description copied from interface: OrderableField
Returns true if a call to OrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue) will actually remove the value.

There a few different reasons why this method may return false:

In general it is safe to call removeValueFromIssueObject() even if this method returns false, as the request will be silently ignored. However there are a couple of special fields where calling removeValueFromIssueObject() will throw an UnsupportedOperationException - eg if you try to remove the Project.

Specified by:
canRemoveValueFromIssueObject in interface OrderableField
Parameters:
issue - The Issue object.
Returns:
true if a call to OrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue) will actually remove the value.
See Also:
OrderableField.removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue)

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 interface OrderableField
Parameters:
originalIssues - Collection of original Issues.
targetIssue - Target Issue.
targetFieldLayoutItem - 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 interface OrderableField
Parameters:
fieldValuesHolder - Map of field Values.
originalIssue - orignal Issue
targetIssue - target Issue

hasValue

public boolean hasValue(Issue issue)
Description copied from interface: OrderableField
Determines if the field has a value for the given issue.

Specified by:
hasValue in interface OrderableField
Parameters:
issue - the Issue.
Returns:
true if the given Issue has a value for this field.

availableForBulkEdit

public String availableForBulkEdit(BulkEditBean bulkEditBean)
Description copied from interface: OrderableField
Determines whether the field is available for bulk editing given the BulkEditBean.

Specified by:
availableForBulkEdit in interface OrderableField
Parameters:
bulkEditBean - holds the state of the bulk-edit wizard (e.g. the selected issues for bulk editing)
Returns:
null if the field is available for bulk-editing or an i18n key of the error message to show as why the field is not available.

getValueFromParams

public Object getValueFromParams(Map params)
                          throws FieldValidationException
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 interface OrderableField
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 fieldValuesHolder,
                                     String stringValue,
                                     Issue issue)
                              throws FieldValidationException
Description copied from interface: OrderableField
Used to convert from a user friendly string value and put the result into the fieldValuesHolder. This method is useful for places like Jelly where the field value can be a name (e.g. issue type name) and not a regular id that is used in the web pages.

Specified by:
populateParamsFromString in interface OrderableField
Parameters:
fieldValuesHolder - Map of field Values.
stringValue - user friendly string value
issue - the Issue
Throws:
FieldValidationException - if cannot convert to a value from the given string

createAssociatedSearchHandler

public SearchHandler createAssociatedSearchHandler()
Description copied from interface: SearchableField
Return SearchHandler for the field. This object tells JIRA how to search for values within the field.

Specified by:
createAssociatedSearchHandler in interface SearchableField
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.

getFieldTypeInfo

public FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
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 interface RestAwareField
Parameters:
fieldTypeInfoContext - the FieldTypeInfoContext contains context information that is relevant to generate the FieldTypeInfo

getJsonSchema

public JsonType getJsonSchema()
Description copied from interface: RestAwareField
Return a description of the shape of this field when represented as JSON.

Specified by:
getJsonSchema in interface RestAwareField

getJsonFromIssue

public FieldJsonRepresentation getJsonFromIssue(Issue issue,
                                                boolean renderedVersionRequested,
                                                @Nullable
                                                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 interface RestAwareField
Parameters:
issue - to get field data from
renderedVersionRequested - 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.

getRestFieldOperation

public RestFieldOperationsHandler getRestFieldOperation()
Specified by:
getRestFieldOperation in interface RestFieldOperations
Returns:
the RestFieldOperationsHandler for this field.

getJsonDefaultValue

public JsonData getJsonDefaultValue(IssueContext issueCtx)
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 interface RestFieldOperations
Parameters:
issueCtx - Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.

getId

public String getId()
Description copied from interface: Field
The unique id of the field

Specified by:
getId in interface Field
Specified by:
getId in interface RenderableField
Returns:
the identifier for this RenderableField.

setId

public MockCustomField setId(String id)

getNameKey

public String 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 interface Field

getName

public String getName()
Description copied from interface: Field
Returns i18n'ed name of the field.

Specified by:
getName in interface Field

getFieldName

public String getFieldName()
Description copied from interface: CustomField
Returns the title of this custom field.

Specified by:
getFieldName in interface CustomField
Returns:
the title of this custom field

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

toString

public String toString()
Overrides:
toString in class Object

getPropertySet

public com.opensymphony.module.propertyset.PropertySet getPropertySet()
Specified by:
getPropertySet in interface CustomField

getUntranslatedDescription

public String getUntranslatedDescription()
Description copied from interface: CustomField
Returns the description of this custom field by reading CustomField.ENTITY_DESCRIPTION of the underlying generic value.

Specified by:
getUntranslatedDescription in interface CustomField
Returns:
the description of this custom field

getUntranslatedName

public String getUntranslatedName()
Description copied from interface: CustomField
Returns the name of this custom field by reading CustomField.ENTITY_NAME of the underlying generic value.

Specified by:
getUntranslatedName in interface CustomField
Returns:
the name of this custom field

getUntranslatedDescriptionProperty

@Nonnull
public RenderableProperty getUntranslatedDescriptionProperty()
Description copied from interface: CustomField
Returns a RenderableProperty for rendering this custom field's untranslated description, for admin.

Specified by:
getUntranslatedDescriptionProperty in interface CustomField
Returns:
a read-only RenderableProperty


Copyright © 2002-2014 Atlassian. All Rights Reserved.