4181f98c3df9f293305df2145a1624d25db5c531
[policy/api.git] / main / src / main / java / org / onap / policy / api / main / rest / provider / PolicyProvider.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP Policy API\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
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\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
18  *\r
19  * SPDX-License-Identifier: Apache-2.0\r
20  * ============LICENSE_END=========================================================\r
21  */\r
22 \r
23 package org.onap.policy.api.main.rest.provider;\r
24 \r
25 import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;\r
26 \r
27 /**\r
28  * Class to provide all kinds of policy operations.\r
29  */\r
30 public class PolicyProvider {\r
31 \r
32     private static final String POST_OK = "Successfully created";\r
33     private static final String DELETE_OK = "Successfully deleted";\r
34 \r
35     /**\r
36      * Retrieves a list of policies matching specified ID and version of both policy type and policy.\r
37      *\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
42      *\r
43      * @return the ToscaPolicyList object containing a list of policies matching specified fields\r
44      */\r
45     public ToscaServiceTemplate fetchPolicies(String policyTypeId, String policyTypeVersion,\r
46                                          String policyId, String policyVersion) {\r
47         // placeholder\r
48         // something like return new PolicyModelProvider().getPolicies(<blah>);\r
49         return new ToscaServiceTemplate();\r
50     }\r
51 \r
52     /**\r
53      * Creates a new policy for a policy type ID and version.\r
54      *\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
58      *\r
59      * @return a string message indicating the operation results\r
60      */\r
61     public String createPolicy(String policyTypeId, String policyTypeVersion, ToscaServiceTemplate body) {\r
62         // placeholder\r
63         // something like return new PolicyModelProvider().createPolicies(<blah>);\r
64         return POST_OK;\r
65     }\r
66 \r
67     /**\r
68      * Deletes the policies matching specified ID and version of both policy type and policy.\r
69      *\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
74      *\r
75      * @return a string message indicating the operation results\r
76      */\r
77     public String deletePolicies(String policyTypeId, String policyTypeVersion,\r
78                                  String policyId, String policyVersion) {\r
79         // placeholder\r
80         // something like return new PolicyModelProvider().deletePolicies(<blah>);\r
81         return DELETE_OK;\r
82     }\r
83 }\r