@NotThreadSafe @PublicSpi public class JiraWebActionSupport extends webwork.action.ActionSupport implements webwork.action.CommandDriven, I18nHelper, ErrorCollection, AuthorizationSupport, HttpServletVariables
Modifier and Type | Class and Description |
---|---|
static class |
JiraWebActionSupport.MessageType
Represents a type of message that the browser will display after the next page load.
|
I18nHelper.BeanFactory
ErrorCollection.Reason
Modifier and Type | Field and Description |
---|---|
static String |
ISSUE_NOT_FOUND_RESULT |
protected org.apache.log4j.Logger |
log |
static String |
PERMISSION_VIOLATION_RESULT |
protected javax.servlet.http.HttpServletRequest |
request
Deprecated.
since 6.0 - use
getHttpRequest() instead. |
static String |
RETURN_URL_PARAMETER |
protected Collection |
savedFilters |
static String |
SECURITY_BREACH_RESULT |
Constructor and Description |
---|
JiraWebActionSupport() |
Modifier and Type | Method and Description |
---|---|
void |
addError(String field,
String message,
ErrorCollection.Reason reason)
Add a field-specific error message.
|
void |
addErrorCollection(ErrorCollection errors)
Populate this ErrorCollection with general and field-specific errors.
|
void |
addErrorMessage(String message,
ErrorCollection.Reason reason)
Add error message relating to system state (not field-specific), and a reason.
|
protected void |
addErrorMessageByKeyIfAbsent(String errorMsgKey) |
protected void |
addErrorMessageIfAbsent(String errorMsg) |
void |
addErrorMessages(webwork.dispatcher.ActionResult aResult) |
void |
addErrorMessages(Collection<String> errorMessages)
Append new error messages to those already collected.
|
void |
addErrors(Map<String,String> errors)
Append new field-specific errors to those already collected.
|
void |
addIllegalArgumentException(String fieldName,
IllegalArgumentException e)
Override this method from ActionSupport.
|
protected void |
addMessageToResponse(String msg,
String type,
boolean closeable,
String target)
This will populate the the custom Atlassian header with the details of a pop-up message.
|
void |
addReason(ErrorCollection.Reason reason)
Add a reason why the function has not been performed.
|
void |
addReasons(Set<ErrorCollection.Reason> reasons)
Add reasons why the function has not been performed.
|
boolean |
checkIfUrlIsAllowed(String url) |
String |
execute() |
protected String |
forceRedirect(String redirect)
This method will force a server redirect, with no security checks.
|
String |
getActionName() |
String |
getAdministratorContactLink()
Get the link, with Internationalised text for contacting the administrators of JIRA.
|
ApplicationProperties |
getApplicationProperties() |
protected AuthorizationSupport |
getAuthorizationSupport() |
protected <T> T |
getComponentInstanceOfType(Class<T> clazz)
This can be called to get a component from the
ComponentAccessor . |
String |
getConglomerateCookieValue(String cookieName,
String key)
Retrieve the value from a conglomerate Cookie from the request.
|
ConstantsManager |
getConstantsManager() |
String |
getDateFormat() |
String |
getDateTimeFormat() |
DateTimeFormatter |
getDateTimeFormatter()
Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone using
DateTimeStyle.RELATIVE . |
ResourceBundle |
getDefaultResourceBundle()
Returns the default
ResourceBundle within JIRA, which does not include translations provided by plugins. |
String |
getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
Deprecated.
Use
ConstantsManager instead. Since v6.0. |
String |
getDescTranslation(IssueConstant issueConstant)
Deprecated.
Use
ConstantsManager instead. Since v6.0. |
DateTimeFormatter |
getDmyDateFormatter()
Returns a DateTimeFormatter that can be used to format dates in the user's time zone using
DateTimeStyle.DATE . |
String |
getEmptyResponse()
Returns an empty response code (204)
|
Collection<String> |
getErrorMessages()
Get all non field-specific error messages.
|
Map<String,String> |
getErrors()
Get all field-specific errors.
|
Field |
getField(String id) |
Collection<String> |
getFlushedErrorMessages()
Get error messages, then get rid of them.
|
protected GlobalPermissionManager |
getGlobalPermissionManager() |
Hint |
getHint(String context) |
protected HintManager |
getHintManager() |
javax.servlet.http.HttpServletRequest |
getHttpRequest() |
javax.servlet.http.HttpServletResponse |
getHttpResponse() |
javax.servlet.http.HttpSession |
getHttpSession() |
protected I18nHelper |
getI18nHelper() |
JiraContactHelper |
getJiraContactHelper() |
JiraServiceContext |
getJiraServiceContext()
Provides a service context with the current user which contains this action as its
ErrorCollection . |
Set<String> |
getKeysForPrefix(String prefix)
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.
|
String |
getLanguage() |
Locale |
getLocale() |
ApplicationUser |
getLoggedInApplicationUser()
Deprecated.
Use
getLoggedInUser() . Since v7.0 |
ApplicationUser |
getLoggedInUser() |
String |
getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
Deprecated.
Use
ConstantsManager instead. Since v6.0. |
String |
getNameTranslation(IssueConstant issueConstant)
Deprecated.
Use
ConstantsManager instead. Since v6.0. |
OfBizDelegator |
getOfBizDelegator() |
OutlookDate |
getOutlookDate()
Deprecated.
Use
getDateTimeFormatter() instead. Since v5.0. |
protected PermissionManager |
getPermissionManager() |
ProjectManager |
getProjectManager() |
Hint |
getRandomHint() |
Set<ErrorCollection.Reason> |
getReasons()
A set of well known reasons why the function has not been performed.
|
String |
getRedirect(String defaultUrl)
Redirects to the value of
getReturnUrl() , falling back to defaultUrl if the returnUrl is
not set. |
String |
getRedirect(String defaultUrl,
boolean allowUnsafeRedirect)
Redirects to the value of
getReturnUrl() , falling back to defaultUrl if the returnUrl is
not set. |
protected RedirectSanitiser |
getRedirectSanitiser()
Returns a RedirectSanitiser implementation.
|
RequestSourceType |
getRequestSourceType()
Returns an enum type representing how the action was invoked.
|
ResourceBundle |
getResourceBundle()
Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.
|
String |
getResult()
Get a definitive result.
|
String |
getReturnUrl() |
String |
getReturnUrlForCancelLink()
The cancel links should not included the selectedIssueId, otherwise when returning to the issue navigator an
issue updated notification will be shown.
|
List<String> |
getSearchSortDescriptions(SearchRequest searchRequest) |
Project |
getSelectedProject()
Gets the last viewed project that the user visited and still has permission to see.
|
Project |
getSelectedProjectObject()
Gets the last viewed project that the user visited and still has permission to see.
|
String |
getServerId() |
javax.servlet.ServletContext |
getServletContext() |
String |
getText(String key)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object parameters)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found.
|
String |
getText(String key,
Object value1,
Object value2,
Object value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6,
Object value7)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
Object value1,
Object value2,
Object value3,
Object value4,
Object value5,
Object value6,
Object value7,
Object value8)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4,
String value5,
String value6,
String value7)
Called to return the formatted text of the specified i18n key
|
String |
getText(String key,
String value1,
String value2,
String value3,
String value4,
String value5,
String value6,
String value7,
String value8,
String value9)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getTimeFormat() |
String |
getUnescapedText(String key)
Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found
|
String |
getUntransformedRawText(String key)
Same as
I18nHelper.getUnescapedText(String) but does not apply any TranslationTransform s. |
UriValidator |
getUriValidator() |
String |
getUserFullName(String username) |
UserManager |
getUserManager() |
com.atlassian.core.user.preferences.Preferences |
getUserPreferences() |
protected UserProjectHistoryManager |
getUserProjectHistoryManager() |
VersionManager |
getVersionManager() |
String |
getWebworkStack()
For debugging JSPs; prints the webwork stack.
|
String |
getWebworkStack(String selected)
For debugging JSPs; prints the webwork stack, highlighting the specified node.
|
String |
getXsrfToken() |
boolean |
hasAnyErrors()
Whether any errors (of any type - field-specific or otherwise) have been collected.
|
protected boolean |
hasErrorMessage(String errorMsg) |
protected boolean |
hasErrorMessageByKey(String errorMsgKey) |
boolean |
hasGlobalPermission(GlobalPermissionKey globalPermissionKey)
Returns true if the logged in user has the given global permission.
|
boolean |
hasGlobalPermission(String permissionKey)
Returns true if the logged in user has the given global permission.
|
boolean |
hasIssuePermission(int permissionsId,
Issue issue)
Returns true if the logged in user has the given permission type on the given Issue.
|
boolean |
hasIssuePermission(ProjectPermissionKey projectPermissionKey,
Issue issue)
Returns true if the logged in user has the given permission on the given Issue.
|
boolean |
hasIssuePermission(String permissionKey,
Issue issue)
Returns true if the logged in user has the given permission type on the given Issue.
|
boolean |
hasPermission(int permissionsId)
Deprecated.
Use
hasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey) instead. Since v6.4. |
boolean |
hasProjectPermission(int permissionsId,
Project project)
Deprecated.
|
boolean |
hasProjectPermission(ProjectPermissionKey projectPermissionKey,
Project project)
Returns true if the logged in user has the given permission on the given project.
|
String |
htmlEncode(String encodeMe)
Convenience instance method to call static utility from webwork EL.
|
protected String |
insertContextPath(String url)
Prepends the context path to the URL if it begins with a forward slash (this is commonly used for redirects
within a JIRA instance).
|
boolean |
isAdministrator() |
boolean |
isIndexing() |
boolean |
isInlineDialogMode()
This returns true if the action has been invoked as an inline dialog.
|
boolean |
isKeyDefined(String key)
For the given key, checks whether such a key is defined in the locale context represented by this helper
instance.
|
boolean |
isSystemAdministrator() |
boolean |
isUserExists(String username)
Deprecated.
Use
isUserExistsByName(String) or isUserExistsByKey(String) instead, as appropriate. Since v6.0. |
boolean |
isUserExistsByKey(String userkey) |
boolean |
isUserExistsByName(String username) |
protected void |
removeKeyOrAddError(Map params,
String key,
String messageKey)
Checks if descriptorParams contains key and removes it, otherwise adds the error message with the given message
key.
|
String |
returnComplete() |
String |
returnComplete(String url) |
protected String |
returnCompleteWithInlineRedirect(String url)
This will return success response with body containing url to redirect.
|
protected String |
returnCompleteWithInlineRedirectAndMsg(String url,
String msg,
JiraWebActionSupport.MessageType type,
boolean closeable,
String target)
This will redirect like
returnCompleteWithInlineRedirect(String) , and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. |
protected String |
returnCompleteWithInlineRedirectAndMsg(String url,
String msg,
String type,
boolean closeable,
String target)
Deprecated.
since 5.1. Use
returnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String)
instead. |
protected String |
returnMsgToUser(String url,
String msg,
JiraWebActionSupport.MessageType type,
boolean closeable,
String target)
This will redirect like
returnComplete() , and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. |
protected String |
returnMsgToUser(String url,
String msg,
String type,
boolean closeable,
String target)
Deprecated.
since 5.1. Use
returnMsgToUser(String, String, MessageType, boolean, String) instead. |
void |
setConglomerateCookieValue(String cookieName,
String key,
String value)
Set the value key/value pair in a conglomerate Cookie.
|
void |
setInline(boolean inline)
This is the web parameter setter for invoking an action as an inline dialog
|
void |
setReasons(Set<ErrorCollection.Reason> reasons)
Set reasons why the function has not been performed.
|
void |
setReturnUrl(String returnUrl) |
void |
setSelectedProjectId(Long id) |
protected void |
tagMauEventWithApplication(MauApplicationKey applicationKey) |
protected void |
tagMauEventWithProject(Project project) |
String |
urlEncode(String encode)
Encodes the given string into
application/x-www-form-urlencoded format, using the JIRA encoding scheme to
obtain the bytes for unsafe characters. |
addError, addErrorMessage, doDefault, doExecute, doValidation, getCommandName, getHasErrorMessages, getHasErrors, getPropertyEditorMessage, getTexts, getTexts, getTimezone, invalidInput, invokeCommand, isCommand, setCommand, setErrorMessages, setErrors, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addError, addErrorMessage, setErrorMessages
protected final org.apache.log4j.Logger log
public static final String RETURN_URL_PARAMETER
public static final String PERMISSION_VIOLATION_RESULT
public static final String SECURITY_BREACH_RESULT
public static final String ISSUE_NOT_FOUND_RESULT
protected javax.servlet.http.HttpServletRequest request
getHttpRequest()
instead.HttpServletVariables.getHttpRequest()
protected Collection savedFilters
@IncompatibleReturnType(since="7.0", was="com.atlassian.crowd.embedded.api.User") public ApplicationUser getLoggedInUser()
@Deprecated public ApplicationUser getLoggedInApplicationUser()
getLoggedInUser()
. Since v7.0public String getXsrfToken()
public javax.servlet.http.HttpServletRequest getHttpRequest()
getHttpRequest
in interface HttpServletVariables
HttpServletRequest
in playHttpServletVariables.getHttpRequest()
public javax.servlet.http.HttpSession getHttpSession()
getHttpSession
in interface HttpServletVariables
HttpSession
in playHttpServletVariables.getHttpSession()
public javax.servlet.http.HttpServletResponse getHttpResponse()
getHttpResponse
in interface HttpServletVariables
HttpServletResponse
in playHttpServletVariables.getHttpResponse()
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface HttpServletVariables
ServletContext
of the JIRA web applicationHttpServletVariables.getServletContext()
public ApplicationProperties getApplicationProperties()
public UriValidator getUriValidator()
protected GlobalPermissionManager getGlobalPermissionManager()
protected PermissionManager getPermissionManager()
protected UserProjectHistoryManager getUserProjectHistoryManager()
public ConstantsManager getConstantsManager()
public ProjectManager getProjectManager()
public VersionManager getVersionManager()
@Deprecated public OutlookDate getOutlookDate()
getDateTimeFormatter()
instead. Since v5.0.public DateTimeFormatter getDateTimeFormatter()
DateTimeStyle.RELATIVE
.public DateTimeFormatter getDmyDateFormatter()
DateTimeStyle.DATE
.public JiraContactHelper getJiraContactHelper()
public UserManager getUserManager()
public String getAdministratorContactLink()
JiraContactHelper#getAdministratorContactLinkHtml(String, com.atlassian.jira.util.I18nHelper)}
protected final HintManager getHintManager()
protected AuthorizationSupport getAuthorizationSupport()
public String getRedirect(String defaultUrl)
getReturnUrl()
, falling back to defaultUrl
if the returnUrl
is
not set. This method clears the returnUrl
. If there are any errors, this method returns "ERROR". If no errors
are reported, NONE is returned. If this method is called as if it were non-web, it returns SUCCESS.
If the URL starts with '/' it is interpreted as context-relative.
RedirectSanitiser.makeSafeRedirectUrl(String)
. Use getRedirect(String, boolean)
to allow unsafe
redirects for URLs that do not contain possibly malicious user input.defaultUrl
- default URL to redirect toAction
getRedirect(String, boolean)
public String getRedirect(String defaultUrl, boolean allowUnsafeRedirect)
getReturnUrl()
, falling back to defaultUrl
if the returnUrl
is
not set. This method clears the returnUrl
. If there are any errors, this method returns "ERROR". If no errors
are reported, NONE is returned. If this method is called as if it were non-web, it returns SUCCESS. If the URL
starts with '/' it is interpreted as context-relative.
If allowUnsafeRedirect
is true, this method will not perform validation on the value of returnUrl
or defaultUrl
. This can introduce serious security problems, so use with care. In particular, you
should only use use this method if defaultUrl
has already been sanitised (via whitelisting).
It might ServletForwarder.forwardSafely(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.net.URI)
instead of redirecting.
If blocked by any exported ForwardAuthorizer
OSGi service, it will fall back to redirecting.defaultUrl
- default URL to redirect toallowUnsafeRedirect
- whether to allow unsafe redirects (e.g. javascript:
or off-site URLs).Action
forceRedirect(String)
,
ServletForwarder.forwardSafely(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.net.URI)
,
ForwardAuthorizer
protected String forceRedirect(String redirect)
getRedirect(String)
, which checks that
the redirect URL is safe.redirect
- redirect URLAction.NONE
. It'll just redirect to where you've specifiedgetRedirect(String)
public boolean hasPermission(int permissionsId)
hasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead. Since v6.4.hasPermission
in interface AuthorizationSupport
permissionsId
- the permission typepublic boolean hasGlobalPermission(GlobalPermissionKey globalPermissionKey)
AuthorizationSupport
This method is intended to be used in Java code. If you are using JSP / Velocity / Soy Templates, it is
probably easier to call AuthorizationSupport.hasGlobalPermission(String)
instead.
hasGlobalPermission
in interface AuthorizationSupport
globalPermissionKey
- the permission to checkAuthorizationSupport.hasGlobalPermission(String)
public boolean hasGlobalPermission(String permissionKey)
AuthorizationSupport
This method is intended to be used in JSP / Velocity / Soy Templates. If you are using Java directly, it is
recommended to call AuthorizationSupport.hasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead.
Note that this method takes a Global Permission Key, which is a different value to the old "permission name"
that some previous methods would accept - see GlobalPermissionKey
for correct values of the system
permissions.
hasGlobalPermission
in interface AuthorizationSupport
permissionKey
- the permission to checkAuthorizationSupport.hasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey)
public boolean hasIssuePermission(String permissionKey, Issue issue)
AuthorizationSupport
This method is intended for use in Velocity templates / JSPs etc. Within Java code you should prefer the method that takes a ProjectPermissionKey.
Note that this method takes a Permission Key, which is a different value to the old "permission name" that
some previous methods would accept - see ProjectPermissions
for correct
values of the system permissions.
hasIssuePermission
in interface AuthorizationSupport
permissionKey
- the permission key as a Stringissue
- the IssueAuthorizationSupport.hasIssuePermission(com.atlassian.jira.security.plugin.ProjectPermissionKey, com.atlassian.jira.issue.Issue)
public boolean hasIssuePermission(int permissionsId, Issue issue)
AuthorizationSupport
hasIssuePermission
in interface AuthorizationSupport
permissionsId
- the permission typeissue
- the Issuepublic boolean hasIssuePermission(ProjectPermissionKey projectPermissionKey, Issue issue)
AuthorizationSupport
hasIssuePermission
in interface AuthorizationSupport
projectPermissionKey
- the permission to checkissue
- the IssueAuthorizationSupport.hasIssuePermission(String, com.atlassian.jira.issue.Issue)
public boolean hasProjectPermission(int permissionsId, Project project)
hasProjectPermission(com.atlassian.jira.security.plugin.ProjectPermissionKey, com.atlassian.jira.project.Project)
instead. Since v6.4.hasProjectPermission
in interface AuthorizationSupport
permissionsId
- the permission typeproject
- the Projectpublic boolean hasProjectPermission(ProjectPermissionKey projectPermissionKey, Project project)
AuthorizationSupport
hasProjectPermission
in interface AuthorizationSupport
projectPermissionKey
- the permission to checkproject
- the projectpublic boolean isSystemAdministrator()
public boolean isAdministrator()
@Deprecated public boolean isUserExists(String username)
isUserExistsByName(String)
or isUserExistsByKey(String)
instead, as appropriate. Since v6.0.isUserExistsByName(String)
username
- the username to checktrue
if the username is associated with an existing user; false
otherwisepublic boolean isUserExistsByName(String username)
public boolean isUserExistsByKey(String userkey)
public void addErrorCollection(ErrorCollection errors)
ErrorCollection
addErrorCollection
in interface ErrorCollection
errors
- ErrorCollection whose errors/messages we obtain.public void addError(String field, String message, ErrorCollection.Reason reason)
ErrorCollection
addError
in interface ErrorCollection
field
- Field name, eg. "assignee"message
- Error message.reason
- Reason for the error.public void addErrorMessage(String message, ErrorCollection.Reason reason)
ErrorCollection
addErrorMessage
in interface ErrorCollection
message
- Error message.reason
- Reason for the error.public void addReason(ErrorCollection.Reason reason)
ErrorCollection
addReason
in interface ErrorCollection
reason
- a well known reasons why the function has not been performed.public void addReasons(Set<ErrorCollection.Reason> reasons)
ErrorCollection
addReasons
in interface ErrorCollection
reasons
- a set of well known reasons why the function has not been performed.public void setReasons(Set<ErrorCollection.Reason> reasons)
ErrorCollection
setReasons
in interface ErrorCollection
reasons
- a set of well known reasons why the function has not been performed.public Set<ErrorCollection.Reason> getReasons()
ErrorCollection
getReasons
in interface ErrorCollection
public List<String> getSearchSortDescriptions(SearchRequest searchRequest)
public String getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
ConstantsManager
instead. Since v6.0.public String getNameTranslation(IssueConstant issueConstant)
ConstantsManager
instead. Since v6.0.public String getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
ConstantsManager
instead. Since v6.0.public String getDescTranslation(IssueConstant issueConstant)
ConstantsManager
instead. Since v6.0.public String getReturnUrl()
public String getReturnUrlForCancelLink()
public void setReturnUrl(String returnUrl)
public Collection<String> getFlushedErrorMessages()
ErrorCollection
getFlushedErrorMessages
in interface ErrorCollection
public String getLanguage() throws IOException
IOException
public Project getSelectedProject()
UserProjectHistoryManager.getCurrentProject(int, ApplicationUser)
public Project getSelectedProjectObject()
getSelectedProject()
UserProjectHistoryManager.getCurrentProject(int, ApplicationUser)
public void setSelectedProjectId(Long id)
public String getDateFormat()
public String getDateTimeFormat()
public String getTimeFormat()
public String getWebworkStack(String selected)
selected
- selected value in the webwork stackpublic String getWebworkStack()
public String getServerId()
public JiraServiceContext getJiraServiceContext()
ErrorCollection
.public String htmlEncode(String encodeMe)
encodeMe
- a String to be HTML encoded.public String urlEncode(String encode)
application/x-www-form-urlencoded
format, using the JIRA encoding scheme to
obtain the bytes for unsafe characters.encode
- the String to encodeURLEncoder.encode(String, String)
public boolean isInlineDialogMode()
public RequestSourceType getRequestSourceType()
RequestSourceType
public void setInline(boolean inline)
inline
- true if the action should act as an inline dialogpublic String returnComplete()
public boolean checkIfUrlIsAllowed(String url)
public String getEmptyResponse()
protected final String returnCompleteWithInlineRedirect(String url)
url
- URL to redirect toprotected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target)
returnCompleteWithInlineRedirect(String)
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.url
- URL to redirect tomsg
- message HTMLtype
- type of message.closeable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spotprotected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, String type, boolean closeable, @Nullable String target)
returnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String)
instead.returnCompleteWithInlineRedirect(String)
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.url
- URL to redirect tomsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot@Deprecated protected String returnMsgToUser(String url, String msg, String type, boolean closeable, @Nullable String target)
returnMsgToUser(String, String, MessageType, boolean, String)
instead.returnComplete()
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spotprotected String returnMsgToUser(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target)
returnComplete()
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of messagecloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spotprotected String insertContextPath(String url)
url
- a String containing a URLprotected void addMessageToResponse(String msg, String type, boolean closeable, String target)
msg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot.protected final boolean hasErrorMessage(String errorMsg)
protected final boolean hasErrorMessageByKey(String errorMsgKey)
protected final void addErrorMessageIfAbsent(String errorMsg)
protected final void addErrorMessageByKeyIfAbsent(String errorMsgKey)
protected void tagMauEventWithApplication(@Nonnull MauApplicationKey applicationKey)
protected void tagMauEventWithProject(Project project)
public final Hint getRandomHint()
public String getConglomerateCookieValue(String cookieName, String key)
cookieName
- The name of the conglomerate cookiekey
- The key of the valuepublic void setConglomerateCookieValue(String cookieName, String key, String value)
cookieName
- The name of the conglomerate cookiekey
- The key of the valuevalue
- The value@Nonnull protected final RedirectSanitiser getRedirectSanitiser()
public Collection<String> getErrorMessages()
ErrorCollection
getErrorMessages
in interface ErrorCollection
getErrorMessages
in class webwork.action.ActionSupport
public Map<String,String> getErrors()
ErrorCollection
getErrors
in interface ErrorCollection
getErrors
in class webwork.action.ActionSupport
public Set<String> getKeysForPrefix(String prefix)
I18nHelper
getKeysForPrefix
in interface I18nHelper
prefix
- The prefix for i18n keys. May not be nullpublic ResourceBundle getDefaultResourceBundle()
I18nHelper
ResourceBundle
within JIRA, which does not include translations provided by plugins.
For use cases where non-English translations are required, call I18nHelper.getResourceBundle()
instead.getDefaultResourceBundle
in interface I18nHelper
I18nHelper.getResourceBundle()
public String getUnescapedText(String key)
I18nHelper
getUnescapedText
in interface I18nHelper
key
- the key of the i18n messagepublic String getUntransformedRawText(String key)
I18nHelper
I18nHelper.getUnescapedText(String)
but does not apply any TranslationTransform
s.getUntransformedRawText
in interface I18nHelper
key
- the key of the i18n messagepublic boolean isKeyDefined(String key)
I18nHelper
For the given key, checks whether such a key is defined in the locale context represented by this helper instance. Note that the actual translation may be in the 'fallback' default locale rather than the current locale.
The contract of this is method is correlated with I18nHelper.getUntransformedRawText(String)
, whereby if this
method returns false
, I18nHelper.getUntransformedRawText(String)
will return the key provided as an
argument, and if this method returns true
, I18nHelper.getUntransformedRawText(String)
will generally
return the translation, which in some very unlikely cases may be equal to the key.
isKeyDefined
in interface I18nHelper
key
- translation keytrue
, if any translation for such key exists, false
otherwisepublic ResourceBundle getResourceBundle()
I18nHelper
getResourceBundle
in interface I18nHelper
I18nHelper.getDefaultResourceBundle()
public String getText(String key)
I18nHelper
getText
in interface I18nHelper
getText
in class webwork.action.ActionSupport
key
- the key of the i18n messagepublic String getText(String key, String value1)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagepublic String getText(String key, String value1, String value2)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagepublic String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7, Object value8)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagevalue8
- a value to be substituted into the messagepublic String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9)
I18nHelper
getText
in interface I18nHelper
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagevalue8
- a value to be substituted into the messagevalue9
- a value to be substituted into the messagepublic String getText(String key, Object parameters)
I18nHelper
The object passed in can be an array, a List
} or a single parameter object. It will be then
used as substitution parameters within the message.
getText
in interface I18nHelper
key
- the key of the i18n messageparameters
- This can be an Array, a List
and Array or a single object parameterpublic com.atlassian.core.user.preferences.Preferences getUserPreferences()
protected I18nHelper getI18nHelper()
I18nHelper
associated with this actionpublic Locale getLocale()
getLocale
in interface I18nHelper
getLocale
in class webwork.action.ActionSupport
Locale
that is associated with this I18nHelperpublic boolean isIndexing()
protected void removeKeyOrAddError(Map params, String key, String messageKey)
params
- the map of parameterskey
- the param key to remove.messageKey
- the error.public String execute() throws Exception
execute
in interface webwork.action.Action
execute
in class webwork.action.ActionSupport
Exception
public final String getActionName()
getActionName
in class webwork.action.ActionSupport
public String getResult()
Action.ERROR
if there are error messages, otherwise
Action.SUCCESS
.Action.ERROR
or Action.SUCCESS
public void addErrorMessages(Collection<String> errorMessages)
ErrorCollection
addErrorMessages
in interface ErrorCollection
errorMessages
- Collection of error strings.public void addErrors(Map<String,String> errors)
ErrorCollection
addErrors
in interface ErrorCollection
errors
- of String: String pairs, eg. {"assignee": "Assignee is required"}public boolean hasAnyErrors()
ErrorCollection
hasAnyErrors
in interface ErrorCollection
public void addErrorMessages(webwork.dispatcher.ActionResult aResult)
public void addIllegalArgumentException(String fieldName, IllegalArgumentException e)
addIllegalArgumentException
in interface webwork.action.IllegalArgumentAware
addIllegalArgumentException
in class webwork.action.ActionSupport
public OfBizDelegator getOfBizDelegator()
protected <T> T getComponentInstanceOfType(Class<T> clazz)
ComponentAccessor
. Override this if you
wish to change this behaviour say in unit tests.clazz
- the component class in questionCopyright © 2002-2024 Atlassian. All Rights Reserved.