public interface IJEMHVelocityContextUtils
Modifier and Type | Interface and Description |
---|---|
static class |
IJEMHVelocityContextUtils.AllowList |
static class |
IJEMHVelocityContextUtils.InlineImageEncodingType |
Modifier and Type | Field and Description |
---|---|
static String |
ADDITIONAL_ATTACHMENTS |
static String |
ADDITIONAL_CC |
static String |
ADDITIONAL_RECIPIENT_ADDRESS |
static String |
ADDITIONAL_TO |
static String |
X_JEMH_ADHOC_PREFIX
used to prefix mail header keys themselves, used to avoid conflicts for issue attributes
|
static String |
X_JEMH_RAW_PREFIX
unlike the above, this is only used to uniquely store 'raw' mail headers in the 'map' prior to application
|
Modifier and Type | Method and Description |
---|---|
void |
addIndividualRecipientAddress(String addressCsv)
* Adds an individual address to recipients list to a Non Jira User Template set in Non Jira user notification Project Mapping found in Notifications
|
void |
addIndividualRecipientGroup(String groupName)
Adds users in a Group to the recipients list to a Jira User Issue Event Template set in the Jira user notification Project Mapping found in Notifications
1
|
void |
addIndividualRecipientUser(String username)
Adds an individual user to recipients list to a Non Jira User Template found in the Non Jira user notification Project Mapping found in Notifications
|
void |
addMailHeader(String key,
String value)
Adds a mail header to the outgoing mail.
|
void |
addRawMailHeader(String key,
String value)
Adds a mail header that is not prefixed.
|
void |
addRecipientAddress(String recipientType,
String addressCsv)
Adds recipients through CSV SMTP address
|
void |
addRecipientGroup(String recipientType,
String groupName)
Adds recipients from a given Jira group
|
void |
addRecipientsFromRole(String recipientType,
String issueKey,
com.atlassian.jira.project.Project project,
String roleName)
Add recipients based on Role membership
|
String |
addStaticResourceAttachment(Integer id)
Add a global (unscoped) static resource by its Id.
|
String |
addStaticResourceAttachment(com.atlassian.jira.project.Project project,
Integer id)
Add a static resource (scoped to project) by its Id
|
javax.mail.internet.InternetAddress |
createInternetAddress(String personal,
String address)
Creates a new Internet address
|
Map<String,Object> |
createResultSet()
Enable scripts to create multiple issue,by creating an additional (possibly many) new result sets containing key/value paris as usual
|
void |
dropMessage(String reason)
During Script Field Processor handling of a message, allows a given message to be dropped immediately with no further processing
|
void |
filterMessage(String reason)
During Script Field Processor handling of a message, allows a given message to not be processed but filtered (like drop), here for completeness and differentation to drop
|
String |
filterText(String text) |
void |
forwardMessage(String reason)
During Script Field Processor handling of a message, allows a given message to not be processed but forwarded to the Profile defined 'Forward' user
|
Set<javax.mail.internet.InternetAddress> |
getAdditionalAddressRecipients()
Accessor for Set of additional Internet Addresses related to an email only user to be added to the recipient list
|
Set<String> |
getAdditionalRecipientGroups()
Accessor for Set of additional Internet Addresses related to a Jira user entity in a named Group to be added to the recipient list
|
Set<javax.mail.internet.InternetAddress> |
getAdditionalUserRecipients()
Accessor for Set of additional Internet Addresses related to a Jira user entity to be added to the recipient list
|
String |
getCalData()
Get the content of the text/calendar message part
|
javax.mail.internet.InternetAddress |
getCatchEmailAddress() |
Properties |
getCommentProperties(com.atlassian.jira.issue.comments.Comment comment)
Get comment properties
|
Map<String,Integer> |
getImageCidMap()
Internal use
|
String |
getInhibitSendingReason()
Gets the reason that was possibly set by the processing script why this message was inhibited for sending
|
com.atlassian.jira.issue.context.IssueContext |
getIssueContext(Long projectId,
String issueTypeId) |
IJEMHLdapVelocityContextUtil |
getLdap()
Create an Ldap helper that enables querying through LDAP configurations selected in the Profile
|
IJEMHLdapVelocityContextUtil |
getLdap(int ldapConfigId) |
com.atlassian.jira.util.I18nHelper |
getLocaleI18nBean(String localeIn)
Get a specific locale i18n helper
|
javax.mail.Message |
getMessage() |
String |
getMessageBody(javax.mail.Message message)
Get the body (according to htmL to wiki conversion configuration in the Profile)
|
String |
getMessagePartText(String contentType) |
List<javax.mail.Message> |
getMessageSubParts(javax.mail.internet.MimeMessage parentMessage)
Get the child attachment Parts that are message/rfc822
|
List<javax.mail.internet.InternetAddress> |
getOriginalAddressees(PreProcHeaderBean headerBean)
Returns list of the Internet Addresses from specific header
|
Map<String,List<String>> |
getParams()
Accessor for Map of value keys to list of values
|
IJEMHMessageFilterProvider.ProcessOutcome |
getProcessOutcome()
Accessor method to get script driven outcome of message processing that would override future processing/outcome.
|
com.atlassian.jira.issue.context.ProjectContext |
getProjectContext(Long projectId) |
String |
getRejectReason()
Get the message that may be set to describe why a message was rejected, ends up in audit record.
|
RequestTypeBean |
getRequestType(String requestTypeKey)
Returns a RequestTypeBean which holds properties of the Customer request type such as Name and Description
|
Collection<Map<String,Object>> |
getResultSets()
Accessor method to expose any additional ResultSets created by the script
|
TimeZone |
getTimeZone(String location) |
URI |
getUserAvatarURL(com.atlassian.jira.user.ApplicationUser user,
int size)
Enable the URI of a user avatar to be retrieved for inlining
|
com.atlassian.jira.user.ApplicationUser |
getUserByEmail(javax.mail.internet.InternetAddress address)
Helper method to get a User
|
com.atlassian.jira.user.ApplicationUser |
getUserByEmail(String emailStr)
Helper method to bet a User
|
String |
hash(String stringToEncrypt)
Function to allow hashing of arbitrary content, eg summary, eg description, for storing in custom fields, to potentially detect future resends of same content/description even after the initial issue was edited
|
boolean |
hasPermission(String permission,
com.atlassian.jira.issue.Issue issue,
com.atlassian.jira.user.ApplicationUser user)
Checks the permission scheme only to determine if the specified user has a particular project permission.
|
boolean |
hasWorkflowPermission(String permission,
com.atlassian.jira.issue.Issue issue,
com.atlassian.jira.user.ApplicationUser user)
Checks both the permission scheme and the issue's workflow properties to determine if the specified user has a
particular project permission.
|
com.atlassian.jira.util.json.JSONObject |
invokeLocalAnonRest(String path)
Make an anonymous HTTP request relative to the local Jira path
|
com.atlassian.jira.util.json.JSONObject |
invokeLocalRest(String path)
Make a HTTP request relative to the local Jira path
|
boolean |
isAttachmentPresent(javax.mail.Message message,
String filename)
Deprecated.
since 3.3.14 and will be removed, use
isAttachmentPresent(Message, String, boolean) instead |
boolean |
isAttachmentPresent(javax.mail.Message message,
String filename,
boolean isRegex) |
boolean |
isCustomFieldChanged(com.atlassian.jira.event.issue.IssueEvent issueEvent,
String cfId)
Used to determine during outbound processing, whether the given custom field id was in a ChildChangeItem of the event
|
boolean |
isInhibitSending()
determine if the outcome of the script is to inhibit sending of 'this' notification
|
boolean |
isPrivateJSDComment(com.atlassian.jira.user.ApplicationUser contextUser,
com.atlassian.jira.issue.comments.Comment c)
Helper method to determine if a comment is JSD private
|
boolean |
isPrivateJSDComment(com.atlassian.jira.mail.TemplateUser contextTemplateUser,
com.atlassian.jira.issue.comments.Comment c)
Helper method to determine if a comment is JSD private, which is required during actual mail sending
|
<T> T |
loadComponent(String interfaceOrClassName)
As the previous context $jirautils was removed for security reasons the loadComponent functionality may still be required.
|
void |
log(String msg)
Log an INFO message to the JEMH log file
|
void |
log(String level,
String msg)
Output a message to the JEMH log file
|
void |
rejectMessage(String reason)
During Script Field Processor handling of a message, allows a given message to be rejected to the initator, with the given reason
|
String |
renderStaticResourceImage(Integer id)
Render a given static resource image (unscoped) inline.
|
String |
renderStaticResourceImage(com.atlassian.jira.project.Project project,
Integer id)
Render a given static resource image (scoped to the given project) inline.
|
String |
renderStaticResourceImage(com.atlassian.jira.project.Project project,
Integer id,
String type)
Render a given static resource image (scoped to the given project) inline.
|
com.atlassian.jira.util.json.JSONObject |
request(Map<String,Object> options)
Perform a custom HTTP request
|
void |
setInhibitSending(boolean val)
Used during sending messages to inhibit sending, specifically needed due to split phase issue creation/update to enable ignoring ISSUE_CREATED events when JEMH has not yet added attachments to the issue, that are potentially required later.
|
void |
setInhibitSendingReason(String reason)
Sets a reason, retained in the audit entry to indicate why this message was inhibited for sending
|
PreProcHeaderBean |
updatePreProcHeader(List<javax.mail.internet.InternetAddress> addresses,
PreProcHeaderBean headerBean)
Updates specific header with the list of Internet addresses
|
void |
updatePreProcHeader(String newValue,
PreProcHeaderBean headerBean)
Updates specific header with the provided value
|
String |
urlencode(String incoming)
Helper method to urlencode(UTF-8) a string in Java context:
|
static final String X_JEMH_ADHOC_PREFIX
static final String X_JEMH_RAW_PREFIX
static final String ADDITIONAL_TO
static final String ADDITIONAL_CC
static final String ADDITIONAL_ATTACHMENTS
static final String ADDITIONAL_RECIPIENT_ADDRESS
String getCalData()
boolean isAttachmentPresent(javax.mail.Message message, String filename, boolean isRegex)
message
- the email message to look for attachments in (typically the 'message' script context variable)filename
- limits search to attachments with a matching filename, leave null to search for any attachmentisRegex
- whether the given filename String is to be considered a Regular Expression or not@Deprecated boolean isAttachmentPresent(javax.mail.Message message, String filename)
isAttachmentPresent(Message, String, boolean)
insteadmessage
- the email message to look for attachments in (typically the 'message' script context variable)filename
- limits search to attachments with a matching filename, leave null to search for any attachmentboolean hasWorkflowPermission(String permission, com.atlassian.jira.issue.Issue issue, com.atlassian.jira.user.ApplicationUser user)
permission
- the short name of a corresponding project permissionissue
- the target issueuser
- the user to check permissions forboolean hasPermission(String permission, com.atlassian.jira.issue.Issue issue, com.atlassian.jira.user.ApplicationUser user)
permission
- the short name of a corresponding project permissionissue
- the target issueuser
- the user to check permissions forTimeZone getTimeZone(String location)
location
- for which the timeZone is neededjavax.mail.internet.InternetAddress getCatchEmailAddress()
String filterText(String text)
text
- to Filters the input text through some Mime decodingvoid setInhibitSending(boolean val)
val,
- true to inhibitboolean isInhibitSending()
void setInhibitSendingReason(String reason)
reason
- as textString getInhibitSendingReason()
boolean isPrivateJSDComment(com.atlassian.jira.user.ApplicationUser contextUser, com.atlassian.jira.issue.comments.Comment c)
contextUser,
- the context for the questionc,
- related commentboolean isPrivateJSDComment(com.atlassian.jira.mail.TemplateUser contextTemplateUser, com.atlassian.jira.issue.comments.Comment c)
contextTemplateUser,
- the contextTemplateUser for the questionc,
- related commentProperties getCommentProperties(com.atlassian.jira.issue.comments.Comment comment)
comment
- to get properties ofvoid addMailHeader(String key, String value)
key
- text, all spaces in the value are removed, the result is prefixed by X-JEMH-ADHOC-value
- text, should be relatively short. We don't wrap or encode the data suppliedvoid addRawMailHeader(String key, String value)
key,
- usually of format X-something-elsevalue,
- text, should be relatively short. We don't wrap or encode the data suppliedvoid addRecipientsFromRole(String recipientType, String issueKey, com.atlassian.jira.project.Project project, String roleName)
issueKey
- eg ABC-123project
- from the issueroleName
- eg "Customers"recipientType
- eg "to" or "cc" (only)void addRecipientAddress(String recipientType, String addressCsv)
recipientType,
- valid values are to and ccaddressCsv,
- valid values are of format user@domain.com, NO Name parts are supported.void addRecipientGroup(String recipientType, String groupName)
recipientType,
- valid values are to and ccgroupName
- of Jira groupMap<String,List<String>> getParams()
Set<javax.mail.internet.InternetAddress> getAdditionalAddressRecipients()
Set<javax.mail.internet.InternetAddress> getAdditionalUserRecipients()
Set<String> getAdditionalRecipientGroups()
com.atlassian.jira.user.ApplicationUser getUserByEmail(javax.mail.internet.InternetAddress address)
address
- of the user as an InternetAddress objectcom.atlassian.jira.user.ApplicationUser getUserByEmail(String emailStr)
emailStr
- of the user as text in format user@domain.com, no Name part is supported.void dropMessage(String reason)
reason,
- a non empty value used in auditingvoid forwardMessage(String reason)
reason,
- a non empty value used in auditingvoid filterMessage(String reason)
reason,
- a non empty value used in auditingvoid rejectMessage(String reason)
reason,
- a non empty value used in auditingIJEMHMessageFilterProvider.ProcessOutcome getProcessOutcome()
String getRejectReason()
com.atlassian.jira.util.I18nHelper getLocaleI18nBean(String localeIn)
localeIn
- the localeString addStaticResourceAttachment(Integer id)
id,
- numeric ID of the Static ResourceString addStaticResourceAttachment(com.atlassian.jira.project.Project project, Integer id)
project,
- the project in which the Static Resource has been scopedid,
- numeric ID of the Static ResourceString renderStaticResourceImage(Integer id)
id,
- numeric ID of the Static ResourceString renderStaticResourceImage(com.atlassian.jira.project.Project project, Integer id)
project,
- the project in which the Static Resource image is scopedid,
- numeric ID of the Static ResourceString renderStaticResourceImage(com.atlassian.jira.project.Project project, Integer id, String type)
project,
- the project in which the Static Resource image is scopedid,
- numeric ID of the Static Resourcetype,
- "cid" is the new default, "base64" (inline encoded data) is also validMap<String,Integer> getImageCidMap()
boolean isCustomFieldChanged(com.atlassian.jira.event.issue.IssueEvent issueEvent, String cfId)
issueEvent
- involvedcfId,
- custom field id, of format, customfield_12345String urlencode(String incoming)
incoming
- valuecom.atlassian.jira.util.json.JSONObject request(Map<String,Object> options)
options
- a Map
containing the configuration options for this HTTP request
String
- the absolute (full) request URLString
- the request method to use. GET is default.String
- username of the user to perform the request asString
or Integer
- connection timeout in millisecondsString
- JSON data for request body. Appended to URL for GET requests. In JavaScript
JSON.stringify(data)can be used to convert JSON/Object to String
JSONObject
containing the responsecom.atlassian.jira.util.json.JSONObject invokeLocalRest(String path)
path
- of local rest call, relative to Jira's base URLJSONObject
containing the response body (if present)com.atlassian.jira.util.json.JSONObject invokeLocalAnonRest(String path) throws com.atlassian.jira.util.json.JSONException
path
- of local rest call, relative to Jira's base URLJSONObject
containing the response body (if present)com.atlassian.jira.util.json.JSONException
- if it breaksString hash(String stringToEncrypt) throws NoSuchAlgorithmException, UnsupportedEncodingException
stringToEncrypt
- eg summary / bodyNoSuchAlgorithmException
- if it breaksUnsupportedEncodingException
- if it breaksMap<String,Object> createResultSet()
Collection<Map<String,Object>> getResultSets()
void log(String level, String msg)
level
- the log level for the output: DEBUG, INFO, WARN, ERRORmsg
- the message to logvoid log(String msg)
msg
- the message to logjavax.mail.Message getMessage()
List<javax.mail.Message> getMessageSubParts(javax.mail.internet.MimeMessage parentMessage)
parentMessage
- the Mime messageString getMessageBody(javax.mail.Message message)
message
- sourceIJEMHLdapVelocityContextUtil getLdap()
IJEMHLdapVelocityContextUtil getLdap(int ldapConfigId)
URI getUserAvatarURL(com.atlassian.jira.user.ApplicationUser user, int size)
user
- user to get avatar forsize
- size of avatar to getcom.atlassian.jira.issue.context.ProjectContext getProjectContext(Long projectId)
com.atlassian.jira.issue.context.IssueContext getIssueContext(Long projectId, String issueTypeId)
void addIndividualRecipientAddress(String addressCsv)
addressCsv,
- valid values are of format user@domain.com, NO Name parts are supported.void addIndividualRecipientUser(String username)
username,
- user to entity to be notified in a Jira User Issue Event Template Set.void addIndividualRecipientGroup(String groupName)
groupName,
- user Group to entity to be notified in a Jira User Issue Event Template Set.List<javax.mail.internet.InternetAddress> getOriginalAddressees(PreProcHeaderBean headerBean)
headerBean,
- the value of the desired headerjavax.mail.internet.InternetAddress createInternetAddress(String personal, String address)
personal,
- personal nameaddress,
- email addressPreProcHeaderBean updatePreProcHeader(List<javax.mail.internet.InternetAddress> addresses, PreProcHeaderBean headerBean)
addresses,
- list of the internet addressesheaderBean,
- specific headervoid updatePreProcHeader(String newValue, PreProcHeaderBean headerBean)
newValue,
- valueheaderBean,
- specific headerRequestTypeBean getRequestType(String requestTypeKey)
requestTypeKey,
- the value of the desired request type<T> T loadComponent(String interfaceOrClassName)
T
- the type of the componentinterfaceOrClassName,
- the class name or interface name of the component desired for example class name = [com.atlassian.jira.mention.MentionFinderImpl] interface name = [MentionFinder]Copyright © 2008–2022 The Plugin People. All rights reserved.