Uploaded image for project: 'Configuration Management Toolkit'
  1. CBSV-290

Java API Suggestion: Bundle and Component Version Management Improvements


    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 1.11.3
    • Fix versions: 1.12.0
    • Components: None
    • Labels:
    • Environment:

      Jira 7.10.2


      This would address the following use-case (not sure it applies to everyone):

      • Given a versioned product (Bundle) with many Versioned Components (CmpVersionMapping + BundleContent), I can associate the two together in a relatively simple way.

      This is how I currently do it is as follows:

      1. Create a Product object (our own thing--just a versioned product that has versioned components, with methods that wrap your plugin to persist itself to Jira)
      2. Create the Version for the Bundle
      3. Create the Bundle against a Project and Bundle's Version
      4. Use cvService.addBundle(BundleImp) to add the bundle to Jira
      5. Create the Jira Component
      6. Create the Jira Version for the Jira Component
      7. Use cvService.addMapping(CmpVersionMappingImp) to create the Versioned Component from the Component + Component's Version
      8. Get the Bundle ID, Component ID, and Component's Version ID
      9. Use cvService.addContentToBundle(BundleContentImp) to create the BundleContent from the Bundle ID, Component ID, and Component's Version ID

      The thing that strikes me as a bit weird is how the mapping between the Bundle and Versioned Component is a separate thing that take the Component and Version Ids as arguments.

      • Why not offer an API that takes a CmpVersionMapping instead, since it already is aware of its Component and Version?
      • Even better, why not also offer an API to add a mapping directly to a bundle?

      I'm aware that a CmpVersionMapping doesn't have a reference to a bundle; the difference between that and the BundleContent seems to be that a CmpVersionMapping is associated to a Project, Component, and Version--whereas a BundleContent is associated to a Bundle, Component, and Version.

      So, what if we had this API method instead?

      BundleContent addMappingToBundle(Bundle bundle, CmpVersionMapping cmpVersionMapping) { 
          // Get the Bundle (for the BundleId)
          // Get the CmpVersionMapping (for the Component ID and Version ID)
          // Create the BundleContent, or return it if it already exists

      Or better, these as well?

      Bundle addVersionedBundle(BundleImp bundleImp, Version version) {
          // Create a Bundle that is associated to Version provided
      BundleContent addVersionedComponentAndAddToBundle(ProjectComponent component, Version version, Bundle bundle) { 
          // Get the Bundle (for the BundleId)
          // Get the Component (for the Component Id)
          // Get the Version (for the Version Id)
          // Create the CmpVersionMapping 
          // Create the BundleContent

      It is basically what I've added in my own code to wrap the API, it makes it much easier to work with it. Then I can just do this:

      1. Create the Versioned Bundle
      2. Create a Versioned Component, or get existing
      3. Associate a Versioned Component to the Bundle




            • Assignee:
              denizoguz Deniz Oğuz
              christina.jenks Christina Jenks
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created:

                Who's Looking?