com.atlassian.jira.mail
Class TemplateIssue

java.lang.Object
  extended by com.atlassian.jira.mail.TemplateIssue
All Implemented Interfaces:
WithId, WithKey, IssueContext, Issue, OfBizValueWrapper

public class TemplateIssue
extends Object
implements Issue

Decorator for the Issue Object.

This class will ensure backwards compatibility for templates accessing the issue object. This class also includes helper methods for retrieving rendered fields (e.g. description, environment) and nicely formatted date fields (e.g. Original Time Estimate, Time Spent, etc.).

This object is passed to the template through the TemplateContext for the velocity email templates


Field Summary
 
Fields inherited from interface com.atlassian.jira.issue.context.IssueContext
GLOBAL
 
Constructor Summary
TemplateIssue(Issue issue, FieldLayoutManager fieldLayoutManager, RendererManager rendererManager, CustomFieldManager customFieldManager, JiraDurationUtils jiraDurationUtils, AggregateTimeTrackingCalculatorFactory aggregateTimeTrackingCalculatorFactory)
           
 
Method Summary
 Collection<Version> getAffectedVersions()
           
 Long getAggregateOriginalEstimate()
           
 Long getAggregateRemainingEstimate()
           
 Long getAggregateTimeSpent()
           
 com.atlassian.crowd.embedded.api.User getAssignee()
          Returns the Assignee User.
 String getAssigneeId()
           
 com.atlassian.crowd.embedded.api.User getAssigneeUser()
          Returns the Assignee User.
 Collection<Attachment> getAttachments()
           
 Collection<ProjectComponent> getComponentObjects()
           
 Collection<org.ofbiz.core.entity.GenericValue> getComponents()
           
 Timestamp getCreated()
           
 com.atlassian.crowd.embedded.api.User getCreator()
           
 String getCreatorId()
           
 CustomField getCustomField(String id)
           
 Object getCustomFieldValue(CustomField customField)
           
 Object getCustomFieldValue(String id)
          Get value for a custom field.
 String getDescription()
          Retrieve the description of the issue.
 Timestamp getDueDate()
           
 String getEnvironment()
          Retrieve the environment of the issue.
 Long getEstimate()
          This is the "remaining estimate" of work left to be performed on this issue, in milliseconds.
 Object getExternalFieldValue(String fieldId)
           
 Collection<Version> getFixVersions()
           
 org.ofbiz.core.entity.GenericValue getGenericValue()
          Get the backing GenericValue object.
 String getHtmlDescription()
          Retrieves the html formatted description.
 String getHtmlEnvironment()
          Retrieves the html formatted environment.
 Long getId()
           
 IssueRenderContext getIssueRenderContext()
           
 org.ofbiz.core.entity.GenericValue getIssueType()
          Gets the IssueType for this Issue.
 String getIssueTypeId()
          Gets the ID of the IssueType for this Issue.
 IssueType getIssueTypeObject()
          Gets the IssueType for this Issue.
 String getKey()
           
 Set<Label> getLabels()
          Returns a set of all the labels for this issue or an empty set if none exist yet.
 Long getLong(String name)
          Retrieve a numeric field.
 String getNiceTimeAggregateOriginalEstimate(I18nHelper i18n)
          Return a formatted time string of the aggregate original time estimate.
 String getNiceTimeAggregateRemainingEstimate(I18nHelper i18n)
          Return a formatted time string of the aggregate time estimate.
 String getNiceTimeAggregateTimeSpent(I18nHelper i18n)
          Return a formatted time string of the aggregate time spent.
 String getNiceTimeEstimate(I18nHelper i18n)
          Return a formatted time string of the time estimate.
 String getNiceTimeOriginalEstimate(I18nHelper i18n)
          Return a formatted time string of the original time estimate.
 String getNiceTimeSpent(I18nHelper i18n)
          Return a formatted time string of the time spent.
 Long getNumber()
           
 Long getOriginalEstimate()
          This is the "original estimate" of work to be performed on this issue, in milliseconds.
 org.ofbiz.core.entity.GenericValue getParent()
           
 Long getParentId()
           
 Issue getParentObject()
          If this issue is a subtask, return its parent.
 org.ofbiz.core.entity.GenericValue getPriority()
          Returns the Priority for this Issue.
 Priority getPriorityObject()
          Returns the Priority for this Issue.
 org.ofbiz.core.entity.GenericValue getProject()
          Gets the Project for this IssueContext.
 Long getProjectId()
          Gets the ID of the Project for this Issue.
 Project getProjectObject()
          Gets the Project for this Issue.
 com.atlassian.crowd.embedded.api.User getReporter()
          Returns the Reporter User.
 String getReporterId()
           
 com.atlassian.crowd.embedded.api.User getReporterUser()
          Return the reporter - an object will be returned even if the user has been deleted from the system.
 org.ofbiz.core.entity.GenericValue getResolution()
          Returns the Resolution for this Issue.
 Timestamp getResolutionDate()
          Returns the datetime that an issue was resolved on.
 String getResolutionId()
           
 Resolution getResolutionObject()
          Returns the Resolution for this Issue.
 org.ofbiz.core.entity.GenericValue getSecurityLevel()
          Returns the Security Level for this Issue.
 Long getSecurityLevelId()
          Returns the Security Level for this Issue.
 org.ofbiz.core.entity.GenericValue getStatus()
           
 String getStatusId()
           
 Status getStatusObject()
           
 String getString(String name)
          Retrieve a String field.
 Collection<Issue> getSubTaskObjects()
          Gets all the issue's subtasks.
 Collection<org.ofbiz.core.entity.GenericValue> getSubTasks()
           
 String getSummary()
           
 Long getTimeSpent()
          This is the "total time spent" working on this issue, in milliseconds.
 Timestamp getTimestamp(String name)
          Retrieve a timestamp field.
 Timestamp getUpdated()
           
 Long getVotes()
           
 Long getWatches()
           
 Long getWorkflowId()
           
 boolean isAnyAggregateDifferent()
          Are any of the aggregates different?
 boolean isCreated()
           
 boolean isEditable()
           
 boolean isSubTask()
           
 void store()
          Persist this object's immediate fields.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.issue.Issue
equals, hashCode
 

Constructor Detail

TemplateIssue

public TemplateIssue(Issue issue,
                     FieldLayoutManager fieldLayoutManager,
                     RendererManager rendererManager,
                     CustomFieldManager customFieldManager,
                     JiraDurationUtils jiraDurationUtils,
                     AggregateTimeTrackingCalculatorFactory aggregateTimeTrackingCalculatorFactory)
Method Detail

getId

public Long getId()
Specified by:
getId in interface WithId
Specified by:
getId in interface Issue
Returns:
the unique id of the entity.

getProject

public org.ofbiz.core.entity.GenericValue getProject()
Description copied from interface: IssueContext
Gets the Project for this IssueContext.

A null return value is used to represent that this context applies to all Projects.

Specified by:
getProject in interface IssueContext
Specified by:
getProject in interface Issue
Returns:
The Project for this IssueContext (can be null).

getProjectObject

public Project getProjectObject()
Description copied from interface: Issue
Gets the Project for this Issue.

Specified by:
getProjectObject in interface IssueContext
Specified by:
getProjectObject in interface Issue
Returns:
The Project for this Issue.

getProjectId

public Long getProjectId()
Description copied from interface: Issue
Gets the ID of the Project for this Issue.

Specified by:
getProjectId in interface IssueContext
Specified by:
getProjectId in interface Issue
Returns:
The ID of the Project for this Issue.

getIssueType

public org.ofbiz.core.entity.GenericValue getIssueType()
Description copied from interface: Issue
Gets the IssueType for this Issue.

Specified by:
getIssueType in interface IssueContext
Specified by:
getIssueType in interface Issue
Returns:
The IssueType for this Issue.

getIssueTypeObject

public IssueType getIssueTypeObject()
Description copied from interface: Issue
Gets the IssueType for this Issue.

Specified by:
getIssueTypeObject in interface IssueContext
Specified by:
getIssueTypeObject in interface Issue
Returns:
The IssueType for this Issue.

getIssueTypeId

public String getIssueTypeId()
Description copied from interface: Issue
Gets the ID of the IssueType for this Issue.

Specified by:
getIssueTypeId in interface IssueContext
Specified by:
getIssueTypeId in interface Issue
Returns:
The ID of the IssueType for this Issue.

getSummary

public String getSummary()
Specified by:
getSummary in interface Issue

getAssignee

public com.atlassian.crowd.embedded.api.User getAssignee()
Description copied from interface: Issue
Returns the Assignee User.

Warning: previous incarnations of this method returned com.opensymphony.user.User. This class has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with earlier versions.

Specified by:
getAssignee in interface Issue
Returns:
the Assignee User.

getAssigneeId

public String getAssigneeId()
Specified by:
getAssigneeId in interface Issue

getAssigneeUser

public com.atlassian.crowd.embedded.api.User getAssigneeUser()
Description copied from interface: Issue
Returns the Assignee User.

If there is no assignee it returns null, else it is guaranteed to return a non-null User. If the User is no longer available, it will create a dummy User object based on the username.

Legacy synonym for Issue.getAssignee()

Specified by:
getAssigneeUser in interface Issue
Returns:
the Assignee User.
See Also:
Issue.getAssignee()

getComponents

public Collection<org.ofbiz.core.entity.GenericValue> getComponents()
Specified by:
getComponents in interface Issue
Returns:
A collection of component GenericValues.

getComponentObjects

public Collection<ProjectComponent> getComponentObjects()
Specified by:
getComponentObjects in interface Issue
Returns:
collection of project components (as objects) that this issue is assigned to

getReporter

public com.atlassian.crowd.embedded.api.User getReporter()
Description copied from interface: Issue
Returns the Reporter User.

Warning: previous incarnations of this method returned com.opensymphony.user.User. This class has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with earlier versions.

Specified by:
getReporter in interface Issue
Returns:
the Reporter User.

getReporterId

public String getReporterId()
Specified by:
getReporterId in interface Issue

getCreator

public com.atlassian.crowd.embedded.api.User getCreator()
Specified by:
getCreator in interface Issue

getCreatorId

public String getCreatorId()
Specified by:
getCreatorId in interface Issue

getReporterUser

public com.atlassian.crowd.embedded.api.User getReporterUser()
Return the reporter - an object will be returned even if the user has been deleted from the system.

Specified by:
getReporterUser in interface Issue
Returns:
Object a User or DummyUser object if the issue has an reporter
See Also:
Issue.getReporter()

getDescription

public String getDescription()
Retrieve the description of the issue.

Specified by:
getDescription in interface Issue
Returns:
String the issue description - rendered or text dependant on format

getHtmlDescription

public String getHtmlDescription()
Retrieves the html formatted description.

A simple string (with linked bug keys displayed) is returned if a rendered version cannot be generated.

Returns:
String the html formatted description.

getEnvironment

public String getEnvironment()
Retrieve the environment of the issue. Depending on the format specified - attempt to return the rendered description or the simple text

Specified by:
getEnvironment in interface Issue
Returns:
String the issue environment - rendered or text dependant on format specified

getHtmlEnvironment

public String getHtmlEnvironment()
Retrieves the html formatted environment.

A simple string (with linked bug keys displayed) is returned if a rendered version cannot be generated.

Returns:
String the html formatted environment.

getAffectedVersions

public Collection<Version> getAffectedVersions()
Specified by:
getAffectedVersions in interface Issue
Returns:
a collection of 'affects' Version objects.

getFixVersions

public Collection<Version> getFixVersions()
Specified by:
getFixVersions in interface Issue
Returns:
a collection of fix-for Version objects.

getDueDate

public Timestamp getDueDate()
Specified by:
getDueDate in interface Issue

getSecurityLevel

public org.ofbiz.core.entity.GenericValue getSecurityLevel()
Description copied from interface: Issue
Returns the Security Level for this Issue.

Specified by:
getSecurityLevel in interface Issue
Returns:
the Security Level for this Issue.

getSecurityLevelId

public Long getSecurityLevelId()
Description copied from interface: Issue
Returns the Security Level for this Issue.

Specified by:
getSecurityLevelId in interface Issue
Returns:
the Security Level for this Issue.

getPriority

public org.ofbiz.core.entity.GenericValue getPriority()
Description copied from interface: Issue
Returns the Priority for this Issue.

Specified by:
getPriority in interface Issue
Returns:
the Priority for this Issue.

getPriorityObject

public Priority getPriorityObject()
Description copied from interface: Issue
Returns the Priority for this Issue.

Specified by:
getPriorityObject in interface Issue
Returns:
the Priority for this Issue.

getResolutionId

public String getResolutionId()
Specified by:
getResolutionId in interface Issue

getResolution

public org.ofbiz.core.entity.GenericValue getResolution()
Description copied from interface: Issue
Returns the Resolution for this Issue.

Specified by:
getResolution in interface Issue
Returns:
the Resolution for this Issue.

getResolutionObject

public Resolution getResolutionObject()
Description copied from interface: Issue
Returns the Resolution for this Issue.

Specified by:
getResolutionObject in interface Issue
Returns:
the Resolution for this Issue.

getKey

public String getKey()
Specified by:
getKey in interface WithKey
Specified by:
getKey in interface Issue
Returns:
the entity key.

getNumber

public Long getNumber()
Specified by:
getNumber in interface Issue

getVotes

public Long getVotes()
Specified by:
getVotes in interface Issue

getWatches

public Long getWatches()
Specified by:
getWatches in interface Issue

getCreated

public Timestamp getCreated()
Specified by:
getCreated in interface Issue

getResolutionDate

public Timestamp getResolutionDate()
Description copied from interface: Issue
Returns the datetime that an issue was resolved on. Will be null if it hasn't been resolved yet, or if an issue has been returned to the 'unresolved' state.

Specified by:
getResolutionDate in interface Issue
Returns:
Timestamp of when an issue was resolved, or null

getUpdated

public Timestamp getUpdated()
Specified by:
getUpdated in interface Issue

getWorkflowId

public Long getWorkflowId()
Specified by:
getWorkflowId in interface Issue

getCustomFieldValue

public Object getCustomFieldValue(CustomField customField)
Specified by:
getCustomFieldValue in interface Issue
Parameters:
customField - the CustomField
Returns:
A custom field's value. Will be a List, User, Timestamp etc, depending on custom field type.

getCustomField

public CustomField getCustomField(String id)

getCustomFieldValue

public Object getCustomFieldValue(String id)
Get value for a custom field.

Parameters:
id - Custom field key (eg. 'customfield_10010').
Returns:
custom field, or null if specified custom field doesn't exist or doesn't have a value in this issue.

getStatus

public org.ofbiz.core.entity.GenericValue getStatus()
Specified by:
getStatus in interface Issue

getStatusId

public String getStatusId()
Specified by:
getStatusId in interface Issue

getStatusObject

public Status getStatusObject()
Specified by:
getStatusObject in interface Issue

getOriginalEstimate

public Long getOriginalEstimate()
Description copied from interface: Issue
This is the "original estimate" of work to be performed on this issue, in milliseconds.

Specified by:
getOriginalEstimate in interface Issue
Returns:
the "original estimate" of work to be performed on this issue, in milliseconds.

getEstimate

public Long getEstimate()
Description copied from interface: Issue
This is the "remaining estimate" of work left to be performed on this issue, in milliseconds.

A better name would be getRemainingEstimate but for historical reasons it is called what it is called.

Specified by:
getEstimate in interface Issue
Returns:
the "remaining estimate" of work left to be performed on this issue, in milliseconds.

getTimeSpent

public Long getTimeSpent()
Description copied from interface: Issue
This is the "total time spent" working on this issue, in milliseconds.

Specified by:
getTimeSpent in interface Issue
Returns:
the "total time spent" working on this issue, in milliseconds.

getAggregateOriginalEstimate

public Long getAggregateOriginalEstimate()

getAggregateRemainingEstimate

public Long getAggregateRemainingEstimate()

getAggregateTimeSpent

public Long getAggregateTimeSpent()

getExternalFieldValue

public Object getExternalFieldValue(String fieldId)
Specified by:
getExternalFieldValue in interface Issue

isSubTask

public boolean isSubTask()
Specified by:
isSubTask in interface Issue

getParentId

public Long getParentId()
Specified by:
getParentId in interface Issue

isCreated

public boolean isCreated()
Specified by:
isCreated in interface Issue

getParentObject

public Issue getParentObject()
Description copied from interface: Issue
If this issue is a subtask, return its parent.

Specified by:
getParentObject in interface Issue
Returns:
The parent Issue, or null if the issue is not a subtask.

getParent

public org.ofbiz.core.entity.GenericValue getParent()
Specified by:
getParent in interface Issue

getSubTasks

public Collection<org.ofbiz.core.entity.GenericValue> getSubTasks()
Specified by:
getSubTasks in interface Issue

getSubTaskObjects

public Collection<Issue> getSubTaskObjects()
Description copied from interface: Issue
Gets all the issue's subtasks.

Specified by:
getSubTaskObjects in interface Issue
Returns:
A collection of MutableIssues

isEditable

public boolean isEditable()
Specified by:
isEditable in interface Issue

getIssueRenderContext

public IssueRenderContext getIssueRenderContext()
Specified by:
getIssueRenderContext in interface Issue

getAttachments

public Collection<Attachment> getAttachments()
Specified by:
getAttachments in interface Issue
Returns:
A collection of Attachment objects

getString

public String getString(String name)
Description copied from interface: OfBizValueWrapper
Retrieve a String field.

Specified by:
getString in interface OfBizValueWrapper
Parameters:
name - the field name
Returns:
the value for the given field.

getTimestamp

public Timestamp getTimestamp(String name)
Description copied from interface: OfBizValueWrapper
Retrieve a timestamp field.

Specified by:
getTimestamp in interface OfBizValueWrapper
Parameters:
name - the field name
Returns:
the value for the given field.

getLabels

public Set<Label> getLabels()
Description copied from interface: Issue
Returns a set of all the labels for this issue or an empty set if none exist yet.

Specified by:
getLabels in interface Issue
Returns:
a set of all the labels for this issue or an empty set if none exist yet

getLong

public Long getLong(String name)
Description copied from interface: OfBizValueWrapper
Retrieve a numeric field.

Specified by:
getLong in interface OfBizValueWrapper
Parameters:
name - the field name
Returns:
the value for the given field.

getGenericValue

public org.ofbiz.core.entity.GenericValue getGenericValue()
Description copied from interface: Issue
Get the backing GenericValue object.

Specified by:
getGenericValue in interface Issue
Specified by:
getGenericValue in interface OfBizValueWrapper
Returns:
the backing GenericValue object.

store

public void store()
Description copied from interface: OfBizValueWrapper
Persist this object's immediate fields.

Specified by:
store in interface OfBizValueWrapper

getNiceTimeOriginalEstimate

public String getNiceTimeOriginalEstimate(I18nHelper i18n)
Return a formatted time string of the original time estimate.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of original time estimate

getNiceTimeEstimate

public String getNiceTimeEstimate(I18nHelper i18n)
Return a formatted time string of the time estimate.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of time estimate

getNiceTimeSpent

public String getNiceTimeSpent(I18nHelper i18n)
Return a formatted time string of the time spent.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of time spent

isAnyAggregateDifferent

public boolean isAnyAggregateDifferent()
Are any of the aggregates different?

Returns:
true if any of the aggregate time tracking values are different, false otherwise

getNiceTimeAggregateOriginalEstimate

public String getNiceTimeAggregateOriginalEstimate(I18nHelper i18n)
Return a formatted time string of the aggregate original time estimate.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of original time estimate

getNiceTimeAggregateRemainingEstimate

public String getNiceTimeAggregateRemainingEstimate(I18nHelper i18n)
Return a formatted time string of the aggregate time estimate.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of time estimate

getNiceTimeAggregateTimeSpent

public String getNiceTimeAggregateTimeSpent(I18nHelper i18n)
Return a formatted time string of the aggregate time spent.

Parameters:
i18n - helper bean for internationalization
Returns:
String formatted string of time spent

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2015 Atlassian. All Rights Reserved.