Class AbstractIssueSelectAction

All Implemented Interfaces:
ErrorCollection, I18nHelper, IssueSummaryAware, HttpServletVariables, AuthorizationSupport, Serializable, webwork.action.Action, webwork.action.CommandDriven, webwork.action.IllegalArgumentAware
Direct Known Subclasses:
AbstractViewIssue, 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:
  • Field Details

    • 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:
    • PREPOPULATED_ISSUE_OBJECT

      public static final String PREPOPULATED_ISSUE_OBJECT
    • id

      protected Long id
  • Constructor Details

    • AbstractIssueSelectAction

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

      protected AbstractIssueSelectAction(SubTaskManager subTaskManager)
  • Method Details

    • 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

      @Nonnull public Issue 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:
    • getMutableIssue

      @Nonnull public MutableIssue getMutableIssue() throws IssueNotFoundException, IssuePermissionException
      Throws:
      IssueNotFoundException
      IssuePermissionException
    • refreshIssueObject

      protected Issue 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 Issue setIssueObject(@Nullable Issue 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 Project getProject()
    • getProjectObject

      public Project getProjectObject()
    • 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: