2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2021 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;
30 import javax.ws.rs.core.Response;
31 import lombok.NonNull;
32 import org.onap.policy.models.base.PfModelException;
33 import org.onap.policy.models.base.PfModelRuntimeException;
34 import org.onap.policy.models.pap.concepts.PolicyAudit;
35 import org.onap.policy.models.pap.persistence.provider.PolicyAuditProvider.AuditFilter;
36 import org.onap.policy.models.pdp.concepts.Pdp;
37 import org.onap.policy.models.pdp.concepts.PdpGroup;
38 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
39 import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
40 import org.onap.policy.models.pdp.concepts.PdpStatistics;
41 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
42 import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
43 import org.onap.policy.models.provider.PolicyModelsProvider;
44 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
45 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
48 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
49 import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
52 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
54 * @author Liam Fallon (liam.fallon@est.tech)
56 public class DummyBadProviderImpl implements PolicyModelsProvider {
57 public DummyBadProviderImpl() {
58 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
62 public void close() throws PfModelException {
67 public void init() throws PfModelException {
72 public List<ToscaServiceTemplate> getFilteredServiceTemplateList(
73 @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException {
78 public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
79 throws PfModelException {
84 public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
85 throws PfModelException {
90 public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version)
91 throws PfModelException {
96 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
101 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
102 throws PfModelException {
107 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
108 throws PfModelException {
113 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
118 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
123 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
128 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
133 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
138 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
139 return Collections.emptyList();
143 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
144 return Collections.emptyList();
148 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
149 return Collections.emptyList();
153 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
154 throws PfModelException {
159 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
164 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
165 return Collections.emptyList();
169 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
170 throws PfModelException {
175 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
176 throws PfModelException {
177 return Collections.emptyList();
181 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
182 return Collections.emptyList();
186 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
187 throws PfModelException {
192 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
193 throws PfModelException {
194 return Collections.emptyList();
198 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
199 return Collections.emptyList();
203 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
204 throws PfModelException {
209 public List<PdpStatistics> getFilteredPdpStatistics(PdpFilterParameters filterParams) throws PfModelException {
215 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
216 throws PfModelException {
218 return new ArrayList<>();
222 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
223 throws PfModelException {
225 return new ArrayList<>();
229 public List<PdpStatistics> deletePdpStatistics(final String name, final Instant timestamp) {
235 public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException {
241 public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy)
242 throws PfModelException {
248 public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException {
254 public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs,
255 Collection<PdpPolicyStatus> deleteObjs) {
260 public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException {
266 public void createAuditRecords(List<PolicyAudit> auditRecords) {
271 public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter) {