You are previewing JIRA Development Cookbook - Third Edition.
O'Reilly logo
JIRA Development Cookbook - Third Edition

Book Description

Your one-stop resource for mastering extensions and customizations in JIRA 7+

About This Book

  • Explore the new features of JIRA 7 and best practices for agile development and integration with development tools

  • Customize the look and feel of your JIRA UI to match your specific user needs

  • Create seamless reports that make sense of your data through easy-to-use techniques

  • Who This Book Is For

    If you are a JIRA developer or administrator, or a project manager who wants to fully exploit the exciting capabilities of JIRA, then this is the perfect book for you.

    What You Will Learn

  • Create and deploy your own JIRA plugins

  • Manipulate workflows to transform JIRA into a user-friendly system

  • Create custom reports that show statistics for particular people, projects, versions, or other fields within issues

  • Simplify reporting by writing your own JIRA gadgets, which can be added into a user's dashboard

  • Master database handling by extending and retrieving custom field details from the database

  • Deal with custom fields on an issue and program custom field option

  • In Detail

    JIRA provides issue and project tracking for software development teams to improve code quality and the speed of development. With the new version of JIRA, you can create your own JIRA plugins and customize the look and feel of your JIRA UI easier than ever.

    JIRA Development Cookbook , Third Edition, is a one-stop resource to master extensions and customizations in JIRA. This book starts with recipes about simplifying the plugin development process followed by recipes dedicated to the plugin framework. Then, you will move on to writing custom field plugins to create new field types or custom searchers. You will also learn how to program and customize workflows to transform JIRA into a user-friendly system. With so much data spanning different projects, issues, and so on, we will cover how to work on reports and gadgets to get customized data according to our needs. At the end of the book, you will learn how to customize JIRA by adding new tabs, menus, and web items; communicate with JIRA via the REST APIs; and work with the JIRA database.

    Style and approach

    JIRA Development Cookbook , Third Edition, is a one-stop resource to master extensions and customizations in JIRA. This book starts with recipes about simplifying the plugin development process followed by recipes dedicated to the plugin framework. Then, you will move on to writing custom field plugins to create new field types or custom searchers. You will also learn how to program and customize workflows to transform JIRA into a user-friendly system. With so much data spanning different projects, issues, and so on, we will cover how to work on reports and gadgets to get customized data according to our needs. At the end of the book, you will learn how to customize JIRA by adding new tabs, menus, and web items; communicate with JIRA via the REST APIs; and work with the JIRA database.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. JIRA Development Cookbook Third Edition
      1. JIRA Development Cookbook Third Edition
      2. Credits
      3. About the Author
      4. Acknowledgments
      5. About the Reviewer
      6. www.PacktPub.com
        1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Plugin Development Process
        1. Introduction
          1. What is a JIRA add-on?
            1. The plugin development process
              1. Atlassian Marketplace
              2. Troubleshooting
        2. Setting up the development environment
          1. Getting ready
          2. How to do it...
          3. There's more...
            1. Proxy settings for Maven
            2. Using local Maven
            3. Configuring IDEs to use the SDK
            4. Troubleshooting
        3. Creating a skeleton plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. One step to your skeleton plugin
            2. Creating an Eclipse project
        4. Adding plugin modules
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Deploying a JIRA plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using a specific version of JIRA
            2. Reusing the data in each run
            3. Troubleshooting
        6. Making changes and redeploying a plugin
          1. How to do it...
            1. Debugging in Eclipse
          2. See also
        7. Using FastDev for plugin development
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Adding ignored files
            2. Changing admin credentials
          5. See also
        8. Testing and debugging
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using custom data for integration/functional Tests
            2. Testing against different version of JIRA/Tomcat
          5. See also
      9. 2. Understanding the Plugin Framework
        1. Introduction
          1. JIRA architecture
            1. Third-party components
              1. Webwork
              2. Seraph
              3. Embedded Crowd
              4. PropertySet
              5. Active Objects
              6. OSWorkflow
              7. OfBiz Entity Engine
              8. Apache Lucene
              9. Atlassian Gadget JavaScript Framework
              10. Shared Access Layer
          2. Architecture
            1. Authentication and user management
            2. Property management
            3. Presentation
            4. Database
            5. Workflows
            6. Searching
            7. Scheduled jobs
            8. Plugins
          3. Types of plugin modules
            1. Reporting
            2. Workflows
            3. Custom fields
            4. Searching
            5. Links and tabs
            6. Remote invocation
            7. Actions and components
            8. Other plugin modules
            9. What goes into atlassian-plugin.xml?
          4. Working with the Plugins1 and Plugins2 versions
            1. Development
            2. Installation
          5. JIRA system plugins
          6. Stable and core APIs
        2. Modifying Atlassian bundled plugins
          1. How to do it...
          2. How it works...
          3. See also
        3. Converting plugins from V1 to V2
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Adding resources into plugins
          1. Getting ready
          2. How to do it...
        5. Adding web resources into plugins
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Web resource contexts
            2. Turning off batch mode
        6. Building JIRA from source
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Making a single class patch
          5. See also
        7. Adding new webwork actions to JIRA
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Adding new commands to the action
          5. See also
        8. Form token handling in webwork actions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Providing a token in HTML links
              1. Getting the token programmatically
              2. Opting out of token checking in remote calls
          5. See also
        9. Capturing plugin installation/uninstallation events
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      10. 3. Working with Custom Fields
        1. Introduction
        2. Writing a simple custom field
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Custom field searchers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Dealing with custom fields on an issue
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Programming custom field options
          1. Getting ready
          2. How to do it...
          3. See also
        6. Overriding the validation of custom fields
          1. Getting ready
          2. How to do it...
          3. See also
        7. Customizing the change log value
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Migrating from one custom field type to another
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Changing the type of a custom field
          4. See also
        9. Making custom fields sortable
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Displaying custom fields on subtask columns
          1. How to do it...
          2. How it works...
        11. User and date fields
          1. How to do it...
          2. How it works...
          3. See also
        12. Adding custom fields to notification e-mails
          1. Getting ready
          2. How to do it...
          3. How it works...
        13. Adding help text for a custom field
          1. Getting ready
          2. How to do it...
          3. How it works...
        14. Removing the "none" option from a select field
          1. How to do it...
          2. There's more...
            1. Reloading velocity changes without restart (auto reloading)
          3. See also
        15. Making the custom field project importable
          1. How to do it...
          2. See also
        16. Changing the size of a text area custom field
          1. How to do it...
          2. See also
      11. 4. Programming Workflows
        1. Introduction
        2. Writing a workflow condition
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Writing a workflow validator
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Writing a workflow post function
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Editing an active workflow
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Modifying workflows in a JIRA database
        6. Permissions based on workflow status
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Making an issue editable/non-editable using workflow properties
          4. See also
        7. Including/excluding resolutions for specific transitions
          1. How to do it...
          2. How it works...
          3. See also
        8. Adding workflow triggers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. User mapping from development tools to JIRA
          5. See also
        9. Internationalization in workflow statuses
          1. How to do it...
          2. How it works...
          3. See also
        10. Obtaining available workflow actions programmatically
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Getting the action ID's given name
        11. Programmatically progressing on workflows
          1. How to do it...
          2. How it works...
        12. Obtaining workflow history from the database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Reordering workflow actions in JIRA
          1. How to do it...
          2. How it works...
        14. Creating common transitions in workflows
          1. How to do it...
          2. How it works...
        15. Creating global transitions in workflows
          1. How to do it...
          2. How it works...
      12. 5. Gadgets and Reporting in JIRA
        1. Introduction
        2. Writing a JIRA report
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Reports in Excel format
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Data validation in JIRA reports
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Restricting access to reports
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Object configurable parameters for reports
          1. How to do it...
          2. How it works...
          3. See also
        7. Writing JIRA gadgets
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Invoking REST services from gadgets
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Configuring user preferences in gadgets
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Accessing gadgets outside of JIRA
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. See also
      13. 6. The Power of JIRA Searching
        1. Introduction
        2. Writing a JQL function
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Sanitizing JQL functions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Adding a search request view
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using Single Issue Views to render search views
          5. See also
        5. Smart querying using quick search
          1. How to do it...
          2. There's more...
        6. Searching in plugins
          1. How to do it...
          2. There's more...
          3. See also
        7. Parsing a JQL query in plugins
          1. How to do it...
          2. How it works...
          3. See also
        8. Linking directly to search queries
          1. How to do it...
          2. How it works...
          3. There's more...
        9. Index and de-index issues programmatically
          1. How to do it...
          2. See also
        10. Searching on issue entity properties
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Managing filters programmatically
          1. How to do it...
            1. Creating a filter
            2. Updating a filter
            3. Deleting a filter
            4. Retrieving filters
            5. Sharing a filter
          2. See also
        12. Subscribing to a filter
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
      14. 7. Programming Issues
        1. Introduction
        2. Creating an issue from a plugin
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Creating the issue using IssueManager
          4. See also
        3. Creating subtasks on an issue
          1. How to do it...
          2. See also
        4. Updating an issue
          1. How to do it...
        5. Deleting an issue
          1. How to do it...
        6. Adding new issue operations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Conditions on issue operations
          1. Getting ready...
          2. How to do it...
          3. How it works...
        8. Working with attachments
          1. Getting ready...
          2. How to do it...
            1. Creating an attachment
            2. Reading attachments on an issue
            3. Deleting an attachment
          3. There's more...
        9. Time tracking and worklog management
          1. Getting ready...
          2. How to do it...
            1. Auto adjusting the remaining estimate
            2. Logging work and retaining the remaining estimate
            3. Logging work with a new remaining estimate
            4. Logging work and adjusting the remaining estimate by a value
          3. How it works...
          4. There's more
            1. Updating worklogs
            2. Deleting worklogs
              1. Auto Adjusting remaining estimate
              2. Deleting a worklog and retaining the remaining estimate
              3. Deleting a worklog with a new remaining estimate
              4. Deleting a worklog and adjusting the remaining estimate
        10. Working with comments on issues
          1. How to do it...
            1. Creating comments on issues
            2. Creating comments on an issue and restricting it to a project role or group
            3. Updating comments
            4. Deleting comments
        11. Programming change logs
          1. How to do it...
          2. How it works...
        12. Programming issue links
          1. Getting ready...
          2. How to do it...
          3. There's more...
            1. Deleting Issue Links
            2. Retrieving Issue Links on an issue
        13. JavaScript tricks on issue fields
          1. How to do it...
          2. How it works...
        14. Creating issues and comments from e-mail
          1. How to do it...
          2. How it works...
      15. 8. Customizing the UI
        1. Introduction
        2. Changing the basic look and feel
          1. How to do it...
        3. Adding new web sections in the UI
          1. How to do it...
          2. How it works...
          3. See also
        4. Adding new web items in the UI
          1. How to do it...
          2. How it works...
          3. See also
        5. Use of decorators and other metadata tags
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Adding conditions for web fragments
          1. How to do it...
          2. How it works...
        7. Creating new velocity context for web fragments
          1. How to do it...
          2. How it works...
        8. Adding a new drop-down menu on the top navigation bar
          1. How to do it...
          2. How it works...
        9. Dynamic creation of web items
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Adding new tabs in the View Issue screen
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
            1. Loading issue tab panel asynchronously
        11. Adding new tabs in the Browse Project screen
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Adding new links in the Project-centric view
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Adding new panels in the project-centric view
          1. Getting ready
          2. How to do it...
          3. How it works...
        14. Adding sub-navigation in Project-centric view
          1. Getting ready
          2. How to do it...
          3. How it works...
        15. Adding issue link renderers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        16. Displaying dynamic notifications/warnings on issues
          1. Getting ready
          2. How to do it...
          3. There's more...
        17. Re-ordering Issue Operations in the View Issue page
          1. How to do it...
          2. How it works...
          3. See also
        18. Re-ordering fields in the View Issue page
          1. How to do it...
          2. See also
      16. 9. Remote Access to JIRA
        1. Introduction
        2. Writing Java client for REST API
          1. Getting ready
          2. How to do it...
        3. Working with issues
          1. Getting ready
          2. How to do it...
            1. Creating Issues
            2. Updating issues
            3. Browsing issues
        4. Working with attachments
          1. Getting ready
          2. How to do it...
            1. Using input stream and a new filename
            2. Using the AttachmentInput object
            3. Using file and a new filename
            4. Browsing attachments
        5. Remote time tracking
          1. Getting ready...
          2. How to do it...
        6. Working with comments
          1. Getting ready
          2. How to do it...
        7. Remote user and group management
          1. How to do it...
            1. Creating a User
            2. Updating a User
            3. Adding a User to an application
            4. Removing a User from an application
            5. Deleting a User
            6. Creating a Group
            7. Adding a user to a Group
            8. Getting users in a Group
            9. Removing a user from a Group
            10. Deleting a Group
        8. Progressing an issue in workflow
          1. Getting ready
          2. How to do it...
        9. Searching issues
          1. Getting ready
          2. How to do it...
        10. Managing versions
          1. Getting ready
          2. How to do it...
        11. Managing components
          1. Getting ready
          2. How to do it...
        12. Remote administration methods
          1. How to do it...
            1. Creating a Permission Scheme
            2. Creating a Project
            3. Retrieving the project roles
            4. Add actors to a project role
          2. How it works...
        13. Exposing services and data entities as REST APIs
          1. Getting ready
          2. How to do it...
          3. How it works...
        14. Using the REST API browser
          1. How to do it...
        15. Working with JIRA Webhooks
          1. How to do it...
          2. How it works...
          3. There's more...
      17. 10. Dealing with the JIRA Database
        1. Introduction
        2. Extending the JIRA database with a custom schema
          1. How to do it...
          2. How works...
        3. Accessing database entities from plugins
          1. How to do it...
            1. Reading from a database
            2. Writing a new record
            3. Updating a record
        4. Persisting plugin information in the JIRA database
          1. How to do it...
          2. How it works...
        5. Using Active Objects to store data
          1. Getting ready...
          2. How to do it...
          3. How it works...
        6. Accessing the JIRA configuration properties
          1. How to do it...
        7. Getting a database connection for JDBC calls
          1. How to do it...
        8. Migrating a custom field from one type to another
          1. How to do it...
        9. Retrieving issue information from a database
          1. How to do it...
          2. There's more...
        10. Retrieving custom field details from a database
          1. How to do it...
        11. Retrieving permissions on issues from a database
          1. How to do it...
        12. Retrieving workflow details from a database
          1. How to do it...
        13. Updating the issue status in a database
          1. Getting ready
          2. How to do it...
        14. Retrieving users and groups from a database
          1. How to do it...
        15. Dealing with change history in a database
          1. How to do it...
      18. 11. Useful Recipes
        1. Introduction
        2. Writing a service in JIRA
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Adding configurable parameters to a service
          1. How to do it...
          2. How it works...
          3. See also
        4. Writing scheduled tasks in JIRA
          1. How to do it...
          2. How it works...
          3. See also
        5. Writing listeners in JIRA
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Customizing e-mail content
          1. How to do it...
          2. How it works...
        7. Redirecting to a different page in webwork actions
          1. How to do it...
        8. Adding custom behavior for user details
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Deploying a servlet in JIRA
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Adding shared parameters to Servlet Context
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Writing a Servlet Context Listener
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Using filters to intercept queries in JIRA
          1. Getting ready
          2. How to do it...
          3. How it works...
        13. Adding and importing components in JIRA
          1. Getting ready
          2. How to do it...
            1. Exposing components to other plugins
            2. Importing public components
          3. How it works...
        14. Adding new module types to JIRA
          1. Getting ready
          2. How to do it...
            1. Creating modules using the new module type
            2. Using the new modules
          3. How it works...
        15. Enabling access logs in JIRA
          1. How to do it...
          2. How it works...
        16. Enabling SQL logging in JIRA
          1. How to do it...
          2. How it works...
        17. Internationalization in webwork plugins
          1. How to do it...
          2. How it works...
        18. Sharing common libraries across v2 plugins
          1. Getting ready
          2. How to do it...
        19. Operations using direct HTML links
          1. How to do it...
        20. Implementing Marketplace licensing in plugins
          1. Getting ready
          2. How to do it...
          3. How it works...