Uploaded image for project: 'ERM Platform'
  1. ERM Platform
  2. ERM-1774

Regularly remove organizations that do not have any links to Agreements/Packages



    • ERM Sprint 119, ERM Sprint 120
    • Bienenvolk
    • R3 2021



      If an organization is added to an Agreement or Package, an Org record is created. If the link between the Agreement/Package and the Org is later removed, and there are no remaining agreements/packages using that Org, there is no mechanism for removing that Org record

      The impact on the user is that when searching for Agreements, if you choose to filter by Organisation the list of Organizations can include Organizations that are not used by any Agreement or Package

      Scenario 1:

      • Given: an organization record 
      • Where: the organisation is
        • not linked to an agreement (part of a SubscriptionAgreementOrg)
        • not linked to a package (a Pkg.vendor)
      • Then: the organization (Org) record should be deleted as part of the regular ERM Housekeeping tasks


      Dev task breakdown

      • New method in this file
      • HQL query (or queries) to find all Orgs where the id of the org is not used on a package or an agreement
        • Likely multiple queries
        • Initial query to find all Org ids, then for each:
          • Check count of SubscriptionAgreementOrg with that org attached
          • Check count of Pkg with that org attached
          • If either count > 0, discard
        • Should be left with a list of Org ids it's safe to try and delete
        • Delete them all
      • Add  call to the new method to the erm housekeeping service with a comment explaining what it does

      TestRail: Results


          Issue Links



                ostephens Owen Stephens
                ostephens Owen Stephens
                0 Vote for this issue
                1 Start watching this issue



                  TestRail: Runs

                    TestRail: Cases