2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 * SPDX-License-Identifier: Apache-2.0
\r
20 * ============LICENSE_END=========================================================
\r
23 package org.onap.policy.api.main.rest.provider;
\r
25 import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
\r
28 * Class to provide all kinds of policy operations.
\r
30 public class PolicyProvider {
\r
32 private static final String POST_OK = "Successfully created";
\r
33 private static final String DELETE_OK = "Successfully deleted";
\r
36 * Retrieves a list of policies matching specified ID and version of both policy type and policy.
\r
38 * @param policyTypeId the ID of policy type
\r
39 * @param policyTypeVersion the version of policy type
\r
40 * @param policyId the ID of policy
\r
41 * @param policyVersion the version of policy
\r
43 * @return the ToscaPolicyList object containing a list of policies matching specified fields
\r
45 public ToscaServiceTemplate fetchPolicies(String policyTypeId, String policyTypeVersion,
\r
46 String policyId, String policyVersion) {
\r
48 // something like return new PolicyModelProvider().getPolicies(<blah>);
\r
49 return new ToscaServiceTemplate();
\r
53 * Creates a new policy for a policy type ID and version.
\r
55 * @param policyTypeId the ID of policy type
\r
56 * @param policyTypeVersion the version of policy type
\r
57 * @param body the entity body of policy
\r
59 * @return a string message indicating the operation results
\r
61 public String createPolicy(String policyTypeId, String policyTypeVersion, ToscaServiceTemplate body) {
\r
63 // something like return new PolicyModelProvider().createPolicies(<blah>);
\r
68 * Deletes the policies matching specified ID and version of both policy type and policy.
\r
70 * @param policyTypeId the ID of policy type
\r
71 * @param policyTypeVersion the version of policy type
\r
72 * @param policyId the ID of policy
\r
73 * @param policyVersion the version of policy
\r
75 * @return a string message indicating the operation results
\r
77 public String deletePolicies(String policyTypeId, String policyTypeVersion,
\r
78 String policyId, String policyVersion) {
\r
80 // something like return new PolicyModelProvider().deletePolicies(<blah>);
\r