[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / onboarding-rest-war / src / main / java / org / openecomp / server / filters / ActionLibraryPrivilege.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.server.filters;
22
23 /**
24  * The enum Action library privilege.
25  */
26 public enum ActionLibraryPrivilege {
27
28   /**
29    * Retrieve action library privilege.
30    */
31   RETRIEVE, /**
32    * Create action library privilege.
33    */
34   CREATE, /**
35    * Update action library privilege.
36    */
37   UPDATE, /**
38    * Delete action library privilege.
39    */
40   DELETE;
41
42   /**
43    * Gets privilege.
44    *
45    * @param operation the operation
46    * @return the privilege
47    */
48   public static ActionLibraryPrivilege getPrivilege(String operation) {
49
50     ActionLibraryPrivilege toReturn;
51
52     switch (operation) {
53
54       case "GET":
55         toReturn = RETRIEVE;
56         break;
57       case "POST":
58         toReturn = CREATE;
59         break;
60       case "PUT":
61         toReturn = UPDATE;
62         break;
63       case "DELETE":
64         toReturn = DELETE;
65         break;
66       default:
67         toReturn = null;
68         break;
69
70     }
71
72     return toReturn;
73
74   }
75 }