public abstract class

AbstractIssueSelectAction

extends IssueActionSupport
implements IssueSummaryAware
java.lang.Object
   ↳ webwork.action.ActionSupport
     ↳ com.atlassian.jira.action.JiraActionSupport
       ↳ com.atlassian.jira.web.action.JiraWebActionSupport
         ↳ com.atlassian.jira.web.action.ProjectActionSupport
           ↳ com.atlassian.jira.web.action.IssueActionSupport
             ↳ com.atlassian.jira.web.action.issue.AbstractIssueSelectAction
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

An abstract action that should be extended by any action which wants to 'select' an issue

Summary

Constants
String ISSUE_PERMISSION_ERROR This is used by subclasses to indicate that the issue is not valid because the caller does not have permission to view it.
[Expand]
Inherited Constants
From class com.atlassian.jira.web.action.JiraWebActionSupport
From interface webwork.action.Action
Fields
public static final String PREPOPULATED_ISSUE_OBJECT
protected Long id
[Expand]
Inherited Fields
From class com.atlassian.jira.web.action.IssueActionSupport
From class com.atlassian.jira.web.action.ProjectActionSupport
From class com.atlassian.jira.web.action.JiraWebActionSupport
From class com.atlassian.jira.action.JiraActionSupport
From class webwork.action.ActionSupport
Protected Constructors
AbstractIssueSelectAction()
Our terrible action hierarchy makes this call necessary
AbstractIssueSelectAction(SubTaskManager subTaskManager)
Public Methods
void addErrorMessage(String message)
boolean cameFromIssue()
boolean cameFromParent()
Long getId()
Get Id of current issue.
@Nonnull GenericValue getIssue()
Gets the current issue's GenericValue.
@Nonnull MutableIssue getIssueObject()
Returns the current Issue.
String getIssuePath()
Gets the relative path to the current issue.
String getKey()
Get key of current issue.
IssueSummaryLayoutBean getLayoutBean()
Get the default layout bean for most actions.
Issue getParentIssueObject()
Returns the parent of the current Issue
GenericValue getProject()
GenericValue getSecurityLevel(Long id)
Issue getSummaryIssue()
This is used by the issue summary decorator to add the left-hand side decoration.
String getViewIssueKey()
String getViewUrl()
Gets the relative path to the current issue.
boolean isEditable()
Determines whether the current user can edit or resolve this issue.
boolean isEditable(Issue issue)
Determines whether the current user can edit or resolve an specified issue.
boolean isHasEditIssuePermission(Issue issue)
boolean isIssueExists()
boolean isIssueValid()
In comparison to isIssueExists() this method performs a permission check and returns true if the issue exists and the user has sufficient permissions.
boolean isSubTask()
Determines whether the issue is a sub task - i.e.
boolean isSubTaskCreatable()
Tests whether the sub-tasks are turned on and whether the the current issue is a 'parent' issue, i.e.
boolean isWorkflowAllowsEdit(Issue issue)
void setId(Long id)
Set the the current issue by its id.
void setKey(String key)
Set current issue by its key.
void setViewIssueKey(String viewIssueKey)
Protected Methods
void assertIssueIsValid()
Ensures that the current issue is valid for the calling user.
MutableIssue getIssueObjectWithoutDatabaseRead()
This can be called by sub class to read the current value of the issueObject variable WITHOUT causing a database read

We need this because the CreateIssue variants dont have an issue to read and use this mechanims to make the create happen.

SubTaskManager getSubTaskManager()
String redirectToView()
MutableIssue refreshIssueObject()
Because some of the code works on the issueGV object (such as voting code) directly the issueObject variable representation can get out of synch with the underlying GV

You can call this method to refresh the issueObject back to the current issueGV value.

MutableIssue setIssueObject(MutableIssue issueObject)
Once this is called, the underlying issueGV and id and key will be updated to reflect the issue in play.
[Expand]
Inherited Methods
From class com.atlassian.jira.web.action.IssueActionSupport
From class com.atlassian.jira.web.action.ProjectActionSupport
From class com.atlassian.jira.web.action.JiraWebActionSupport
From class com.atlassian.jira.action.JiraActionSupport
From class webwork.action.ActionSupport
From class java.lang.Object
From interface com.atlassian.jira.util.ErrorCollection
From interface com.atlassian.jira.util.I18nHelper
From interface com.atlassian.jira.web.HttpServletVariables
From interface com.atlassian.jira.web.action.issue.IssueSummaryAware
From interface com.atlassian.jira.web.util.AuthorizationSupport
From interface webwork.action.Action
From interface webwork.action.CommandDriven
From interface webwork.action.IllegalArgumentAware

Constants

public static final String ISSUE_PERMISSION_ERROR

This is used by subclasses to indicate that the issue is not valid because the caller does not have permission to view it.

Constant Value: "issue-permission-error"

Fields

public static final String PREPOPULATED_ISSUE_OBJECT

protected Long id

Protected Constructors

protected AbstractIssueSelectAction ()

Our terrible action hierarchy makes this call necessary

protected AbstractIssueSelectAction (SubTaskManager subTaskManager)

Public Methods

public void addErrorMessage (String message)

public boolean cameFromIssue ()

public boolean cameFromParent ()

public Long getId ()

Get Id of current issue.

Returns
  • Integer Id, or null if issue not set

@Nonnull public GenericValue getIssue ()

Gets the current issue's GenericValue. This will perform a permission and existence check on the issue

Returns
  • A generic value which contains the data of the current issue.
Throws
IssuePermissionException if the current user does not have permission to read the issue
IssueNotFoundException if the issue does not exist
See Also

@Nonnull public MutableIssue getIssueObject ()

Returns the current Issue. This method performs the same security checks as getIssue().

Returns
  • The current issue.
Throws
IssuePermissionException if the current user does not have permission to read the issue
IssueNotFoundException if the issue does not exist
See Also

public String getIssuePath ()

Gets the relative path to the current issue. It does not include the context path.

Returns
  • The relative path to the current issue.

public String getKey ()

Get key of current issue.

Returns
  • Issue key, or null if not set

public IssueSummaryLayoutBean getLayoutBean ()

Get the default layout bean for most actions. This will work for 99% of actions, but specific actions may want different views, and can override this method.

public Issue getParentIssueObject ()

Returns the parent of the current Issue

Returns
  • the parent issue object

public GenericValue getProject ()

public GenericValue getSecurityLevel (Long id)

Throws
Exception

public Issue getSummaryIssue ()

This is used by the issue summary decorator to add the left-hand side decoration.

public String getViewIssueKey ()

public String getViewUrl ()

Gets the relative path to the current issue. It does not include the context path.

Returns
  • The relative path to the current issue.

public boolean isEditable ()

Determines whether the current user can edit or resolve this issue.

Returns
  • whether the current user can edit or resolve this issue.

public boolean isEditable (Issue issue)

Determines whether the current user can edit or resolve an specified issue.

Parameters
issue The issue in play.
Returns
  • whether the current user can edit or resolve an specified issue.

public boolean isHasEditIssuePermission (Issue issue)

public boolean isIssueExists ()

public boolean isIssueValid ()

In comparison to isIssueExists() this method performs a permission check and returns true if the issue exists and the user has sufficient permissions. It will also add to this action's error messages if the issue does not exist of is not accessible.

Returns
  • true if the issue exists and the user has sufficient permissions otherwise false.

public boolean isSubTask ()

Determines whether the issue is a sub task - i.e. if it has any incoming sub-task issue links

Returns
  • whether the issue is a sub task.

public boolean isSubTaskCreatable ()

Tests whether the sub-tasks are turned on and whether the the current issue is a 'parent' issue, i.e. it is not a sub-task, as we do not allow a sub-task hierarchy. Also test whether the user has CREATE issue permission for the current project. Sub-tasks are always created in the same project as its parent issue.

Since 3.4, we also need to check whether the project has any sub-task issue types

public boolean isWorkflowAllowsEdit (Issue issue)

public void setId (Long id)

Set the the current issue by its id.

Parameters
id Eg. from getId()

public void setKey (String key)

Set current issue by its key.

Parameters
key Issue key.

public void setViewIssueKey (String viewIssueKey)

Protected Methods

protected void assertIssueIsValid ()

Ensures that the current issue is valid for the calling user. If it does not exist or the calling user does not have sufficient permissions, throws an exception.

Throws
IssueNotFoundException if the issue does not exist
IssuePermissionException if the calling user does not have permission to view the issue
See Also

protected MutableIssue getIssueObjectWithoutDatabaseRead ()

This can be called by sub class to read the current value of the issueObject variable WITHOUT causing a database read

We need this because the CreateIssue variants dont have an issue to read and use this mechanims to make the create happen. The code instatiates an empty unsaved MutableIssue on create and clone and the like.

This kinda sucks BUT here we are.

Returns
  • the current value of the issueObject variable

protected SubTaskManager getSubTaskManager ()

protected String redirectToView ()

Throws
Exception

protected MutableIssue refreshIssueObject ()

Because some of the code works on the issueGV object (such as voting code) directly the issueObject variable representation can get out of synch with the underlying GV

You can call this method to refresh the issueObject back to the current issueGV value.

Returns
  • a fresh IssueObject that is backed by the current issueGV object

protected MutableIssue setIssueObject (MutableIssue issueObject)

Once this is called, the underlying issueGV and id and key will be updated to reflect the issue in play.

Parameters
issueObject the MutableIssue that has been created or read from the database
Returns
  • that same issue object