Class IssueManager


  • public class IssueManager
    extends java.lang.Object
    Works with Issues, Time Entries, Issue Statuses, Issue Relations.

    Obtain it via RedmineManager:

     RedmineManager redmineManager = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password);
     IssueManager issueManager = redmineManager.getIssueManager();
     

    Sample usage:

     Issue issue = issueManager.getIssueById(3205, Include.journals, Include.relations, Include.attachments);
     System.out.println(issue.getJournals());
     
    See Also:
    RedmineManager.getIssueManager()
    • Method Detail

      • getIssuesBySummary

        public java.util.List<Issue> getIssuesBySummary​(java.lang.String projectKey,
                                                        java.lang.String summaryField)
                                                 throws RedmineException
        There could be several issues with the same summary, so the method returns List.
        Returns:
        empty list if not issues with this summary field exist, never NULL
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        NotFoundException
        RedmineException
      • getIssues

        public ResultsWrapper<Issue> getIssues​(java.util.Map<java.lang.String,​java.lang.String> parameters)
                                        throws RedmineException
        Direct method to search for issues using any Redmine REST API parameters you want.

        Unlike other getXXXObjects() methods in this library, this one does NOT handle paging for you so you have to provide "offset" and "limit" parameters if you want to control paging.

        Sample usage:

             final Map params = new HashMap();
             params.put("project_id", projectId);
             params.put("subject", "~free_form_search");
             final List issues = issueManager.getIssues(params);
             
        Parameters:
        parameters - the http parameters key/value pairs to append to the rest api request
        Returns:
        resultsWrapper with raw response from Redmine REST API
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        RedmineException
      • getIssues

        public ResultsWrapper<Issue> getIssues​(Params parameters)
                                        throws RedmineException
        Free-form search that does not do any paging for you. Btw, where is Redmine free-form search documentation??

        Sample usage:

        
             Params params = new Params()
             .add("set_filter", "1")
             .add("f[]", "summary")
             .add("op[summary]", "~")
             .add("v[summary]", "another")
             .add("f[]", "description")
             .add("op[description]", "~")
             .add("v[description][]", "abc");
        
             list = issueManager.getIssues(params);
        
         
        Parameters:
        parameters -
        Throws:
        RedmineException
      • getIssueById

        public Issue getIssueById​(java.lang.Integer id,
                                  Include... include)
                           throws RedmineException
        Parameters:
        id - Redmine issue Id
        include - list of "includes". e.g. "relations", "journals", ...
        Returns:
        Issue object. never Null: an exception is thrown if the issue is not found (see Throws section).
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        NotFoundException - the issue with the given id is not found on the server
        RedmineException
      • createIssue

        public Issue createIssue​(Issue issue)
                          throws RedmineException
        Sample usage:
         
           Issue issueToCreate = IssueFactory.create(projectDatabaseId, subject);
           Issue newIssue = mgr.createIssue(issueToCreate);
         
         
        Parameters:
        issue - the Issue object to create on the server.
        Returns:
        the newly created Issue.
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        NotFoundException - the project is not found
        RedmineException
      • getIssues

        public java.util.List<Issue> getIssues​(java.lang.String projectKey,
                                               java.lang.Integer queryId,
                                               Include... include)
                                        throws RedmineException
        Parameters:
        projectKey - ignored if NULL
        queryId - id of the saved query in Redmine. the query must be accessible to the user represented by the API access key (if the Redmine project requires authorization). This parameter is optional, NULL can be provided to get all available issues.
        Returns:
        list of Issue objects
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        RedmineException
        See Also:
        Issue
      • createRelation

        public IssueRelation createRelation​(java.lang.Integer issueId,
                                            java.lang.Integer issueToId,
                                            java.lang.String type)
                                     throws RedmineException
        Parameters:
        issueId - id of the source issue
        issueToId - if of the target issue
        type - type of the relation. e.g. "precedes". see IssueRelation.TYPE for possible types.
        Returns:
        newly created IssueRelation instance.
        Throws:
        RedmineException
        See Also:
        IssueRelation.TYPE
      • deleteRelation

        public void deleteRelation​(java.lang.Integer id)
                            throws RedmineException
        Delete Issue Relation with the given Id.
        Throws:
        RedmineException
      • deleteIssueRelationsByIssueId

        public void deleteIssueRelationsByIssueId​(java.lang.Integer issueId)
                                           throws RedmineException
        Delete relations for the given issue ID.
        Parameters:
        issueId - issue ID
        Throws:
        RedmineException
      • getSavedQueries

        public java.util.List<SavedQuery> getSavedQueries​(java.lang.String projectKey)
                                                   throws RedmineException
        Get "saved queries" for the given project available to the current user.

        This REST API feature was added in Redmine 1.3.0. See http://www.redmine.org/issues/5737

        Throws:
        RedmineException
      • getSavedQueries

        public java.util.List<SavedQuery> getSavedQueries()
                                                   throws RedmineException
        Get all "saved queries" available to the current user.

        This REST API feature was added in Redmine 1.3.0. See http://www.redmine.org/issues/5737

        Throws:
        RedmineException