Allow providers other than PolicyModelsProvider 49/116949/2
authorliamfallon <liam.fallon@est.tech>
Mon, 18 Jan 2021 11:34:12 +0000 (11:34 +0000)
committerliamfallon <liam.fallon@est.tech>
Tue, 19 Jan 2021 15:07:24 +0000 (15:07 +0000)
commit924bdf916ca8d98999f30616324d4c4a07f7966d
tree304d1ab7d688a522f5f87a4de4f67073b453bd91
parent5b577fd7cc40eaad1a1e5db2d43ef9ffe820e9a2
Allow providers other than PolicyModelsProvider

This change separates the database initiation and close functions of the
DatabasePolicyModelsProviderImpl class into an abstract class that does
the database DAO initiation and closing, and a domain specific part,
that does the manipulation of the policy models in the database.

This means that other providers, that wish to manipulate other objects
in the database, can specialize the AbstractModelsProvider class and use
its common DAO initiation and clsoing functionality, but can have their
own domain specific code.

The abstract class also now supports the Closeable interface.

Note that the exiting JUnit tests provide 100% coverage on
AbstractModelsProvider.

Issue-ID: POLICY-2971
Change-Id: Ibe59c02ab127ddbd9355d892b94a5d315507a8e6
Signed-off-by: liamfallon <liam.fallon@est.tech>
models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java [new file with mode: 0644]
models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java