2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2022 Nordix Foundation.
4 * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
5 * Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.models.provider.impl;
25 import java.util.Collection;
26 import java.util.Collections;
27 import java.util.List;
29 import javax.ws.rs.core.Response;
30 import lombok.NonNull;
31 import org.onap.policy.models.base.PfModelException;
32 import org.onap.policy.models.base.PfModelRuntimeException;
33 import org.onap.policy.models.pdp.concepts.Pdp;
34 import org.onap.policy.models.pdp.concepts.PdpGroup;
35 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
36 import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
37 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
38 import org.onap.policy.models.provider.PolicyModelsProvider;
39 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
40 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityKey;
42 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
43 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
44 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
45 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
49 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
51 * @author Liam Fallon (liam.fallon@est.tech)
53 public class DummyBadProviderImpl implements PolicyModelsProvider {
54 public DummyBadProviderImpl() {
55 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
59 public void close() throws PfModelException {
64 public void init() throws PfModelException {
69 public List<ToscaServiceTemplate> getFilteredServiceTemplateList(
70 @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException {
75 public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
76 throws PfModelException {
81 public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
82 throws PfModelException {
87 public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version)
88 throws PfModelException {
93 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
98 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
99 throws PfModelException {
104 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
105 throws PfModelException {
110 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
115 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
120 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
125 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
130 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
135 public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate)
136 throws PfModelException {
141 public ToscaServiceTemplate updateToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate)
142 throws PfModelRuntimeException, PfModelException {
147 public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version)
148 throws PfModelException {
153 public List<Map<ToscaEntityKey, Map<String, Object>>> getNodeTemplateMetadataSets(@NonNull String name,
154 @NonNull String version)
155 throws PfModelException {
160 public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version)
161 throws PfModelException {
166 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
167 return Collections.emptyList();
171 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
172 return Collections.emptyList();
176 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
177 return Collections.emptyList();
181 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
182 throws PfModelException {
187 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
192 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
193 return Collections.emptyList();
197 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
198 throws PfModelException {
203 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
204 throws PfModelException {
205 return Collections.emptyList();
209 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
210 return Collections.emptyList();
214 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
215 throws PfModelException {
220 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
221 throws PfModelException {
222 return Collections.emptyList();
226 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
227 return Collections.emptyList();
231 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
232 throws PfModelException {
237 public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException {
243 public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy)
244 throws PfModelException {
250 public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException {
256 public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs,
257 Collection<PdpPolicyStatus> deleteObjs) {
262 public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException {