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;
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.PdpStatistics;
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.ToscaPolicy;
40 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
42 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
43 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
44 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
45 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
46 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
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 ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
74 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
75 throws PfModelException {
80 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
81 throws PfModelException {
86 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
91 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
96 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
101 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
106 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
111 public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId, final String policyVersion)
112 throws PfModelException {
117 public LegacyOperationalPolicy createOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
118 throws PfModelException {
123 public LegacyOperationalPolicy updateOperationalPolicy(@NonNull LegacyOperationalPolicy legacyOperationalPolicy)
124 throws PfModelException {
129 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull String policyId,
130 @NonNull final String policyVersion) throws PfModelException {
135 public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull String policyId, final String policyVersion)
136 throws PfModelException {
141 public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
142 throws PfModelException {
147 public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(@NonNull LegacyGuardPolicyInput legacyGuardPolicy)
148 throws PfModelException {
153 public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull String policyId,
154 @NonNull final String policyVersion) throws PfModelException {
159 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
160 return Collections.emptyList();
164 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
165 return Collections.emptyList();
169 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
170 return Collections.emptyList();
174 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
175 throws PfModelException {
180 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
185 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
186 return Collections.emptyList();
190 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
195 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter)
196 throws PfModelException {
197 return Collections.emptyList();
201 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
202 return Collections.emptyList();
206 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
211 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
212 return Collections.emptyList();
216 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
217 return Collections.emptyList();
221 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
222 throws PfModelException {
227 public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
228 return new ArrayList<>();
232 public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
233 Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
235 return new ArrayList<>();
239 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
240 throws PfModelException {
242 return new ArrayList<>();
246 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
247 throws PfModelException {
249 return new ArrayList<>();
253 public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {