2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.tosca.legacy.provider;
23 import lombok.NonNull;
25 import org.onap.policy.models.base.PfModelException;
26 import org.onap.policy.models.dao.PfDao;
27 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicy;
28 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
31 * This class provides the provision of information on TOSCA concepts in the database to callers in legacy formats.
33 * @author Liam Fallon (liam.fallon@est.tech)
35 public class LegacyToscaProvider {
37 * Get legacy operational policy.
39 * @param dao the DAO to use to access the database
40 * @param policyId ID of the policy.
41 * @return the policies found
42 * @throws PfModelException on errors getting policies
44 public LegacyOperationalPolicy getOperationalPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
45 throws PfModelException {
50 * Create legacy operational policy.
52 * @param dao the DAO to use to access the database
53 * @param legacyOperationalPolicy the definition of the policy to be created.
54 * @return the created policy
55 * @throws PfModelException on errors creating policies
57 public LegacyOperationalPolicy createOperationalPolicy(@NonNull final PfDao dao,
58 @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
63 * Update legacy operational policy.
65 * @param dao the DAO to use to access the database
66 * @param legacyOperationalPolicy the definition of the policy to be updated
67 * @return the updated policy
68 * @throws PfModelException on errors updating policies
70 public LegacyOperationalPolicy updateOperationalPolicy(@NonNull final PfDao dao,
71 @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
76 * Delete legacy operational policy.
78 * @param dao the DAO to use to access the database
79 * @param policyId ID of the policy.
80 * @return the deleted policy
81 * @throws PfModelException on errors deleting policies
83 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
84 throws PfModelException {
89 * Get legacy guard policy.
91 * @param dao the DAO to use to access the database
92 * @param policyId ID of the policy.
93 * @return the policies found
94 * @throws PfModelException on errors getting policies
96 public LegacyGuardPolicy getGuardPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
97 throws PfModelException {
102 * Create legacy guard policy.
104 * @param dao the DAO to use to access the database
105 * @param legacyGuardPolicy the definition of the policy to be created.
106 * @return the created policy
107 * @throws PfModelException on errors creating policies
109 public LegacyGuardPolicy createGuardPolicy(@NonNull final PfDao dao,
110 @NonNull final LegacyGuardPolicy legacyGuardPolicy) throws PfModelException {
115 * Update legacy guard policy.
117 * @param dao the DAO to use to access the database
118 * @param legacyGuardPolicy the definition of the policy to be updated
119 * @return the updated policy
120 * @throws PfModelException on errors updating policies
122 public LegacyGuardPolicy updateGuardPolicy(@NonNull final PfDao dao,
123 @NonNull final LegacyGuardPolicy legacyGuardPolicy) throws PfModelException {
128 * Delete legacy guard policy.
130 * @param dao the DAO to use to access the database
131 * @param policyId ID of the policy.
132 * @return the deleted policy
133 * @throws PfModelException on errors deleting policies
135 public LegacyGuardPolicy deleteGuardPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
136 throws PfModelException {