Class JiraConnector


  • public class JiraConnector
    extends Object
    An small utility for interacting with entities in Jira
    Author:
    José Fernández
    • Constructor Detail

      • JiraConnector

        public JiraConnector()
    • Method Detail

      • getProperty

        public String getProperty​(String property,
                                  String defaultValue)
        Reads the given key from the properties file. The system will try to locate the key first in the maven variables (System.getProperty) and if not found will look for it in the properties file. If the value is still not found it will return the default value (if provided) or an exception
        Parameters:
        property - key
        defaultValue - defaultValue
        Returns:
        value
      • entityShouldRun

        public Boolean entityShouldRun​(String entity)
                                throws Exception
        Determines if the entity status matches any of the expected statuses
        Parameters:
        entity - Entity identifier (i.e QMS-123)
        Returns:
        True if the entity status is within the expected statuses
        Throws:
        Exception - Exception
      • postCommentToEntity

        public void postCommentToEntity​(String entity,
                                        String message)
                                 throws Exception
        Adds a new comment to the entity
        Parameters:
        entity - Entity identifier (i.e QMS-123)
        message - Message to post
        Throws:
        Exception - Exception
      • transitionEntity

        public void transitionEntity​(String entity)
                              throws Exception
        Transition (change status) of the entity to the value provided in the properties file. Will default to "In Progress" is the value is not found
        Parameters:
        entity - Entity identifier (i.e QMS-123)
        Throws:
        Exception - Exception
      • getFirstTicketReference

        public String getFirstTicketReference​(List<String> tags)
        Returns the first reference to the jira ticket from the tag reference
        Parameters:
        tags - List of tags (i.e @ignore, @jira(QMS-123))
        Returns:
        The first ticket reference (i.e QMS-123)