com.atlassian.jira.web.action.issue
Class AbstractIssueSelectAction

java.lang.Object
  extended by webwork.action.ActionSupport
      extended by com.atlassian.jira.action.JiraActionSupport
          extended by com.atlassian.jira.web.action.JiraWebActionSupport
              extended by com.atlassian.jira.web.action.ProjectActionSupport
                  extended by com.atlassian.jira.web.action.IssueActionSupport
                      extended by com.atlassian.jira.web.action.issue.AbstractIssueSelectAction
All Implemented Interfaces:
ErrorCollection, I18nHelper, IssueSummaryAware, AuthorizationSupport, Serializable, webwork.action.Action, webwork.action.CommandDriven, webwork.action.IllegalArgumentAware
Direct Known Subclasses:
AbstractViewIssue, AbstractWorklogAction, AttachTemporaryFile, CreateIssue, DeleteAttachment, DeleteComment, DeleteLink, DeleteRemoteIssueLink, EditLabels, ManageWatchers, SimpleWorkflowAction, ViewSubtaskFragmentAction, ViewVoters, VoteOrWatchIssue

public abstract class AbstractIssueSelectAction
extends IssueActionSupport
implements IssueSummaryAware

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
JiraWebActionSupport.MessageType
 
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
protected  Long id
           
static 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.
static String PREPOPULATED_ISSUE_OBJECT
           
 
Fields inherited from class com.atlassian.jira.web.action.IssueActionSupport
attachmentManager
 
Fields inherited from class com.atlassian.jira.web.action.ProjectActionSupport
projectManager
 
Fields inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
ISSUE_NOT_FOUND_RESULT, PERMISSION_VIOLATION_RESULT, request, RETURN_URL_PARAMETER, 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
protected AbstractIssueSelectAction()
          Our terrible action hierarchy makes this call necessary
protected AbstractIssueSelectAction(SubTaskManager subTaskManager)
           
 
Method Summary
 void addErrorMessage(String message)
          Add error message relating to system state (not field-specific).
protected  void assertIssueIsValid()
          Ensures that the current issue is valid for the calling user.
 boolean cameFromIssue()
           
 boolean cameFromParent()
           
 Long getId()
          Get Id of current issue.
 org.ofbiz.core.entity.GenericValue getIssue()
          Gets the current issue's GenericValue.
 MutableIssue getIssueObject()
          Returns the current Issue.
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.

 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
 org.ofbiz.core.entity.GenericValue getProject()
           
 org.ofbiz.core.entity.GenericValue getSecurityLevel(Long id)
           
protected  SubTaskManager getSubTaskManager()
           
 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)
           
protected  String redirectToView()
           
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.

 void setId(Long id)
          Set the the current issue by its id.
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.
 void setKey(String key)
          Set current issue by its key.
 void setViewIssueKey(String viewIssueKey)
           
 
Methods inherited from class com.atlassian.jira.web.action.IssueActionSupport
addIssueToHistory, clearSelectedIssue, getAttachmentManager, getCurrentFailedLoginCount, getCurrentJQL, getCustomFieldManager, getDaysPerWeek, getEverLoggedIn, getHoursPerDay, getIssueManager, getLastFailedLogin, getLastLogin, getLoginCount, getPossibleVersions, getPossibleVersionsReleasedFirst, getPrettyDuration, getPreviousLogin, getSearchRequest, getSelectedIssueId, getSessionPagerFilterManager, getSessionSearchRequestManager, getSessionSearchRequestManagerFactory, getSessionSelectedIssueManager, getTotalFailedLoginCount, getUrlEncoded, getWorkflow, getWorkflowTransitionDescription, getWorkflowTransitionDisplayName, isCustomFieldHidden, isElevatedSecurityCheckRequired, isFieldHidden, isFieldHidden, isTimeTrackingEnabled, setSearchRequest, setSelectedIssueId, updateSearchRequest
 
Methods inherited from class com.atlassian.jira.web.action.ProjectActionSupport
getBrowsableProjects, getBrowseableProjects, getSelectedProjectId, setSelectedProject, setSelectedProject
 
Methods inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
addError, addErrorCollection, addErrorMessage, addErrorMessageByKeyIfAbsent, addErrorMessageIfAbsent, addReason, addReasons, forceRedirect, getAdministratorContactLink, getApplicationProperties, getAuthorizationSupport, getConglomerateCookieValue, getConstantsManager, getDateFormat, getDateTimeFormat, getDateTimeFormatter, getDescTranslation, getDmyDateFormatter, getField, getFlushedErrorMessages, getGlobalPermissionManager, getHint, getHintManager, getJiraContactHelper, getJiraServiceContext, getLanguage, getLoggedInApplicationUser, getLoggedInUser, getNameTranslation, getOutlookDate, getPermissionManager, getProjectManager, getRandomHint, getReasons, getRedirect, getRedirect, getRedirectSanitiser, getReturnUrl, getReturnUrlForCancelLink, getSearchSortDescriptions, getSelectedProject, getSelectedProjectObject, getServerId, getTimeFormat, getUriValidator, getUserFullName, getUserManager, getUserProjectHistoryManager, getVersionManager, getWebworkStack, getWebworkStack, getXsrfToken, hasErrorMessage, hasErrorMessageByKey, htmlEncode, insertContextPath, isHasIssuePermission, isHasIssuePermission, isHasPermission, isHasPermission, isHasPermission, isHasProjectPermission, isHasProjectPermission, isInlineDialogMode, isSystemAdministrator, isUserExists, returnComplete, returnComplete, returnCompleteWithInlineRedirect, returnCompleteWithInlineRedirectAndMsg, returnCompleteWithInlineRedirectAndMsg, returnMsgToUser, returnMsgToUser, setConglomerateCookieValue, setInline, setReasons, setReturnUrl, setSelectedProjectId, urlEncode
 
Methods inherited from class com.atlassian.jira.action.JiraActionSupport
addErrorMessages, addErrorMessages, addErrors, addIllegalArgumentException, execute, getActionName, getComponentInstanceOfType, getDefaultResourceBundle, getDelegator, getI18nHelper, getKeysForPrefix, getLocale, getOfBizDelegator, getRemoteUser, 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, doDefault, doExecute, doValidation, getCommandName, getErrorMessages, getErrors, 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.web.action.issue.IssueSummaryAware
getLoggedInUser
 
Methods inherited from interface com.atlassian.jira.util.ErrorCollection
addError, addErrorMessages, addErrors, getErrorMessages, getErrors, hasAnyErrors, setErrorMessages
 
Methods inherited from interface webwork.action.CommandDriven
getCommandName, setCommand
 

Field Detail

ISSUE_PERMISSION_ERROR

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.

See Also:
Constant Field Values

PREPOPULATED_ISSUE_OBJECT

public static final String PREPOPULATED_ISSUE_OBJECT

id

protected Long id
Constructor Detail

AbstractIssueSelectAction

protected AbstractIssueSelectAction()
Our terrible action hierarchy makes this call necessary


AbstractIssueSelectAction

protected AbstractIssueSelectAction(SubTaskManager subTaskManager)
Method Detail

isIssueExists

public boolean isIssueExists()

isIssueValid

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.

getIssue

@Nonnull
public org.ofbiz.core.entity.GenericValue getIssue()
                                            throws IssueNotFoundException,
                                                   IssuePermissionException
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:
getIssueObject()

getIssueObject

@Nonnull
public MutableIssue getIssueObject()
                            throws IssueNotFoundException,
                                   IssuePermissionException
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:
getIssue()

refreshIssueObject

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

getIssueObjectWithoutDatabaseRead

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

getId

public Long getId()
Get Id of current issue.

Returns:
Integer Id, or null if issue not set

getKey

public String getKey()
Get key of current issue.

Returns:
Issue key, or null if not set

setIssueObject

protected MutableIssue setIssueObject(@Nullable
                                      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

setId

public void setId(Long id)
Set the the current issue by its id.

Parameters:
id - Eg. from Issue.getId()

setKey

public void setKey(String key)
Set current issue by its key.

Parameters:
key - Issue key.

getProject

public org.ofbiz.core.entity.GenericValue getProject()

getSecurityLevel

public org.ofbiz.core.entity.GenericValue getSecurityLevel(Long id)
                                                    throws Exception
Throws:
Exception

getViewIssueKey

public String getViewIssueKey()

setViewIssueKey

public void setViewIssueKey(String viewIssueKey)

redirectToView

protected String redirectToView()
                         throws Exception
Throws:
Exception

getViewUrl

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.

getIssuePath

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.

isEditable

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.

isEditable

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.

isHasEditIssuePermission

public boolean isHasEditIssuePermission(Issue issue)

isWorkflowAllowsEdit

public boolean isWorkflowAllowsEdit(Issue issue)

cameFromIssue

public boolean cameFromIssue()

cameFromParent

public boolean cameFromParent()

getSummaryIssue

public Issue getSummaryIssue()
This is used by the issue summary decorator to add the left-hand side decoration.

Specified by:
getSummaryIssue in interface IssueSummaryAware
Returns:
The issue to display on the left hand side

getLayoutBean

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.

Specified by:
getLayoutBean in interface IssueSummaryAware

getSubTaskManager

protected SubTaskManager getSubTaskManager()

isSubTask

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.

isSubTaskCreatable

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


getParentIssueObject

public Issue getParentIssueObject()
Returns the parent of the current Issue

Returns:
the parent issue object

addErrorMessage

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

Specified by:
addErrorMessage in interface ErrorCollection
Overrides:
addErrorMessage in class webwork.action.ActionSupport
Parameters:
message - Error message.

assertIssueIsValid

protected void assertIssueIsValid()
                           throws IssueNotFoundException,
                                  IssuePermissionException
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:
isIssueValid()


Copyright © 2002-2013 Atlassian. All Rights Reserved.