19eb4b68ed6e3f7d0c4afd1b5554b07dcfde6a1a
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.oauthprovider.data;
23
24 public class OdlPolicy {
25
26     private String path;
27     private PolicyMethods methods;
28
29
30     public OdlPolicy() {
31
32     }
33
34     public OdlPolicy(String path, PolicyMethods methods) {
35         this.path = path;
36         this.methods = methods;
37     }
38
39     public PolicyMethods getMethods() {
40         return methods;
41     }
42
43     public void setMethods(PolicyMethods methods) {
44         this.methods = methods;
45     }
46
47     public String getPath() {
48         return path;
49     }
50
51     public void setPath(String path) {
52         this.path = path;
53     }
54
55     public static OdlPolicy allowAll(String path) {
56         return new OdlPolicy(path, PolicyMethods.allowAll());
57     }
58
59     public static OdlPolicy denyAll(String path) {
60         return new OdlPolicy(path, PolicyMethods.denyAll());
61     }
62
63     public static class PolicyMethods {
64         private boolean get;
65         private boolean post;
66         private boolean put;
67         private boolean delete;
68         private boolean patch;
69
70         public PolicyMethods() {
71             this(false, false, false, false, false);
72         }
73
74         public PolicyMethods(boolean get, boolean post, boolean put, boolean del, boolean patch) {
75             this.get = get;
76             this.post = post;
77             this.put = put;
78             this.delete = del;
79             this.patch = patch;
80         }
81
82         public boolean isGet() {
83             return get;
84         }
85
86         public void setGet(boolean get) {
87             this.get = get;
88         }
89
90         public boolean isPost() {
91             return post;
92         }
93
94         public void setPost(boolean post) {
95             this.post = post;
96         }
97
98         public boolean isPut() {
99             return put;
100         }
101
102         public void setPut(boolean put) {
103             this.put = put;
104         }
105
106         public boolean isDelete() {
107             return delete;
108         }
109
110         public void setDelete(boolean delete) {
111             this.delete = delete;
112         }
113
114         public boolean isPatch() {
115             return patch;
116         }
117
118         public void setPatch(boolean patch) {
119             this.patch = patch;
120         }
121
122         public static PolicyMethods allowAll() {
123             return new PolicyMethods(true, true, true, true, true);
124         }
125
126         public static PolicyMethods denyAll() {
127             return new PolicyMethods(false, false, false, false, false);
128         }
129     }
130 }