Interface ITemplateUtils
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStaticResourceAttachment
(long staticResourceId) Adds the static resource as attachment.addStaticResourceInline
(long staticResourceId) Adds the static resource as inline image returning the cid: url to be put in an img html tag.Prints an object.void
Deprecated, for removal: This API element is subject to removal in a future version.Temporarily added for debugging of event changelog processing - will be removed without warningcom.fasterxml.jackson.databind.node.ArrayNode
filterRestrictedComments
(com.fasterxml.jackson.databind.node.ArrayNode comments) Filter comments according restrictions.getChangelogAuthor
(com.fasterxml.jackson.databind.JsonNode changelog) get all authors in change logsSet<com.fasterxml.jackson.databind.JsonNode>
get all authors in change logsSet<com.fasterxml.jackson.databind.JsonNode>
getChangelogAuthors
(Collection<String> fieldIds) get all authors in change logsgetChangeLogFromValue
(com.fasterxml.jackson.databind.JsonNode input) Resolves the "from" value from a change log.Map<Long,
Map<com.fasterxml.jackson.databind.JsonNode, List<com.fasterxml.jackson.databind.JsonNode>>> getChangeLogs
(com.fasterxml.jackson.databind.JsonNode context) get all related change logsList<com.fasterxml.jackson.databind.JsonNode>
getChangeLogsByAuthor
(com.fasterxml.jackson.databind.JsonNode context, String authorId) Returns the change log indexed by author.Map<Long,
Map<com.fasterxml.jackson.databind.JsonNode, List<com.fasterxml.jackson.databind.JsonNode>>> getChangeLogsByShowFields
(com.fasterxml.jackson.databind.JsonNode context, Collection<String> fieldIds) get all related change logs filtered by showfieldsgetChangeLogToValue
(com.fasterxml.jackson.databind.JsonNode input) Resolves the to value from a change log.String[]
Deprecated, for removal: This API element is subject to removal in a future version.Temporarily added for debugging of event changelog processing - will be removed without warninggetDurationBreakdownSeconds
(Object objectValue) Transform a time spent object like 51600 into human-readable time 23h 40mReturn the email addresses of email-only users identified by the custom field set within the Notification Mapping.getFieldId
(String fieldIdOrName) Return the id of the file with the given id or name.com.fasterxml.jackson.databind.JsonNode
getFieldMetadata
(com.fasterxml.jackson.databind.JsonNode issue, String fieldId) Returns the field with the given field id or name;getGlobalImageUrl
(String name) Returns the global image url of the image with the given name.getGlobalImageUrl
(String name, String projectKey) Returns the global image url of the image with the given name.getImageUrl
(String name) Returns the image url of the image with the given name in the current theme.getImageUrl
(String name, String projectKey) Returns the image url of the image with the given name in the current theme.com.fasterxml.jackson.databind.JsonNode
Loads the issue from Jira.com.fasterxml.jackson.databind.node.ObjectNode
getIssueProperty
(String propertyKey) com.fasterxml.jackson.databind.JsonNode
getIssueTypeMetadata
(com.fasterxml.jackson.databind.JsonNode issue) Returns the issue type metadata for the give project and issue type id.com.fasterxml.jackson.databind.JsonNode
getIssueTypeMetadata
(String projectKey, Long issueTypeId) Returns the issue type metadata for the given project and issue type id.This method resolves the best Issue URL.getItemFrom
(Object item) Retrieve a changelogItems 'toString' string valuegetItemFromString
(Object item) Retrieve a changelogItems 'fromString' string valueRetrieve a changelogItems 'to' string valuegetItemToString
(Object item) Retrieve a changelogItems 'toString' string valueReturns a mailto format of the given address and personal.com.fasterxml.jackson.databind.JsonNode
Gets the operation user.Set<com.fasterxml.jackson.databind.JsonNode>
Resolves the people involved in the issue according to the Notification Mapping configuration.Map<Long,
Map<com.fasterxml.jackson.databind.JsonNode, List<com.fasterxml.jackson.databind.JsonNode>>> getPreviousChangeLogs
(String issueKey) Retrieves the change log from the issue excluding the event's change log (current changes).Returns the shorthand project key.com.fasterxml.jackson.databind.JsonNode
getProjectMetadata
(com.fasterxml.jackson.databind.JsonNode issue) Returns the project metadata for the give issue.com.fasterxml.jackson.databind.JsonNode
getProjectMetadata
(String projectKey) Returns the project metadata of the given project key.List<com.fasterxml.jackson.databind.JsonNode>
Gets the project roles.Returns the email address of the recipient if provided when rendering an email.Returns a singleton list with the recipient if provided.Returns theRecipientType
of the target recipient.get the latest author for a given request participant recipient in change logsget the latest author date for a given request participant recipient in change logsThis method fixed incorrect sprint values from events.getStatusCategoryHexColor
(String color) Transform the color form the status category to hexgetThemeImageUrl
(String name) Returns the image url of the image with the given name in the current theme.getThemeImageUrl
(String name, String projectKey) Returns the image url of the image with the given name in the current theme.com.fasterxml.jackson.databind.JsonNode
getUser()
The Jira user recipient of this email, the addon user if the recipients are emails users or null if the email is a non issue related issue like a forwarded email.com.fasterxml.jackson.databind.JsonNode
Loads and returns the user from a json node, user or string object.getUserAccountId
(Object object) Returns the user's account id from a json node, user or string object.getUserAvatar
(Object object, String avatarSize) Returns the user email from a json node, user or string object.getUserDescription
(Object object) Returns the best user's representation from a json node, user or string object.getUserEmailAddress
(Object object) Returns the user email from a json node, user or string object.getUserProfileUrl
(Object object) Returns the user's profile url from a json node, user or string object.Gets the user role.List<com.fasterxml.jackson.databind.JsonNode>
Return the users that are watching this ticket.Gets the webhook event.com.fasterxml.jackson.databind.JsonNode
getWorklogById
(com.fasterxml.jackson.databind.JsonNode issue, String worklogId) The worklog json data for the given worklog idboolean
hasElements
(Iterable<?> iterable) Checks for elements.boolean
hasProjectRole
(Object object, String projectRoleName) Returns if a user belongs to a project role.boolean
hasUserRole
(Object user, String roleName) Returns if a user has a given role.htmlEscape
(String string) HTML escapes the string.humanReadableByteCount
(long bytes) Transform bytes into a human-readable value in B, KB or MB depending on the input.Map<String,
Collection<com.fasterxml.jackson.databind.JsonNode>> includeOnly
(Map<String, Collection<com.fasterxml.jackson.databind.JsonNode>> map, Collection<String> fieldIds) Returns a copy of the map where the keys not in fieldIds are excluded.indexChangeLogByField
(com.fasterxml.jackson.databind.JsonNode context) Returns the change log indexed by field id.boolean
isCreate
(com.fasterxml.jackson.databind.JsonNode context) Checks if webhook event is an Issue Created Event.boolean
Checks if is created by email user.boolean
isCreateOrInChangeLog
(com.fasterxml.jackson.databind.JsonNode context, String fieldId) Checks if a field has been updated in the issue updated context.boolean
isIssueCreatedByEmail
(com.fasterxml.jackson.databind.JsonNode context) Evaluates if JEMHC created the issue in the event after processing an email.boolean
isJiraUser
(Object object) Returns if the user is a jira user, excluding the addon userboolean
Use this method to determine if the current user is also a JSD approver on the issue.boolean
Checks if the current user is a JSD customerboolean
Check if the current project is a Service Desk project.boolean
Use this method to see if the current user was added to the issue as an approver in this event.boolean
Use this method to check if the current user was added as a request participant in this event.boolean
Checks if a VTL reference is notnull
.boolean
Checks if a VTL reference isnull
.boolean
isPrivateJSDComment
(com.fasterxml.jackson.databind.JsonNode comment) Return if a comment is JSD private by querying the JSD comment property in:boolean
Checks if is sent to email users.boolean
isTheRecipientThePersonWhoHasExecutedTheOperation
(com.fasterxml.jackson.databind.JsonNode context) Return if the rendering of the template is targeted to user that changed or commented the issue.boolean
isUserInGroup
(Object object, String groupname) Returns if the user's belongs to the given group name.jsonEscape
(String string) JSON escapes the string.void
Logs the message into the report.mattermostEscape
(String string) Mattermost escapes the string.Generates a random UUIDrenderValue
(com.fasterxml.jackson.databind.JsonNode issue, String fieldId, Object value) Renders a field value according to its metadata.<T> Iterable<T>
Reverses an iterable returning a copy.void
Used to mark that a comment has been rendered and notification should be sent.void
Used to mark that a field has been rendered and notification should be sent.void
setInhibitSending
(boolean inhibit) Marks the template to not be sent.void
Marks an update issue template as 'not empty'.void
setReplyTo
(String replyTo) Use this method do dynamically change the reply to email address.slackEscape
(String string) Slack escapes the string.Prints an object as json.translateValue
(String fieldId, String value) It allows user to translate values that are in English by default.truncateMinute
(Date date) Returns the date without truncating the minute.URL encodes a string.wikiToHtml
(String wiki) if the wiki rendering option is enabled, it converts wiki markup to html escaping existing html elements.
-
Method Details
-
getUser
Loads and returns the user from a json node, user or string object.- Parameters:
object
- user object, node or account id- Returns:
- the user object or null if the account id could not be resolved from the parameter.
-
getUserAccountId
Returns the user's account id from a json node, user or string object.- Parameters:
object
- user object, node or account id.- Returns:
- the accountId or null
-
getUserProfileUrl
Returns the user's profile url from a json node, user or string object.- Parameters:
object
- user object, node or account id.- Returns:
- the url or null if the account id could not be resolved
-
isJiraUser
Returns if the user is a jira user, excluding the addon user- Parameters:
object
- user object, node or account id.- Returns:
- if the object is a user, excluding the addon user.
-
getUserDescription
Returns the best user's representation from a json node, user or string object.- Parameters:
object
- user object, node or account id.- Returns:
- the user description or null if the account id could not be resolved from the parameter.
-
getUserEmailAddress
Returns the user email from a json node, user or string object.- Parameters:
object
- user object, node or account id.- Returns:
- the user email or null.
-
isUserInGroup
Returns if the user's belongs to the given group name.- Parameters:
object
- user object, node or account id.groupname
- the group name- Returns:
- if the user's belongs to the given group name.
-
hasProjectRole
Returns if a user belongs to a project role.- Parameters:
object
- user object, node or account id.projectRoleName
- the project role name (Users, Developers, Users, etc.).- Returns:
- if a user belongs to a project role.
-
getUserAvatar
Returns the user email from a json node, user or string object.- Parameters:
object
- user object, node or account idavatarSize
- the avatar size like "16x16"- Returns:
- the user email or null.
-
getIssueTypeMetadata
com.fasterxml.jackson.databind.JsonNode getIssueTypeMetadata(com.fasterxml.jackson.databind.JsonNode issue) Returns the issue type metadata for the give project and issue type id.- Parameters:
issue
- the issue- Returns:
- the metadata
-
getStatusCategoryHexColor
Transform the color form the status category to hex- Parameters:
color
- the color like yellow- Returns:
- the hex color
-
getFieldMetadata
com.fasterxml.jackson.databind.JsonNode getFieldMetadata(com.fasterxml.jackson.databind.JsonNode issue, String fieldId) Returns the field with the given field id or name;- Parameters:
issue
- the issuefieldId
- the field id- Returns:
- the field or null
-
getFieldId
Return the id of the file with the given id or name.- Parameters:
fieldIdOrName
- the field id or name- Returns:
- the id of the file with the given id or name or the parameter if the field is not found.
-
getWatchers
List<com.fasterxml.jackson.databind.JsonNode> getWatchers()Return the users that are watching this ticket.- Returns:
- a list of all the users currently watching this ticket.
-
getSprintNameFromEventValue
This method fixed incorrect sprint values from events. These values are printed version of internal Jira objects. For example:["com.atlassian.greenhopper.service.sprint.Sprint@deb05e[id=1,rapidViewId=1,state=ACTIVE,name=SP Sprint 1,goal=,startDate=2017-04-26T08:42:17.180-03:00,endDate=2017-05-10T08:42:00.000-03:00,completeDate= ,sequence=1]"]
- Parameters:
value
- the printed out object from the field value.- Returns:
- the name from the printed object. Example "SP Spring 1"
-
getWorklogById
com.fasterxml.jackson.databind.JsonNode getWorklogById(com.fasterxml.jackson.databind.JsonNode issue, String worklogId) The worklog json data for the given worklog id- Parameters:
issue
- the issue contextworklogId
- the worklog id- Returns:
- the json node or null if it's not found.
-
getIssueTypeMetadata
Returns the issue type metadata for the given project and issue type id.- Parameters:
projectKey
- the project keyissueTypeId
- the issue type id.- Returns:
- the issue type metadata.
-
htmlEscape
HTML escapes the string. Useful when printing user input in html templates.- Parameters:
string
- the string- Returns:
- the HTML escaped version of the string
-
slackEscape
Slack escapes the string. Useful when printing user input in slack templates.- Parameters:
string
- the string- Returns:
- the slack escaped version of the string
-
mattermostEscape
Mattermost escapes the string. Useful when printing user input in Mattermost templates.- Parameters:
string
- the string- Returns:
- the Mattermost escaped version of the string
-
jsonEscape
JSON escapes the string. Useful when printing user input in json templates.- Parameters:
string
- the string- Returns:
- the JSON escaped version of the string
-
wikiToHtml
if the wiki rendering option is enabled, it converts wiki markup to html escaping existing html elements. If not, it just html escapes the parameter. Images URLs are converted to URL data using ITemplateUtils.inlineImage method.eg: "Here's a <strong>quote</strong> {quote}This is great!{quote}" will be converted to:
"<p>Here's a <strong>quote</strong> <blockquote><p>This is great!</p></blockquote></p>"
- Parameters:
wiki
- the wiki text- Returns:
- the wiki text as html
-
getProjectMetadata
com.fasterxml.jackson.databind.JsonNode getProjectMetadata(com.fasterxml.jackson.databind.JsonNode issue) Returns the project metadata for the give issue.- Parameters:
issue
- the issue json data- Returns:
- the project metadata.
-
getProjectMetadata
Returns the project metadata of the given project key.- Parameters:
projectKey
- the project key- Returns:
- the project metadata.
-
getIssue
Loads the issue from Jira. Use it if the event doesn't provide you information you need for rendering.- Parameters:
issueKey
- the issue key.- Returns:
- the issue or null if the issue doesn't exist.
-
reverse
Reverses an iterable returning a copy.- Type Parameters:
T
- the generic type- Parameters:
iterable
- the iterable- Returns:
- a reversed copy of the iterable.
-
isPrivateJSDComment
boolean isPrivateJSDComment(com.fasterxml.jackson.databind.JsonNode comment) Return if a comment is JSD private by querying the JSD comment property in:https://YOURJIRASERVER.com/rest/api/2/comment/YOURCOMMENTID/properties/sd .public.comment/
- Parameters:
comment
- one JSON comment object from the event context.- Returns:
- true if the comment is JSD private or false otherwise.
-
filterRestrictedComments
com.fasterxml.jackson.databind.node.ArrayNode filterRestrictedComments(com.fasterxml.jackson.databind.node.ArrayNode comments) Filter comments according restrictions. Comments are removed if:1) for EMAIL users(isSentToEmailUsers() is true). when comment is restricted or JSD private.
2) for Jira users (isSentToEmailUsers() is false) when comment is restricted and getUser() doesn't belong to the restricted role
- Parameters:
comments
- the comments- Returns:
- the array node
-
getProjectRoles
List<com.fasterxml.jackson.databind.JsonNode> getProjectRoles()Gets the project roles.- Returns:
- the roles of the issue projects.
-
isCreatedByEmailUser
boolean isCreatedByEmailUser()Checks if is created by email user.- Returns:
- if the issue was created/updated/commented by email. if false, the issue was created/updated/commented using the Jira UI.
-
getOperationUser
com.fasterxml.jackson.databind.JsonNode getOperationUser()Gets the operation user.- Returns:
- the Jira user that created/updated/commented the issue. JEMHCloud Add-on user if issue was created/updated/comment via email.
-
hasUserRole
Returns if a user has a given role.- Parameters:
user
- the userroleName
- the role name ([jira-administrators, jira-developers, jira-users. etc.)- Returns:
- if a user has a given role.
-
isSentToEmailUsers
boolean isSentToEmailUsers()Checks if is sent to email users.- Returns:
- if the email created is to be sent to email users or a jira users.
-
hasElements
Checks for elements.- Parameters:
iterable
- an iterable- Returns:
- if the iterable has more elements
-
getUser
com.fasterxml.jackson.databind.JsonNode getUser()The Jira user recipient of this email, the addon user if the recipients are emails users or null if the email is a non issue related issue like a forwarded email.- Returns:
- a jira user or null.
-
getUserRole
String getUserRole()Gets the user role.- Returns:
- get the user's role (Reporter, Assignee or Watcher) or null if user is null or is the addon user.
-
toJson
Prints an object as json.- Parameters:
object
- the object- Returns:
- the json representation of the object
-
asText
Prints an object.- Parameters:
object
- the object- Returns:
- the string representation of the object
-
getMailTo
Returns a mailto format of the given address and personal.- Parameters:
senderEmailAddress
- the email addresssenderPersonal
- the person if anysubject
- the subject- Returns:
- the mail to url.
-
addStaticResourceInline
Adds the static resource as inline image returning the cid: url to be put in an img html tag. Note that when rendering a preview, a secured s3 url is returned- Parameters:
staticResourceId
- the id of the static resource.- Returns:
- the cid: style url that links to the inlined attachment.
-
addStaticResourceAttachment
void addStaticResourceAttachment(long staticResourceId) Adds the static resource as attachment.- Parameters:
staticResourceId
- the id of the static resource.
-
getImageUrl
Returns the image url of the image with the given name in the current theme.- Parameters:
name
- the name of the image e.g: 'theLogo'- Returns:
- if the image exists for the current theme, the url. If theme image doesn't exist, the url of the global image. null if neither exist.
-
getThemeImageUrl
Returns the image url of the image with the given name in the current theme.- Parameters:
name
- the name of the image e.g: 'theLogo'- Returns:
- if the image exists for the current theme, the url. If theme image doesn't exist, the url of the global image. null if neither exist.
-
getProjectKey
String getProjectKey()Returns the shorthand project key. For example, the ticket key of IT-38 will return IT.Returns the shorthand project key.
- Returns:
- the shorthand key for the project that the issue belongs to.
-
getGlobalImageUrl
Returns the global image url of the image with the given name.- Parameters:
name
- the name of the image e.g: 'theLogo'- Returns:
- the url if the global image exists.
-
getImageUrl
Returns the image url of the image with the given name in the current theme.- Parameters:
name
- the name of the image e.g: 'theLogo'projectKey
- only images for this project or global project scope.- Returns:
- if the image exists for the current theme, the url. If theme image doesn't exist, the url of the global image. null if neither exist.
-
getThemeImageUrl
Returns the image url of the image with the given name in the current theme.- Parameters:
name
- the name of the image e.g: 'theLogo'projectKey
- only images for this project or global project scope.- Returns:
- if the image exists for the current theme, the url. If theme image doesn't exist, the url of the global image. null if neither exist.
-
getGlobalImageUrl
Returns the global image url of the image with the given name.- Parameters:
name
- the name of the image e.g: 'theLogo'projectKey
- only images for this project or global project scope.- Returns:
- the url if the global image exists.
-
urlEncode
URL encodes a string.- Parameters:
string
- .- Returns:
- the url encoded version of the string.
-
isCreateOrInChangeLog
Checks if a field has been updated in the issue updated context.- Parameters:
context
- the json contextfieldId
- the field id- Returns:
- if the field is in the current changelog.
-
isCreate
boolean isCreate(com.fasterxml.jackson.databind.JsonNode context) Checks if webhook event is an Issue Created Event.- Parameters:
context
- the json context- Returns:
- if the field is an Issue Created Event.
-
getChangeLogs
Map<Long,Map<com.fasterxml.jackson.databind.JsonNode, getChangeLogsList<com.fasterxml.jackson.databind.JsonNode>>> (com.fasterxml.jackson.databind.JsonNode context) get all related change logs- Parameters:
context
- context of current template- Returns:
- changelogs json list.
-
getChangeLogsByShowFields
Map<Long,Map<com.fasterxml.jackson.databind.JsonNode, getChangeLogsByShowFieldsList<com.fasterxml.jackson.databind.JsonNode>>> (com.fasterxml.jackson.databind.JsonNode context, Collection<String> fieldIds) get all related change logs filtered by showfields- Parameters:
fieldIds
- fields to show by idcontext
- the json context- Returns:
- changelogs json list filtered out fields with fieldIds.
-
getChangelogAuthors
Set<com.fasterxml.jackson.databind.JsonNode> getChangelogAuthors()get all authors in change logs- Returns:
- authors set.
-
getChangelogAuthors
get all authors in change logs- Parameters:
fieldIds
- fields to show by id- Returns:
- authors set.
-
getChangelogAuthor
get all authors in change logs- Parameters:
changelog
- the json changelog to retrieve author from- Returns:
- author of changelog.
-
getRequestParticipantAuthor
String getRequestParticipantAuthor()get the latest author for a given request participant recipient in change logs- Returns:
- author's display name as string.
-
getRequestParticipantTimestamp
Date getRequestParticipantTimestamp()get the latest author date for a given request participant recipient in change logs- Returns:
- requested participant change timestamp as date.
-
enableDebug
Deprecated, for removal: This API element is subject to removal in a future version.Temporarily added for debugging of event changelog processing - will be removed without warning -
getDebugMessages
Deprecated, for removal: This API element is subject to removal in a future version.Temporarily added for debugging of event changelog processing - will be removed without warning -
indexChangeLogByField
Map<String,List<com.fasterxml.jackson.databind.JsonNode>> indexChangeLogByField(com.fasterxml.jackson.databind.JsonNode context) Returns the change log indexed by field id.- Parameters:
context
- the context- Returns:
- a map field id to list of field's changelog
-
getChangeLogsByAuthor
List<com.fasterxml.jackson.databind.JsonNode> getChangeLogsByAuthor(com.fasterxml.jackson.databind.JsonNode context, String authorId) Returns the change log indexed by author.- Parameters:
context
- the contextauthorId
- the ID of the author- Returns:
- list of changelogs by author
-
getChangeLogFromValue
Resolves the "from" value from a change log. If the field is a user field, the account ids in the changelog will be converted to the users' display name- Parameters:
input
- the change log- Returns:
- the "from" string of the changelog item
-
getChangeLogToValue
Resolves the to value from a change log. If the field is a user field, the account ids in the changelog will be converted to the users' display name- Parameters:
input
- the change log- Returns:
- the from string
-
includeOnly
Map<String,Collection<com.fasterxml.jackson.databind.JsonNode>> includeOnly(Map<String, Collection<com.fasterxml.jackson.databind.JsonNode>> map, Collection<String> fieldIds) Returns a copy of the map where the keys not in fieldIds are excluded.If the fieldsId is null or empty, the original map is returned.
- Parameters:
map
- the map of field changesfieldIds
- the whitelist of fields ids.- Returns:
- the original map if the field id list is null or empty, if not, a map with only the keys found in the fields collection.
-
isNull
Checks if a VTL reference isnull
.- Parameters:
object
- the VTL reference to check.- Returns:
true
if the VTL reference isnull
,false
if otherwise.
-
isNotNull
Checks if a VTL reference is notnull
.- Parameters:
object
- the VTL reference to check.- Returns:
true
if the VTL reference is notnull
,false
if otherwise.
-
setNotify
void setNotify()Marks an update issue template as 'not empty'. You should use it when useful information has been printed and email must be sent. -
renderValue
Renders a field value according to its metadata. Most of the fields already come pre-rendered in the context. These values should be used (fromString, toString attributes) as this method will assume that.Example:
timeoriginalestimate
value 14400 will render as 4h- Parameters:
issue
- the issuefieldId
- the field idvalue
- the value- Returns:
- the formatted value or the original value if the custom render cannot be performed.
-
getDurationBreakdownSeconds
Transform a time spent object like 51600 into human-readable time 23h 40m- Parameters:
objectValue
- the number value (number, string or json node)- Returns:
- the human-readable value.
-
getRecipientType
RecipientType getRecipientType()Returns theRecipientType
of the target recipient. It can be used along method setInhibitSending(boolean inhibit) to exclude recipients according their type and the current data at rendering time.- Returns:
- the
RecipientType
-
getPreviousChangeLogs
Map<Long,Map<com.fasterxml.jackson.databind.JsonNode, getPreviousChangeLogsList<com.fasterxml.jackson.databind.JsonNode>>> (String issueKey) Retrieves the change log from the issue excluding the event's change log (current changes).- Parameters:
issueKey
- the issue key- Returns:
- the list of change logs excluding the ones provided in the event.
-
setInhibitSending
void setInhibitSending(boolean inhibit) Marks the template to not be sent.- Parameters:
inhibit
- boolean to mark/unmark template to be sent
-
setCommentRendered
void setCommentRendered()Used to mark that a comment has been rendered and notification should be sent. -
setFieldRendered
void setFieldRendered()Used to mark that a field has been rendered and notification should be sent. -
getRecipient
String getRecipient()Returns the email address of the recipient if provided when rendering an email.- Returns:
- the recipient or null if it hasn't been provided when rendering the email.
-
getSenders
- Returns:
- the email addresses of the senders if the issue was created or updated via email. It could be more than one sender as multiple issue events may be merged together.
-
isTheRecipientThePersonWhoHasExecutedTheOperation
boolean isTheRecipientThePersonWhoHasExecutedTheOperation(com.fasterxml.jackson.databind.JsonNode context) Return if the rendering of the template is targeted to user that changed or commented the issue.- Parameters:
context
- the context of the event.- Returns:
- true if the rendering of the template is targeted to user that changed or commented the issue.
-
getRecipients
Returns a singleton list with the recipient if provided.- Returns:
- the list of email address recipients of the rendered email.
-
getWebhookEvent
String getWebhookEvent()Gets the webhook event.- Returns:
- webhook event type ready to be used an i18n key.
-
truncateMinute
Returns the date without truncating the minute.- Parameters:
date
- the date- Returns:
- same date with 0 seconds
-
getEmailOnlyUsers
Return the email addresses of email-only users identified by the custom field set within the Notification Mapping.- Returns:
- a set of all the email-only users email addresses.
-
getPeopleInvolved
Set<com.fasterxml.jackson.databind.JsonNode> getPeopleInvolved()Resolves the people involved in the issue according to the Notification Mapping configuration.- Returns:
- a set of
JsonNode
user objects
-
translateValue
It allows user to translate values that are in English by default. The key of the translation has the pattern fieldId.value.value.This is useful to translate Jira static values like Improvement, Task, Critical, Minor, etc.
If the translation is found, its value is used. Otherwise, the provided value.
issuetype.value.Improvement=Mejora
someFieldId.value.theValue=El Valor
- Parameters:
fieldId
- the field id.value
- the value.- Returns:
- the translated value or the value if there is no translation.
-
humanReadableByteCount
Transform bytes into a human-readable value in B, KB or MB depending on the input.- Parameters:
bytes
- the bytes- Returns:
- a human-readable string
-
randomUUID
String randomUUID()Generates a random UUID- Returns:
- a random string.
-
setReplyTo
Use this method do dynamically change the reply to email address.- Parameters:
replyTo
- an email address that will use as the reply to
-
isIssueCreatedByEmail
boolean isIssueCreatedByEmail(com.fasterxml.jackson.databind.JsonNode context) Evaluates if JEMHC created the issue in the event after processing an email. The method uses the issue's entity properties to know if the issue was created by JEMHC.- Parameters:
context
- the context with the issue- Returns:
- true if the issue was created by JEMHC from an email
-
getIssueProperty
- Parameters:
propertyKey
- the issue entity property key to get- Returns:
- the value of the issue entity property
- See Also:
-
log
Logs the message into the report.- Parameters:
message
- the message
-
isJsdApprover
boolean isJsdApprover()Use this method to determine if the current user is also a JSD approver on the issue.- Returns:
- a boolean value stating that the user is (or isn't) an approver on this issue.
-
isNewApprover
boolean isNewApprover()Use this method to see if the current user was added to the issue as an approver in this event.- Returns:
- a boolean value stating that the user is (or isn't) a newly added approver.
-
isNewRequestParticipant
boolean isNewRequestParticipant()Use this method to check if the current user was added as a request participant in this event.- Returns:
- a boolean value stating if the current user is (or isn't) a new request participant.
-
isJsdCustomer
boolean isJsdCustomer()Checks if the current user is a JSD customer- Returns:
- true if the user is a JSD customer, false if not.
-
isJsdProject
boolean isJsdProject()Check if the current project is a Service Desk project.- Returns:
- true if the current project is a service desk project, false if not.
-
getIssueViewUrl
String getIssueViewUrl()This method resolves the best Issue URL. The URL can either be the Jira issue URL e.g.https://mycompany.atlassian.net/browse/ABC-123
Portal Issue Url e.g.https://mycompany.atlassian.net/servicedesk/customer/portal/5555/ABC-123
If the current project is service desk and the user recipient is a customer, the portal url is returned. Otherwise, the standard Jira Issue Url- Returns:
- the jira or portal issue url.
-
getItemTo
Retrieve a changelogItems 'to' string value- Parameters:
item
- changelogItem JSONNode- Returns:
- to value of item
-
getItemToString
Retrieve a changelogItems 'toString' string value- Parameters:
item
- changelogItem JSONNode- Returns:
- toString value of item
-
getItemFrom
Retrieve a changelogItems 'toString' string value- Parameters:
item
- changelogItem JSONNode- Returns:
- toString value of item
-
getItemFromString
Retrieve a changelogItems 'fromString' string value- Parameters:
item
- changelogItem JSONNode- Returns:
- fromString value of item
-