Serializable
, Cloneable
, Comparable<Entity>
, Entity
public class CustomField extends AbstractEntity implements Comparable<Entity>
Allows the user to dynamically extend the set of attributes/properties of the Issue class.
A CustomField must be configured to be used in a Project in order to extend the attributes/properties of all Issues created for that project. A CustomField may be used in more than 1 project. (Project - CustomField is a M-N relathionship).
A CustomField has a type, which indicates the data type of its value.
The special type LIST
, allows to associate a list of string
options to a CustomField, which are the enumeration of possible values for
that field.
Each option value is represented by a CustomFieldValue instance. There's a
1-N relationship between CustomField - CustomFieldValue. A CustomFieldValue
can only belong to 1 CustomField (composition).
A value of a CustomField for a given Issue is represented by an IssueField instance. (CustomField - IssueField is a 1-N relationship).
CustomFieldValue
,
IssueField
,
Serialized FormModifier and Type | Class | Description |
---|---|---|
static class |
CustomField.DateFormat |
Date format for fields of type DATE.
|
static class |
CustomField.Type |
Enumeration of possible data types.
|
AbstractEntity.CreateDateComparator, AbstractEntity.IdComparator, AbstractEntity.LastModifiedDateComparator
Modifier and Type | Field | Description |
---|---|---|
static SimpleDateFormat |
DEFAULT_DATE_FORMAT |
Dateformat able to parse datepicker generated date string (dd/MM/yyyy)
|
CREATE_DATE_COMPARATOR, ID_COMPARATOR, LAST_MODIFIED_DATE_COMPARATOR
Constructor | Description |
---|---|
CustomField() |
Default constructor (required by Hibernate).
|
Modifier and Type | Method | Description |
---|---|---|
void |
addOption(String value,
String label) |
Deprecated.
this can not be in the entity, replace by Utility or service.
|
void |
checkAssignable(String value,
Locale locale,
ResourceBundle bundle) |
Checks if the given value is assignable to this custom field.
|
String |
getDateFormat() |
|
CustomField.Type |
getFieldType() |
|
List<CustomFieldValue> |
getOptions() |
|
boolean |
isRequired() |
|
boolean |
isSortOptionsByName() |
|
void |
setDateFormat(String dateFormat) |
|
void |
setFieldType(CustomField.Type type) |
|
void |
setOptions(List<CustomFieldValue> options) |
|
void |
setRequired(boolean required) |
|
void |
setSortOptionsByName(boolean sortOptionsByName) |
|
String |
toString() |
clone, compareTo, equals, getCreateDate, getId, getLastModifiedDate, hashCode, isNew, setCreateDate, setId, setLastModifiedDate
compareTo
public static final SimpleDateFormat DEFAULT_DATE_FORMAT
public CustomField()
PENDING: should be private
so that it can only be used by
Hibernate, to ensure that the fields which form an instance's identity
are always initialized/never null.
public CustomField.Type getFieldType()
public void setFieldType(CustomField.Type type)
public String getDateFormat()
public void setDateFormat(String dateFormat)
public boolean isRequired()
public void setRequired(boolean required)
public List<CustomFieldValue> getOptions()
public void setOptions(List<CustomFieldValue> options)
public void addOption(String value, String label)
New options are put at the end of the list even if they should be sorted.
This method is mainly used to build a new custom field so it can be saved
later.
value
- the option valuelabel
- the label/name for the new optionpublic boolean isSortOptionsByName()
public void setSortOptionsByName(boolean sortOptionsByName)
public void checkAssignable(String value, Locale locale, ResourceBundle bundle) throws IssueException
value
- custom field dataIssueException
- if it isn'tIssueField.setValue(String, Locale, ResourceBundle)
Copyright © 2002–2019 itracker. All rights reserved.