com.atlassian.jira.web.action
Class JiraWebActionSupport

java.lang.Object
  extended by webwork.action.ActionSupport
      extended by com.atlassian.jira.action.JiraActionSupport
          extended by com.atlassian.jira.web.action.JiraWebActionSupport
All Implemented Interfaces:
ErrorCollection, I18nHelper, HttpServletVariables, AuthorizationSupport, Serializable, webwork.action.Action, webwork.action.CommandDriven, webwork.action.IllegalArgumentAware
Direct Known Subclasses:
AboutPage, AbstractConfigureFieldLayout, AbstractConstantAction, AbstractConvertIssue, AbstractDashboardAdministration, AbstractEditConfigurationItemAction, AbstractEditFieldLayoutItem, AbstractEditFieldLayoutSchemeAction, AbstractFieldLayoutAction, AbstractFieldScreenAction, AbstractFieldScreenSchemeAction, AbstractManageIssueTypeOptionsAction, AbstractProjectImportProgress, AbstractProjectImportUsersMissing, AbstractProjectRole, AbstractRoleActorAction, AbstractRoleActors, AbstractSchemeAware, AbstractSchemeAwareAction, AbstractSchemeToolAction, AbstractSetupAction, AbstractTrustedApplicationAction, AbstractWorkflowAction, AbstractWorkflowDraftResultAction, AcknowledgeTask, AddFieldConfiguration, AddFieldConfigurationScheme, AddIssueTypeScreenScheme, AddIssueTypeScreenScreenSchemeAssociation, AddIssueTypeToFieldConfigurationAssociation, AddNewIssueTypeToScheme, AddPortalPage, AddUser, AdjustFavourite, AdvancedApplicationProperties, AllUsersRememberMeCookies, AssociateFieldToScreens, BrowseProjects, BulkEditUserGroups, CantBrowseCreatedIssue, ChangePassword, CleanData, ClearRememberMeCookies, CloneWorkflow, ConfigureCrowdServer, ConfigureCustomField, ConfigureFieldLayoutScheme, ConfigureFieldScreen, ConfigureIssueTypeScreenScheme, ConfigurePortalPages, ConfirmNewInstallationWithOldLicense, ContactAdministrators, CreateDraftWorkflow, CurrentUsersList, Dashboard, DeleteCustomField, DeleteJobRunner, DeleteLinkType, DeletePortalPage, DisableSubTasks, EditAnnouncementBanner, EditCrowdApplication, EditCustomField, EditDarkFeatures, EditDefaultDashboard, EditFieldLayoutItemRendererConfirmation, EditIssueTypeScreenScheme, EditLinkType, EditListener, EditNestedGroups, EditPortalPage, EditProfile, EditService, EditSubTaskIssueTypes, EditWorkflowDispatcher, EditWorkflowScheme, Error404, FavouriteFilters, FilterPickerPopup, ForgotLoginDetails, IconPicker, ImportResult, ImportWorkflow, IndexOptimize, IntegrityChecker, IssuePicker, JellyRunner, JiraCreditsPage, JiraWizardActionSupport, LeaveAdmin, LicenseRoles, ListEventTypes, Logout, MailQueueAdmin, ManageConfigurationScheme, ManageSubTasks, MyJiraHome, PreparedReferenceAction, ProjectActionSupport, ProjectEmail, ProjectImportResultsAction, ProjectImportSelectBackup, ProjectImportSelectProject, ProjectImportSummary, RecentIssueHistory, ReferenceAction, ReferenceComponentAction, ReferenceComponentImportAction, ReferenceModuleTypeAction, ReferenceResourceAction, ReferenceSoyAction, ReleaseNote, ResetFailedLoginCount, ResetPassword, RestoreDefaultDashboard, SchedulerAdmin, SchemeToolsAction, SelectFieldLayoutScheme, SelectIssueTypeScreenScheme, SelectProjectCategory, SendBulkMail, ServiceExecutor, SessionTimeoutMessage, SetSelectedIssue, SetupBonfire, SetupGreenHopper, ShowConstantsHelp, ShowTimeTrackingHelp, Signup, SiteDarkFeatures, TimeTrackingAdmin, TranslateCustomField, UpdateMyJiraHome, UpdateUserPreferences, VersionAction, ViewCustomFields, ViewGroup, ViewInstrumentation, ViewIssueTypeScreenSchemes, ViewKeyboardShortcuts, ViewLicense, ViewLinkTypes, ViewListeners, ViewLogging, ViewProjects, ViewSchemes, ViewSchemes, ViewServices, ViewSystemInfo, ViewTrustedApplications, ViewUserHover, ViewUserProjectRoles, ViewWorkflowXml, WebSudoAuthenticate, WikiRendererHelpAction, XsrfErrorAction

@NotThreadSafe
@PublicSpi
public class JiraWebActionSupport
extends JiraActionSupport
implements ErrorCollection, AuthorizationSupport, HttpServletVariables

All web actions should extend this class - it provides basic common functionality for all web actions.

When adding to this class, be sure that what you are adding is used by a large number of actions - otherwise add it to a sub class of this.

See Also:
Serialized Form

Nested Class Summary
static class JiraWebActionSupport.MessageType
          Represents a type of message that the browser will display after the next page load.
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.ErrorCollection
ErrorCollection.Reason
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.I18nHelper
I18nHelper.BeanFactory
 
Field Summary
static String ISSUE_NOT_FOUND_RESULT
           
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
           
 
Fields inherited from class com.atlassian.jira.action.JiraActionSupport
log
 
Fields inherited from class webwork.action.ActionSupport
command, errorMap, errorMessages
 
Fields inherited from interface webwork.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
JiraWebActionSupport()
           
 
Method Summary
 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)
           
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.
protected  String forceRedirect(String redirect)
          This method will force a server redirect, with no security checks.
 String getAdministratorContactLink()
          Get the link, with Internationalised text for contacting the administrators of JIRA.
 ApplicationProperties getApplicationProperties()
           
protected  AuthorizationSupport getAuthorizationSupport()
           
 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.
 String getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
          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()
           
 JiraContactHelper getJiraContactHelper()
           
 JiraServiceContext getJiraServiceContext()
          Provides a service context with the current user which contains this action as its ErrorCollection.
 String getLanguage()
           
 ApplicationUser getLoggedInApplicationUser()
           
 com.atlassian.crowd.embedded.api.User getLoggedInUser()
          Deprecated. since 6.1 use getLoggedInApplicationUser() instead.
 String getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
          Deprecated. Use ConstantsManager instead. Since v6.0.
 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.
 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 getTimeFormat()
           
 UriValidator getUriValidator()
           
 String getUserFullName(String username)
           
 UserManager getUserManager()
           
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()
           
protected  boolean hasErrorMessage(String errorMsg)
           
protected  boolean hasErrorMessageByKey(String errorMsgKey)
           
 boolean hasIssuePermission(int permissionsId, Issue issue)
          Returns true if the logged in user has the given permission type on the given Issue.
 boolean hasPermission(int permissionsId)
          Returns true if the logged in user has the given permission type.
 boolean hasProjectPermission(int permissionsId, Project project)
          Returns true if the logged in user has the given permission type 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 isHasIssuePermission(int permissionsId, org.ofbiz.core.entity.GenericValue issue)
          Returns true if the logged in user has the given permission type on the given Issue.
 boolean isHasIssuePermission(String permName, org.ofbiz.core.entity.GenericValue issue)
          Returns true if the logged in user has the given permission type on the given Issue.
 boolean isHasPermission(int permissionsId)
          Deprecated. Use hasPermission(int) instead. Since v6.0.
 boolean isHasPermission(String permName)
          Deprecated. Use hasPermission(int) instead. Since v6.0.
 boolean isHasPermission(String permName, org.ofbiz.core.entity.GenericValue entity)
          Deprecated. 
 boolean isHasProjectPermission(int permissionsId, org.ofbiz.core.entity.GenericValue project)
          Deprecated. Use hasProjectPermission(int, com.atlassian.jira.project.Project) instead. Since v6.0.
 boolean isHasProjectPermission(String permName, org.ofbiz.core.entity.GenericValue project)
          Deprecated. Use hasProjectPermission(int, com.atlassian.jira.project.Project) instead. Since v6.0.
 boolean isInlineDialogMode()
          This returns true if the action has been invoked as an inline dialog.
 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)
           
 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)
           
 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.
 
Methods inherited from class com.atlassian.jira.action.JiraActionSupport
addErrorMessages, addErrorMessages, addErrors, addIllegalArgumentException, execute, getActionName, getComponentInstanceOfType, getDefaultResourceBundle, getDelegator, getI18nHelper, getKeysForPrefix, getLocale, getOfBizDelegator, getRemoteUser, getResourceBundle, getResult, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getUnescapedText, getUntransformedRawText, getUserPreferences, getWatcherManager, hasAnyErrors, isIndexing, isKeyDefined, removeKeyOrAddError
 
Methods inherited from class webwork.action.ActionSupport
addError, addErrorMessage, doDefault, doExecute, doValidation, getCommandName, getHasErrorMessages, getHasErrors, getPropertyEditorMessage, getTexts, getTexts, getTimezone, invalidInput, invokeCommand, isCommand, setCommand, setErrorMessages, setErrors, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.util.ErrorCollection
addError, addErrorMessage, addErrorMessages, addErrors, hasAnyErrors, setErrorMessages
 
Methods inherited from interface webwork.action.CommandDriven
getCommandName, setCommand
 

Field Detail

RETURN_URL_PARAMETER

public static final String RETURN_URL_PARAMETER
See Also:
Constant Field Values

PERMISSION_VIOLATION_RESULT

public static final String PERMISSION_VIOLATION_RESULT
See Also:
Constant Field Values

ISSUE_NOT_FOUND_RESULT

public static final String ISSUE_NOT_FOUND_RESULT
See Also:
Constant Field Values

request

protected javax.servlet.http.HttpServletRequest request
Deprecated. since 6.0 - use getHttpRequest() instead.
See Also:
HttpServletVariables.getHttpRequest()

savedFilters

protected Collection savedFilters
Constructor Detail

JiraWebActionSupport

public JiraWebActionSupport()
Method Detail

getLoggedInUser

@Deprecated
public com.atlassian.crowd.embedded.api.User getLoggedInUser()
Deprecated. since 6.1 use getLoggedInApplicationUser() instead.

Specified by:
getLoggedInUser in class JiraActionSupport
Returns:
The logged in user.

getLoggedInApplicationUser

public ApplicationUser getLoggedInApplicationUser()
Returns:
The logged in user.

getXsrfToken

public String getXsrfToken()

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
Specified by:
getHttpRequest in interface HttpServletVariables
Returns:
the HttpServletRequest in play
See Also:
HttpServletVariables.getHttpRequest()

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Specified by:
getHttpSession in interface HttpServletVariables
Returns:
the HttpSession in play
See Also:
HttpServletVariables.getHttpSession()

getHttpResponse

public javax.servlet.http.HttpServletResponse getHttpResponse()
Specified by:
getHttpResponse in interface HttpServletVariables
Returns:
the HttpServletResponse in play
See Also:
HttpServletVariables.getHttpResponse()

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface HttpServletVariables
Returns:
the ServletContext of the JIRA web application
See Also:
HttpServletVariables.getServletContext()

getApplicationProperties

public ApplicationProperties getApplicationProperties()
Overrides:
getApplicationProperties in class JiraActionSupport

getUriValidator

public UriValidator getUriValidator()

getGlobalPermissionManager

protected GlobalPermissionManager getGlobalPermissionManager()

getPermissionManager

protected PermissionManager getPermissionManager()

getUserProjectHistoryManager

protected UserProjectHistoryManager getUserProjectHistoryManager()

getConstantsManager

public ConstantsManager getConstantsManager()

getProjectManager

public ProjectManager getProjectManager()

getVersionManager

public VersionManager getVersionManager()

getOutlookDate

@Deprecated
public OutlookDate getOutlookDate()
Deprecated. Use getDateTimeFormatter() instead. Since v5.0.


getDateTimeFormatter

public DateTimeFormatter getDateTimeFormatter()
Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone using DateTimeStyle.RELATIVE.

Returns:
a DateTimeFormatter

getDmyDateFormatter

public DateTimeFormatter getDmyDateFormatter()
Returns a DateTimeFormatter that can be used to format dates in the user's time zone using DateTimeStyle.DATE.

Returns:
a DateTimeFormatter

getJiraContactHelper

public JiraContactHelper getJiraContactHelper()

getUserManager

public UserManager getUserManager()

getAdministratorContactLink

public String getAdministratorContactLink()
Get the link, with Internationalised text for contacting the administrators of JIRA. This link is present on many pages across the bredth of JIRA and so centralised here.

Returns:
html String of the contact administrators link.
See Also:
JiraContactHelper#getAdministratorContactLinkHtml(String, com.atlassian.jira.util.I18nHelper)}

getHintManager

protected final HintManager getHintManager()

getAuthorizationSupport

protected AuthorizationSupport getAuthorizationSupport()

getRedirect

public String getRedirect(String defaultUrl)
Redirects to the value of getReturnUrl(), falling back to defaultUrl if the returnUrl is not set. This method clears the returnUrl. If there are errors, this method returns "ERROR".

If the URL starts with '/' it is interpreted as context-relative.

Off-site redirects

Starting from JIRA 6.0, this method will not redirect to a URL that is considered "unsafe" as per RedirectSanitiser.makeSafeRedirectUrl(String). Use getRedirect(String, boolean) to allow unsafe redirects for URLs that do not contain possibly malicious user input.

Parameters:
defaultUrl - default URL to redirect to
Returns:
URL to redirect to
See Also:
getRedirect(String, boolean)

getRedirect

public String getRedirect(String defaultUrl,
                          boolean allowUnsafeRedirect)
Redirects to the value of getReturnUrl(), falling back to defaultUrl if the returnUrl is not set. This method clears the returnUrl. If there are errors, this method returns "ERROR". 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).

Parameters:
defaultUrl - default URL to redirect to
allowUnsafeRedirect - whether to allow unsafe redirects (e.g. javascript: or off-site URLs).
Returns:
URL to redirect to
Since:
v5.1.5
See Also:
forceRedirect(String)

forceRedirect

protected String forceRedirect(String redirect)
This method will force a server redirect, with no security checks. It doesn't clear the return URL and will always go to the redirect URL. For security reasons, prefer getRedirect(String), which checks that the redirect URL is safe.

Parameters:
redirect - redirect URL
Returns:
Action.NONE. It'll just redirect to where you've specified
See Also:
getRedirect(String)

isHasPermission

public boolean isHasPermission(String permName)
Deprecated. Use hasPermission(int) instead. Since v6.0.

Returns true if the logged in user has the given permission type.

Specified by:
isHasPermission in interface AuthorizationSupport
Parameters:
permName - the permission type
Returns:
true if the logged in user has the given permission type.

isHasPermission

public boolean isHasPermission(int permissionsId)
Deprecated. Use hasPermission(int) instead. Since v6.0.

Returns true if the logged in user has the given permission type.

Specified by:
isHasPermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
Returns:
true if the logged in user has the given permission type.

hasPermission

public boolean hasPermission(int permissionsId)
Returns true if the logged in user has the given permission type.

Specified by:
hasPermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
Returns:
true if the logged in user has the given permission type.

isHasIssuePermission

public boolean isHasIssuePermission(String permName,
                                    org.ofbiz.core.entity.GenericValue issue)
Description copied from interface: AuthorizationSupport
Returns true if the logged in user has the given permission type on the given Issue.

Specified by:
isHasIssuePermission in interface AuthorizationSupport
Parameters:
permName - the permission type
issue - the Issue
Returns:
true if the logged in user has the given permission type on the given Issue.

isHasIssuePermission

public boolean isHasIssuePermission(int permissionsId,
                                    org.ofbiz.core.entity.GenericValue issue)
Description copied from interface: AuthorizationSupport
Returns true if the logged in user has the given permission type on the given Issue.

Specified by:
isHasIssuePermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
issue - the Issue
Returns:
true if the logged in user has the given permission type on the given Issue.

hasIssuePermission

public boolean hasIssuePermission(int permissionsId,
                                  Issue issue)
Description copied from interface: AuthorizationSupport
Returns true if the logged in user has the given permission type on the given Issue.

Specified by:
hasIssuePermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
issue - the Issue
Returns:
true if the logged in user has the given permission type on the given Issue.

isHasProjectPermission

public boolean isHasProjectPermission(String permName,
                                      org.ofbiz.core.entity.GenericValue project)
Deprecated. Use hasProjectPermission(int, com.atlassian.jira.project.Project) instead. Since v6.0.

Returns true if the logged in user has the given permission type on the given Project.

Specified by:
isHasProjectPermission in interface AuthorizationSupport
Parameters:
permName - the permission type
project - the Project
Returns:
true if the logged in user has the given permission type on the given Project.

isHasProjectPermission

public boolean isHasProjectPermission(int permissionsId,
                                      org.ofbiz.core.entity.GenericValue project)
Deprecated. Use hasProjectPermission(int, com.atlassian.jira.project.Project) instead. Since v6.0.

Returns true if the logged in user has the given permission type on the given Project.

Specified by:
isHasProjectPermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
project - the Project
Returns:
true if the logged in user has the given permission type on the given Project.

hasProjectPermission

public boolean hasProjectPermission(int permissionsId,
                                    Project project)
Returns true if the logged in user has the given permission type on the given Project.

Specified by:
hasProjectPermission in interface AuthorizationSupport
Parameters:
permissionsId - the permission type
project - the Project
Returns:
true if the logged in user has the given permission type on the given Project.

isHasPermission

@Deprecated
public boolean isHasPermission(String permName,
                                          org.ofbiz.core.entity.GenericValue entity)
Deprecated. 

Description copied from interface: AuthorizationSupport
Returns true if remote user has permission over given entity, false otherwise.

Specified by:
isHasPermission in interface AuthorizationSupport
Parameters:
permName - permission type
entity - entity to check the permission for, e.g. project, issue
Returns:
true if remote user has permission over given entity, false otherwise

isSystemAdministrator

public boolean isSystemAdministrator()

isUserExists

@Deprecated
public boolean isUserExists(String username)
Deprecated. Use isUserExistsByName(String) or isUserExistsByKey(String) instead, as appropriate. Since v6.0.

Old name for isUserExistsByName(String)

Parameters:
username - the username to check
Returns:
true if the username is associated with an existing user; false otherwise

isUserExistsByName

public boolean isUserExistsByName(String username)

isUserExistsByKey

public boolean isUserExistsByKey(String userkey)

getUserFullName

public String getUserFullName(String username)

addErrorCollection

public void addErrorCollection(ErrorCollection errors)
Description copied from interface: ErrorCollection
Populate this ErrorCollection with general and field-specific errors.

Specified by:
addErrorCollection in interface ErrorCollection
Parameters:
errors - ErrorCollection whose errors/messages we obtain.

addError

public void addError(String field,
                     String message,
                     ErrorCollection.Reason reason)
Description copied from interface: ErrorCollection
Add a field-specific error message.

Specified by:
addError in interface ErrorCollection
Parameters:
field - Field name, eg. "assignee"
message - Error message.
reason - Reason for the error.

addErrorMessage

public void addErrorMessage(String message,
                            ErrorCollection.Reason reason)
Description copied from interface: ErrorCollection
Add error message relating to system state (not field-specific), and a reason.

Specified by:
addErrorMessage in interface ErrorCollection
Parameters:
message - Error message.
reason - Reason for the error.

addReason

public void addReason(ErrorCollection.Reason reason)
Description copied from interface: ErrorCollection
Add a reason why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.

Specified by:
addReason in interface ErrorCollection
Parameters:
reason - a well known reasons why the function has not been performed.

addReasons

public void addReasons(Set<ErrorCollection.Reason> reasons)
Description copied from interface: ErrorCollection
Add reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.

Specified by:
addReasons in interface ErrorCollection
Parameters:
reasons - a set of well known reasons why the function has not been performed.

setReasons

public void setReasons(Set<ErrorCollection.Reason> reasons)
Description copied from interface: ErrorCollection
Set reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.

Specified by:
setReasons in interface ErrorCollection
Parameters:
reasons - a set of well known reasons why the function has not been performed.

getReasons

public Set<ErrorCollection.Reason> getReasons()
Description copied from interface: ErrorCollection
A set of well known reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.

Specified by:
getReasons in interface ErrorCollection
Returns:
a set of well known reasons why the function has not been performed.

getField

public Field getField(String id)

getSearchSortDescriptions

public List<String> getSearchSortDescriptions(SearchRequest searchRequest)

getNameTranslation

public String getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
Deprecated. Use ConstantsManager instead. Since v6.0.


getDescTranslation

public String getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
Deprecated. Use ConstantsManager instead. Since v6.0.


getReturnUrl

public String getReturnUrl()

getReturnUrlForCancelLink

public String getReturnUrlForCancelLink()
The cancel links should not included the selectedIssueId, otherwise when returning to the issue navigator an issue updated notification will be shown.

Returns:
the returnUrl with selectedIssueId parameter stripped out.

setReturnUrl

public void setReturnUrl(String returnUrl)

getFlushedErrorMessages

public Collection<String> getFlushedErrorMessages()
Description copied from interface: ErrorCollection
Get error messages, then get rid of them.

Specified by:
getFlushedErrorMessages in interface ErrorCollection
Returns:
The (now cleared) error messages.

getLanguage

public String getLanguage()
                   throws IOException
Throws:
IOException

getSelectedProject

public Project getSelectedProject()
Gets the last viewed project that the user visited and still has permission to see.

Returns:
the last project the user visited.
See Also:
UserProjectHistoryManager.getCurrentProject(int, User)

getSelectedProjectObject

public Project getSelectedProjectObject()
Gets the last viewed project that the user visited and still has permission to see. This is a legacy synonym for getSelectedProject()

Returns:
the last project the user visited.
See Also:
UserProjectHistoryManager.getCurrentProject(int, User)

setSelectedProjectId

public void setSelectedProjectId(Long id)

getDateFormat

public String getDateFormat()

getDateTimeFormat

public String getDateTimeFormat()

getTimeFormat

public String getTimeFormat()

getWebworkStack

public String getWebworkStack(String selected)
For debugging JSPs; prints the webwork stack, highlighting the specified node. Eg. called with:

Parameters:
selected - selected value in the webwork stack
Returns:
HTML string of the webwork stack

getWebworkStack

public String getWebworkStack()
For debugging JSPs; prints the webwork stack. Eg. called with:

Returns:
HTML string of the webwork stack

getServerId

public String getServerId()

getJiraServiceContext

public JiraServiceContext getJiraServiceContext()
Provides a service context with the current user which contains this action as its ErrorCollection.

Returns:
the JiraServiceContext.

htmlEncode

public String htmlEncode(String encodeMe)
Convenience instance method to call static utility from webwork EL.

Parameters:
encodeMe - a String to be HTML encoded.
Returns:
the HTML encoded string.

urlEncode

public 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.

Parameters:
encode - the String to encode
Returns:
a URL-encoded String
See Also:
URLEncoder.encode(String, String)

isInlineDialogMode

public boolean isInlineDialogMode()
This returns true if the action has been invoked as an inline dialog. This changes the way that the action sends back its responses, namely when the action is submitted and completed

Returns:
true if the action was invoked as an inline dialog

setInline

public void setInline(boolean inline)
This is the web parameter setter for invoking an action as an inline dialog

Parameters:
inline - true if the action should act as an inline dialog

returnComplete

public String returnComplete()

returnComplete

public String returnComplete(String url)

getEmptyResponse

public String getEmptyResponse()
Returns an empty response code (204)


returnCompleteWithInlineRedirect

protected final String returnCompleteWithInlineRedirect(String url)
This will return success response with body containing url to redirect. An appropriately configured client side control should perform redirect to the desired url.

Parameters:
url - URL to redirect to
Returns:
action mapping string

returnCompleteWithInlineRedirectAndMsg

protected String returnCompleteWithInlineRedirectAndMsg(String url,
                                                        String msg,
                                                        JiraWebActionSupport.MessageType type,
                                                        boolean closeable,
                                                        @Nullable
                                                        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. An appropriately configured client side control should perform the displaying of the message.

Parameters:
url - URL to redirect to
msg - message HTML
type - type of message.
closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
target - the target to prepend the message pop-up to. If null, the message is shown in a global spot
Returns:
action mapping string

returnCompleteWithInlineRedirectAndMsg

protected String returnCompleteWithInlineRedirectAndMsg(String url,
                                                        String msg,
                                                        String type,
                                                        boolean closeable,
                                                        @Nullable
                                                        String target)
Deprecated. since 5.1. Use returnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String) instead.

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. An appropriately configured client side control should perform the displaying of the message.

Parameters:
url - URL to redirect to
msg - message HTML
type - type of message, see JIRA.Messages.Types
closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
target - the target to prepend the message pop-up to. If null, the message is shown in a global spot
Returns:
action mapping string

returnMsgToUser

@Deprecated
protected String returnMsgToUser(String url,
                                            String msg,
                                            String type,
                                            boolean closeable,
                                            @Nullable
                                            String target)
Deprecated. since 5.1. Use returnMsgToUser(String, String, MessageType, boolean, String) instead.

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. An appropriately configured client side control should perform the displaying of the message.

Parameters:
url - URL to redirect to. Not used in dialogs
msg - message HTML
type - type of message, see JIRA.Messages.Types
closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
target - the target to prepend the message pop-up to. If null, the message is shown in a global spot
Returns:
action mapping string

returnMsgToUser

protected String returnMsgToUser(String url,
                                 String msg,
                                 JiraWebActionSupport.MessageType type,
                                 boolean closeable,
                                 @Nullable
                                 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. An appropriately configured client side control should perform the displaying of the message.

Parameters:
url - URL to redirect to. Not used in dialogs
msg - message HTML
type - type of message
closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
target - the target to prepend the message pop-up to. If null, the message is shown in a global spot
Returns:
action mapping string

insertContextPath

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).

Parameters:
url - a String containing a URL
Returns:
a String with the context path prepended

addMessageToResponse

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.

Parameters:
msg - message HTML
type - type of message, see JIRA.Messages.Types
closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
target - the target to prepend the message pop-up to. If null, the message is shown in a global spot.

hasErrorMessage

protected final boolean hasErrorMessage(String errorMsg)

hasErrorMessageByKey

protected final boolean hasErrorMessageByKey(String errorMsgKey)

addErrorMessageIfAbsent

protected final void addErrorMessageIfAbsent(String errorMsg)

addErrorMessageByKeyIfAbsent

protected final void addErrorMessageByKeyIfAbsent(String errorMsgKey)

getHint

public final Hint getHint(String context)

getRandomHint

public final Hint getRandomHint()

getConglomerateCookieValue

public String getConglomerateCookieValue(String cookieName,
                                         String key)
Retrieve the value from a conglomerate Cookie from the request.

Parameters:
cookieName - The name of the conglomerate cookie
key - The key of the value
Returns:
the value (or the empty-string if it did not exist)

setConglomerateCookieValue

public void setConglomerateCookieValue(String cookieName,
                                       String key,
                                       String value)
Set the value key/value pair in a conglomerate Cookie.

Parameters:
cookieName - The name of the conglomerate cookie
key - The key of the value
value - The value

getRedirectSanitiser

@Nonnull
protected final RedirectSanitiser getRedirectSanitiser()
Returns a RedirectSanitiser implementation.

Returns:
a RedirectSanitiser

getErrorMessages

public Collection<String> getErrorMessages()
Description copied from interface: ErrorCollection
Get all non field-specific error messages.

Specified by:
getErrorMessages in interface ErrorCollection
Overrides:
getErrorMessages in class webwork.action.ActionSupport
Returns:
Collection of error Strings.

getErrors

public Map<String,String> getErrors()
Description copied from interface: ErrorCollection
Get all field-specific errors.

Specified by:
getErrors in interface ErrorCollection
Overrides:
getErrors in class webwork.action.ActionSupport
Returns:
Map of String: String pairs, eg. {"assignee": "Assignee is required"}


Copyright © 2002-2014 Atlassian. All Rights Reserved.