public class

TimeTrackingSystemField

extends AbstractOrderableField
implements HideableField RequirableField RestAwareField RestFieldOperations
java.lang.Object
   ↳ com.atlassian.jira.issue.fields.AbstractField
     ↳ com.atlassian.jira.issue.fields.AbstractOrderableField
       ↳ com.atlassian.jira.issue.fields.TimeTrackingSystemField

Class Overview

The TimeTrackingSystemField is responsible for "maintaining" the 2 estimates values, namely Original Estimate and Remaining Estimate.

Since 4.2 it has two modes of operation, the older legacy mode that keeps original and remaining estimate tied together while work is not logged and the more modern mode that allows the 2 values to be edited and set independently. NOTES: Whenever you see the targetSubField mentioned its because the UpdateIssueFieldFunction tries to jam 1 value into this field. in the past this kinda worked but in the post separation world, it becomes more complicated. So we keep track of the "target" that wants to be updated and then we spend lots of effort making sure only that sub field gets updated.

Summary

Nested Classes
interface TimeTrackingSystemField.TimeTrackingValue

This interface is used as a value object for TimeTracking information. 

Constants
String TIMETRACKING_ORIGINALESTIMATE
String TIMETRACKING_REMAININGESTIMATE
String TIMETRACKING_TARGETSUBFIELD When this input parameter is specified then we are only wanted to set a specific sub field of time tracking.
[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.fields.OrderableField
[Expand]
Inherited Fields
From class com.atlassian.jira.issue.fields.AbstractField
Public Constructors
TimeTrackingSystemField(VelocityTemplatingEngine templatingEngine, ApplicationProperties applicationProperties, IssueManager issueManager, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, JiraDurationUtils jiraDurationUtils)
Public Methods
String availableForBulkEdit(BulkEditBean bulkEditBean)
boolean canRemoveValueFromIssueObject(Issue issue)
void createValue(Issue issue, Object value)
String getBulkEditHtml(OperationContext operationContext, Action action, BulkEditBean bulkEditBean, Map displayParameters)
Returns HTML that should be shown when the issue is being bulk edited.
String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)
Object getDefaultValue(Issue issue)
String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters)
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
JsonData getJsonDefaultValue(IssueContext issueCtx)
Return The default data for this system field.
FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean 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.
RestFieldOperationsHandler getRestFieldOperation()
Object getValueFromParams(Map fieldValueHolder)
This is called from BulkEdit/BulkWorkflowTransition to get an value object from a input set of values.
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Object value, Map displayParameters)
boolean hasParam(Map parameters)
Basic implementation where the relevant params object is null if no elements are present.
boolean hasValue(Issue issue)
boolean hasWorkStarted(Issue issue)
boolean isShown(Issue issue)
MessagedResult needsMove(Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem)
void populateDefaults(Map<StringObject> fieldValuesHolder, Issue issue)
We don't return any default for the TimeTracking field.
void populateForMove(Map<StringObject> fieldValuesHolder, Issue originalIssue, Issue targetIssue)
void populateFromIssue(Map<StringObject> fieldValuesHolder, Issue issue)
This is called to populate the field values holder with the current state of the Issue object.
void populateFromParams(Map<StringObject> fieldValuesHolder, Map<StringString[]> inputParameters)
This will populate the field values holder map with the time tracking value contained within the map of (typically but not always web) parameters.
void populateParamsFromString(Map<StringObject> fieldValuesHolder, String stringValue, Issue issue)
This is called by Jelly code to map a value into a field values holder.
void removeValueFromIssueObject(MutableIssue issue)
void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder)

This is called to back update the MutableIssue with the value object we previously stuffed into the field values holder.

void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)
This is called after the issue has been stored on disk and allows us a chance to create change records for the update.
void validateParams(OperationContext operationContext, ErrorCollection errorCollection, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem)
Protected Methods
Object getRelevantParams(Map<StringString[]> inputParameters)
This is implemented in response to use being an AbstractOrderableField.
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.fields.AbstractOrderableField
From class com.atlassian.jira.issue.fields.AbstractField
From class java.lang.Object
From interface com.atlassian.jira.issue.fields.Field
From interface com.atlassian.jira.issue.fields.OrderableField
From interface com.atlassian.jira.issue.fields.SearchableField
From interface com.atlassian.jira.issue.fields.rest.RestAwareField
From interface com.atlassian.jira.issue.fields.rest.RestFieldOperations
From interface java.lang.Comparable

Constants

public static final String TIMETRACKING_ORIGINALESTIMATE

Constant Value: "timetracking_originalestimate"

public static final String TIMETRACKING_REMAININGESTIMATE

Constant Value: "timetracking_remainingestimate"

public static final String TIMETRACKING_TARGETSUBFIELD

When this input parameter is specified then we are only wanted to set a specific sub field of time tracking. This parameter will say which one.

This is used by the UpdateIssueFieldFunction so that it can set say original estimate only for example.

Constant Value: "timetracking_targetsubfield"

Public Constructors

public TimeTrackingSystemField (VelocityTemplatingEngine templatingEngine, ApplicationProperties applicationProperties, IssueManager issueManager, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, JiraDurationUtils jiraDurationUtils)

Public Methods

public String availableForBulkEdit (BulkEditBean bulkEditBean)

public boolean canRemoveValueFromIssueObject (Issue issue)

public void createValue (Issue issue, Object value)

public String getBulkEditHtml (OperationContext operationContext, Action action, BulkEditBean bulkEditBean, Map displayParameters)

Returns HTML that should be shown when the issue is being bulk edited. By default calls the getEditHtml(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, com.atlassian.jira.issue.customfields.OperationContext, webwork.action.Action, com.atlassian.jira.issue.Issue, java.util.Map) method with null for FieldLayoutItem and the first issue in the collection}

Parameters
operationContext OperationContext
action Action
bulkEditBean BulkEditBean
displayParameters Map of display parameters.
Returns
  • HTML that should be shown when the issue is being edited.

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

public Object getDefaultValue (Issue issue)

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

public FieldTypeInfo getFieldTypeInfo (FieldTypeInfoContext fieldTypeInfoContext)

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

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

public JsonData getJsonDefaultValue (IssueContext issueCtx)

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

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

public FieldJsonRepresentation getJsonFromIssue (Issue issue, boolean 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.

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.

public JsonType getJsonSchema ()

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

public RestFieldOperationsHandler getRestFieldOperation ()

public Object getValueFromParams (Map fieldValueHolder)

This is called from BulkEdit/BulkWorkflowTransition to get an value object from a input set of values.

Parameters
fieldValueHolder the map of parameters.
Returns
  • a parsed long or null if not in the input.

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

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

public boolean hasParam (Map parameters)

Basic implementation where the relevant params object is null if no elements are present. Some fields need to override this because of their innate complex behaviour.

Parameters
parameters Map of parameters.
Returns
  • True if a relevant parameter is available in the input.

public boolean hasValue (Issue issue)

public boolean hasWorkStarted (Issue issue)

public boolean isShown (Issue issue)

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

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

We don't return any default for the TimeTracking field.

Parameters
fieldValuesHolder The fieldValuesHolder Map to be populated.
issue The issue in play.

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

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

This is called to populate the field values holder with the current state of the Issue object. For example this will be called when the issue is edited.

Parameters
fieldValuesHolder The fieldValuesHolder Map to be populated.
issue The issue in play.

public void populateFromParams (Map<StringObject> fieldValuesHolder, Map<StringString[]> inputParameters)

This will populate the field values holder map with the time tracking value contained within the map of (typically but not always web) parameters.

We override this so we can see this happen. This helps for debugging reasons. Damn you class hierarchies, you are confusing me!

This will end up calling getRelevantParams(Map) by the way.

Parameters
fieldValuesHolder the writable map of field values in play.
inputParameters the input parameters.

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

This is called by Jelly code to map a value into a field values holder.

Parameters
fieldValuesHolder Map of field Values.
stringValue user friendly string value.
issue the issue in play.

public void removeValueFromIssueObject (MutableIssue issue)

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

This is called to back update the MutableIssue with the value object we previously stuffed into the field values holder.

This is called prior to the issue being stored on disk.

Parameters
fieldLayoutItem FieldLayoutItem in play.
issue MutableIssue in play.
fieldValueHolder Field Value Holder Map.

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

This is called after the issue has been stored on disk and allows us a chance to create change records for the update.

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.

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

Protected Methods

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

This is implemented in response to use being an AbstractOrderableField. It is actually called via populateFromParams so that we can place our relevant value object into the field values holder map. See above for the code entry point.

Parameters
inputParameters the input parameters.
Returns
  • the object to be placed into a field values holder map under our id.