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 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.time.Instant;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.Collections;
29 import java.util.List;
31 import javax.ws.rs.core.Response;
32 import lombok.NonNull;
33 import org.onap.policy.models.base.PfConceptKey;
34 import org.onap.policy.models.base.PfModelException;
35 import org.onap.policy.models.base.PfModelRuntimeException;
36 import org.onap.policy.models.pap.concepts.PolicyAudit;
37 import org.onap.policy.models.pap.persistence.provider.PolicyAuditProvider.AuditFilter;
38 import org.onap.policy.models.pdp.concepts.Pdp;
39 import org.onap.policy.models.pdp.concepts.PdpGroup;
40 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
41 import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
42 import org.onap.policy.models.pdp.concepts.PdpStatistics;
43 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
44 import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
45 import org.onap.policy.models.provider.PolicyModelsProvider;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter;
48 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityKey;
49 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
50 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
51 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
52 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
53 import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
56 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
58 * @author Liam Fallon (liam.fallon@est.tech)
60 public class DummyBadProviderImpl implements PolicyModelsProvider {
61 public DummyBadProviderImpl() {
62 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
66 public void close() throws PfModelException {
71 public void init() throws PfModelException {
76 public List<ToscaServiceTemplate> getFilteredServiceTemplateList(
77 @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException {
82 public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
83 throws PfModelException {
88 public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
89 throws PfModelException {
94 public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version)
95 throws PfModelException {
100 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
105 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
106 throws PfModelException {
111 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
112 throws PfModelException {
117 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
122 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
127 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
132 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
137 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
142 public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate)
143 throws PfModelException {
148 public ToscaServiceTemplate updateToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate)
149 throws PfModelRuntimeException, PfModelException {
154 public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version)
155 throws PfModelException {
160 public List<Map<ToscaEntityKey, Map<String, Object>>> getNodeTemplateMetadataSets(@NonNull String name,
161 @NonNull String version)
162 throws PfModelException {
167 public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(final String name,
168 final String version)
169 throws PfModelException {
174 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
175 return Collections.emptyList();
179 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
180 return Collections.emptyList();
184 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
185 return Collections.emptyList();
189 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
190 throws PfModelException {
195 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
200 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
201 return Collections.emptyList();
205 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
206 throws PfModelException {
211 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
212 throws PfModelException {
213 return Collections.emptyList();
217 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
218 return Collections.emptyList();
222 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
223 throws PfModelException {
228 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
229 throws PfModelException {
230 return Collections.emptyList();
234 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
235 return Collections.emptyList();
239 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
240 throws PfModelException {
245 public List<PdpStatistics> getFilteredPdpStatistics(PdpFilterParameters filterParams) throws PfModelException {
251 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
252 throws PfModelException {
254 return new ArrayList<>();
258 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
259 throws PfModelException {
261 return new ArrayList<>();
265 public List<PdpStatistics> deletePdpStatistics(final String name, final Instant timestamp) {
271 public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException {
277 public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy)
278 throws PfModelException {
284 public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException {
290 public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs,
291 Collection<PdpPolicyStatus> deleteObjs) {
296 public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException {
302 public void createAuditRecords(List<PolicyAudit> auditRecords) {
307 public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter) {