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.provider.impl;
23 import java.util.List;
26 import javax.ws.rs.core.Response;
28 import lombok.NonNull;
30 import org.apache.commons.lang3.tuple.Pair;
31 import org.onap.policy.models.base.PfModelException;
32 import org.onap.policy.models.base.PfModelRuntimeException;
33 import org.onap.policy.models.pdp.concepts.PdpGroup;
34 import org.onap.policy.models.pdp.concepts.PdpGroups;
35 import org.onap.policy.models.pdp.concepts.PdpStatistics;
36 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
37 import org.onap.policy.models.provider.PolicyModelsProvider;
38 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
39 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
40 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
41 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
42 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
43 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
46 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
48 * @author Liam Fallon (liam.fallon@est.tech)
50 public class DummyBadProviderImpl implements PolicyModelsProvider {
51 public DummyBadProviderImpl() {
52 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
56 public void close() throws Exception {}
59 public void init() throws PfModelException {}
62 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
67 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
68 throws PfModelException {
73 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
74 throws PfModelException {
79 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
84 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
89 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate)
90 throws PfModelException {
95 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate)
96 throws PfModelException {
101 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
106 public LegacyOperationalPolicy getOperationalPolicy(@NonNull String policyId) throws PfModelException {
111 public LegacyOperationalPolicy createOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
112 throws PfModelException {
117 public LegacyOperationalPolicy updateOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
118 throws PfModelException {
123 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull String policyId) throws PfModelException {
128 public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull String policyId) throws PfModelException {
133 public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
134 throws PfModelException {
139 public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
140 throws PfModelException {
145 public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull String policyId) throws PfModelException {
150 public PdpGroups getPdpGroups(String name, String version) throws PfModelException {
155 public PdpGroups createPdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
160 public PdpGroups updatePdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
165 public PdpGroup deletePdpGroup(@NonNull String name, @NonNull String verison) throws PfModelException {
170 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
175 public ToscaServiceTemplate getLatestPolicyTypes(String name) throws PfModelException {
180 public List<ToscaPolicyType> getLatestPolicyTypeList(String name) throws PfModelException {
185 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
190 public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName) throws PfModelException {
195 public ToscaServiceTemplate getLatestPolicies(String name) throws PfModelException {
200 public List<ToscaPolicy> getLatestPolicyList(String name) throws PfModelException {
205 public PdpGroups getLatestPdpGroups(String name) throws PfModelException {
210 public PdpGroups getFilteredPdpGroups(@NonNull String pdpType,
211 @NonNull List<Pair<String, String>> supportedPolicyTypes) {
216 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
217 @NonNull PdpSubGroup pdpSubGroup) throws PfModelException {
221 public List<PdpStatistics> getPdpStatistics(String name, String version) throws PfModelException {
226 public void updatePdpStatistics(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
227 @NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) {
231 public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(String name) throws PfModelException {