Delete of non-default policy templates
Creation of Multiple service templates was possible all along. The code allowed to define a unique name and version to create and store multiple tosca service templates in the DB. The issue comes from handling the data that has been created with a unique name and version instead of the default one.
You can currently remove the default concept by calling the public deleteServiceTemplate(PfDao dao, String name, String version) method in the AuthorativeToscaProvider class. The given concept name and concept version are ignored and replaced with the default name and version. There is no additional verification of the relationship between the concepts.
This makes it hard to delete uniquely named tosca service templates using rest methods, and can only interact with them using a DB.
we should modify AuthorativeToscaProvider to allow interaction with the created policy template.
The proposed change should:
take into account the given name and version
check if the concept with the given name and version has no child concepts
check if the given name and concept version is not listed as a parent for other concepts
check if the policy is not deployed.
Verification:
It would be simpler to check if the policy is implemented in PAP. So at this level there are only concepts with undeployed policies.
Checking the relationship between the concepts should be in Dao or SimpleToscaServiceTemplateProvider. If there is any parent-child relationship, then PfModelException with a corresponding code will be thrown, and no database change will be made.