@ExperimentalApi
@PublicApi
public interface DefaultValueOperations<V>
Displaying "default values" is implemented in ConfigureCustomField
in jira core.
This action makes use of ConfigurableField.getConfigurationItemTypes()
to display FieldConfigItemType
for particular field contexts.
This action also renders link for editing default value DefaultValueConfigItem
.
The main class for managing "default values" is EditCustomFieldDefaults
class in jira core.
Basically the workflow is as follows:
- go to edit page from "view field contexts" page.
- populate defaults: populateDefaults(FieldConfig, Map)
- render "edit" page: getEditHtml(com.atlassian.jira.issue.fields.config.FieldConfig, java.util.Map, webwork.action.Action, java.util.Map, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
and
getDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig)
+ using values populated in previous step
- after saving validation is performed: validateFromActionParams(FieldConfig, Map, ErrorCollection)
- after positive validation value is saved:
OrderableField.populateFromParams(java.util.Map, java.util.Map)
OrderableField.getValueFromParams(java.util.Map)
setDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig, java.lang.Object)
Modifier and Type | Field and Description |
---|---|
static DefaultValueOperations |
NOT_SUPPORTED |
Modifier and Type | Method and Description |
---|---|
V |
getDefaultValue(FieldConfig fieldConfig)
Retrieves the Object representing the default field value for the Field and
FieldConfig . |
String |
getEditHtml(FieldConfig config,
Map customFieldValuesHolder,
webwork.action.Action action,
Map displayParameters,
FieldLayoutItem fieldLayoutItem)
Used during editing default value to render field.
|
String |
getViewHtml(FieldConfig fieldConfig,
FieldLayoutItem fieldLayoutItem)
Gets view html used on
ConfigureCustomField page (manage field contexts)
to display field configuration items for "default value". |
boolean |
isSupport()
Returns true if default values are supported, false otherwise.
|
static <T> DefaultValueOperations<T> |
notSupported() |
void |
populateDefaults(FieldConfig fieldConfig,
Map<String,Object> fieldValuesHolder)
Populate the
fieldValuesHolder with a value that should be shown by default when the edit default value page is shown. |
void |
setDefaultValue(FieldConfig fieldConfig,
V value)
Sets the default value for a FieldConfig
|
void |
validateFromActionParams(FieldConfig config,
Map<String,Object> actionParameters,
ErrorCollection errorCollection)
Validate action parameters prior to saving default value.
|
static final DefaultValueOperations NOT_SUPPORTED
static <T> DefaultValueOperations<T> notSupported()
@Nullable V getDefaultValue(@Nonnull FieldConfig fieldConfig)
FieldConfig
.fieldConfig
- for default valueCustomFieldType.getDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig)
,
FieldConfig
void setDefaultValue(@Nonnull FieldConfig fieldConfig, @Nullable V value)
fieldConfig
- for which the default is being storedvalue
- Transport Object representing the value instance of the CustomFieldEditCustomFieldDefaults.doExecute()
,
CustomFieldType.setDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig, java.lang.Object)
,
FieldConfig
void populateDefaults(@Nonnull FieldConfig fieldConfig, @Nonnull Map<String,Object> fieldValuesHolder)
fieldValuesHolder
with a value that should be shown by default when the edit default value page is shown.
Used together with getEditHtml(FieldConfig, Map, Action, Map, FieldLayoutItem)
}fieldConfig
- fieldValuesHolder
- getEditHtml(FieldConfig, Map, Action, Map, FieldLayoutItem)
,
EditCustomFieldDefaults.getCustomFieldHtml()
String getViewHtml(@Nonnull FieldConfig fieldConfig, @Nullable FieldLayoutItem fieldLayoutItem)
ConfigureCustomField
page (manage field contexts)
to display field configuration items for "default value".fieldConfig
- fieldLayoutItem
- FieldConfigItemImpl.getViewHtml(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
,
FieldConfigItemType.getViewHtml(com.atlassian.jira.issue.fields.config.FieldConfig, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
,
DefaultValueConfigItem.getViewHtml(com.atlassian.jira.issue.fields.config.FieldConfig, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
,
DefaultValueConfigItem.getViewHtml(com.atlassian.jira.issue.fields.config.FieldConfig, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
,
CustomFieldTypeModuleDescriptor.getDefaultViewHtml(com.atlassian.jira.issue.fields.config.FieldConfig, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
String getEditHtml(@Nonnull FieldConfig config, @Nonnull Map customFieldValuesHolder, webwork.action.Action action, Map displayParameters, FieldLayoutItem fieldLayoutItem)
populateDefaults(FieldConfig, Map)
called prior to this method.config
- customFieldValuesHolder
- action
- displayParameters
- fieldLayoutItem
- populateDefaults(FieldConfig, Map)
,
EditCustomFieldDefaults.getCustomFieldHtml()
void validateFromActionParams(@Nonnull FieldConfig config, @Nonnull Map<String,Object> actionParameters, @Nonnull ErrorCollection errorCollection)
config
- actionParameters
- errorCollection
- EditCustomFieldDefaults.doValidation()
,
OrderableField.populateFromParams(java.util.Map, java.util.Map)
,
setDefaultValue(FieldConfig, Object)
boolean isSupport()
Copyright © 2002-2022 Atlassian. All Rights Reserved.