DMAAP-83 Initial code import
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / aaf / DmaapGrant.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
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.onap.dmaap.dbcapi.aaf;
22
23 import org.apache.log4j.Logger;
24
25 public class DmaapGrant extends AafObject {
26         static final Logger logger = Logger.getLogger(DmaapGrant.class);
27         
28         private DmaapPerm       perm;
29         private String  role;
30
31         public DmaapGrant(){
32                 
33         }
34         
35         public DmaapGrant( DmaapPerm p, String r ) {
36                 this.perm = p;
37                 this.role = r;
38         }
39
40         public DmaapPerm getPerm() {
41                 return perm;
42         }
43
44         public void setPerm(DmaapPerm perm) {
45                 this.perm = perm;
46         }
47
48         public String getRole() {
49                 return role;
50         }
51
52         public void setRole(String role) {
53                 this.role = role;
54         }
55
56         public String toJSON() {
57
58                 String postJSON = String.format(" { \"perm\":  %s, \"role\": \"%s\"}", 
59                                 this.perm.toJSON(), 
60                                 this.getRole() );
61                 logger.info( "returning JSON: " + postJSON);
62                         
63                 return postJSON;
64         }
65         
66         
67 }