2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2020 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.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Collections;
28 import java.util.Date;
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.pdp.concepts.Pdp;
35 import org.onap.policy.models.pdp.concepts.PdpGroup;
36 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
37 import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
38 import org.onap.policy.models.pdp.concepts.PdpStatistics;
39 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
40 import org.onap.policy.models.provider.PolicyModelsProvider;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
42 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
43 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
44 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
45 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplateFilter;
50 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
52 * @author Liam Fallon (liam.fallon@est.tech)
54 public class DummyBadProviderImpl implements PolicyModelsProvider {
55 public DummyBadProviderImpl() {
56 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
60 public void close() throws PfModelException {
65 public void init() throws PfModelException {
70 public List<ToscaServiceTemplate> getFilteredServiceTemplateList(@NonNull ToscaServiceTemplateFilter filter)
71 throws PfModelException {
76 public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
77 throws PfModelException {
82 public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
83 throws PfModelException {
88 public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version)
89 throws PfModelException {
94 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
99 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
100 throws PfModelException {
105 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
106 throws PfModelException {
111 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
116 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
121 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
126 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
131 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
136 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
137 return Collections.emptyList();
141 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
142 return Collections.emptyList();
146 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
147 return Collections.emptyList();
151 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
152 throws PfModelException {
157 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
162 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
163 return Collections.emptyList();
167 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
172 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter)
173 throws PfModelException {
174 return Collections.emptyList();
178 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
179 return Collections.emptyList();
183 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
188 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
189 return Collections.emptyList();
193 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
194 return Collections.emptyList();
198 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
199 throws PfModelException {
204 public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
205 return new ArrayList<>();
209 public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
210 Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
212 return new ArrayList<>();
216 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
217 throws PfModelException {
219 return new ArrayList<>();
223 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
224 throws PfModelException {
226 return new ArrayList<>();
230 public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {
236 public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException {
242 public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy)
243 throws PfModelException {
249 public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException {
255 public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs,
256 Collection<PdpPolicyStatus> deleteObjs) {
261 public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException {