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.PdpStatistics;
35 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
36 import org.onap.policy.models.provider.PolicyModelsProvider;
37 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
38 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
39 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
40 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
41 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
42 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
45 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
47 * @author Liam Fallon (liam.fallon@est.tech)
49 public class DummyBadProviderImpl implements PolicyModelsProvider {
50 public DummyBadProviderImpl() {
51 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
55 public void close() throws PfModelException {}
58 public void init() throws PfModelException {}
61 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
66 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
67 throws PfModelException {
72 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
73 throws PfModelException {
78 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
83 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
88 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
93 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
98 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
103 public LegacyOperationalPolicy getOperationalPolicy(@NonNull String policyId) throws PfModelException {
108 public LegacyOperationalPolicy createOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
109 throws PfModelException {
114 public LegacyOperationalPolicy updateOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
115 throws PfModelException {
120 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull String policyId) throws PfModelException {
125 public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull String policyId) throws PfModelException {
130 public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
131 throws PfModelException {
136 public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
137 throws PfModelException {
142 public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull String policyId) throws PfModelException {
147 public List<PdpGroup> getPdpGroups(String name, String version) throws PfModelException {
152 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
157 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
162 public PdpGroup deletePdpGroup(@NonNull String name, @NonNull String verison) throws PfModelException {
167 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
172 public ToscaServiceTemplate getLatestPolicyTypes(String name) throws PfModelException {
177 public List<ToscaPolicyType> getLatestPolicyTypeList(String name) throws PfModelException {
182 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
187 public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName, final String policyTypeVersion)
188 throws PfModelException {
193 public ToscaServiceTemplate getLatestPolicies(String name) throws PfModelException {
198 public List<ToscaPolicy> getLatestPolicyList(String name) throws PfModelException {
203 public List<PdpGroup> getLatestPdpGroups(String name) throws PfModelException {
208 public List<PdpGroup> getFilteredPdpGroups(@NonNull String pdpType,
209 @NonNull List<Pair<String, String>> supportedPolicyTypes) {
214 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
215 @NonNull PdpSubGroup pdpSubGroup) throws PfModelException {}
218 public List<PdpStatistics> getPdpStatistics(String name, String version) throws PfModelException {
223 public void updatePdpStatistics(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
224 @NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) {}
227 public Map<Pair<String, String>, List<ToscaPolicy>> getDeployedPolicyList(String name) throws PfModelException {