7b4f882d4211de49bb87ff97e42b4cc5ccac4da8
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / aaf / AafUserRole.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
26 public class AafUserRole extends AafObject  {
27         static final Logger logger = Logger.getLogger(AafUserRole.class);
28
29         private String  identity;
30         private String  role;
31
32
33         
34         public AafUserRole(String identity,  String role ) {
35                 super();
36                 this.identity = identity;
37                 this.role = role;
38         }
39
40         public void setRole(String role) {
41                 this.role = role;
42         }
43         public String getRole() {
44                 return role;
45         }
46
47         public String getIdentity() {
48                 return identity;
49         }
50
51         public void setIdentity(String identity) {
52                 this.identity = identity;
53         }
54
55         public String toJSON() {
56
57                 String postJSON = String.format(" { \"user\": \"%s\", \"role\": \"%s\" }",  
58                                 this.getIdentity(), 
59                                 this.getRole()
60                                 );
61                 logger.info( "returning JSON: " + postJSON);
62                         
63                 return postJSON;
64         }
65         
66         
67         
68         
69 }