2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2020 Nordix Foundation.
4 * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.models.provider.impl;
24 import java.util.ArrayList;
25 import java.util.Collections;
26 import java.util.Date;
27 import java.util.List;
28 import javax.ws.rs.core.Response;
29 import lombok.NonNull;
30 import org.onap.policy.models.base.PfModelException;
31 import org.onap.policy.models.base.PfModelRuntimeException;
32 import org.onap.policy.models.pdp.concepts.Pdp;
33 import org.onap.policy.models.pdp.concepts.PdpGroup;
34 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
35 import org.onap.policy.models.pdp.concepts.PdpStatistics;
36 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
37 import org.onap.policy.models.provider.PolicyModelsProvider;
38 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
39 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
40 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
42 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
43 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
46 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
48 * @author Liam Fallon (liam.fallon@est.tech)
50 public class DummyBadProviderImpl implements PolicyModelsProvider {
51 public DummyBadProviderImpl() {
52 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
56 public void close() throws PfModelException {
61 public void init() throws PfModelException {
66 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
71 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
72 throws PfModelException {
77 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
78 throws PfModelException {
83 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
88 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
93 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
98 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
103 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
108 public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId, final String policyVersion)
109 throws PfModelException {
114 public LegacyOperationalPolicy createOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
115 throws PfModelException {
120 public LegacyOperationalPolicy updateOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
121 throws PfModelException {
126 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull String policyId,
127 @NonNull final String policyVersion) throws PfModelException {
132 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
133 return Collections.emptyList();
137 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
138 return Collections.emptyList();
142 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
143 return Collections.emptyList();
147 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
148 throws PfModelException {
153 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
158 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
159 return Collections.emptyList();
163 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
168 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter)
169 throws PfModelException {
170 return Collections.emptyList();
174 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
175 return Collections.emptyList();
179 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
184 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
185 return Collections.emptyList();
189 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
190 return Collections.emptyList();
194 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
195 throws PfModelException {
200 public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
201 return new ArrayList<>();
205 public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
206 Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
208 return new ArrayList<>();
212 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
213 throws PfModelException {
215 return new ArrayList<>();
219 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
220 throws PfModelException {
222 return new ArrayList<>();
226 public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {