CommonLibrary(util/rest-client) code upload.
[vfc/nfvo/wfengine.git] / rest-client / src / main / java / org / openo / baseservice / roa / util / restclient / RestfulParametes.java
1 /*
2  * Copyright (c) 2016, Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openo.baseservice.roa.util.restclient;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 /**
23  * <br/>
24  * <p>
25  * </p>
26  * 
27  * @author
28  * @version SDNO 0.5 Aug 9, 2016
29  */
30 public class RestfulParametes {
31
32     private Map<String, String> paramMap = new HashMap<>();
33
34     private Map<String, String> headerMap = new HashMap<>();
35
36     private String rawData = null;
37
38     /**
39      * <br/>
40      * 
41      * @param key
42      * @return
43      * @since SDNO 0.5
44      */
45     public String get(final String key) {
46         return paramMap.get(key);
47     }
48
49     /**
50      * <br/>
51      * 
52      * @param data
53      * @since SDNO 0.5
54      */
55     public void setRawData(final String data) {
56         this.rawData = data;
57     }
58
59     /**
60      * <br/>
61      * 
62      * @return
63      * @since SDNO 0.5
64      */
65     public String getRawData() {
66         return this.rawData;
67     }
68
69     /**
70      * <br/>
71      * 
72      * @param key
73      * @param value
74      * @return
75      * @since SDNO 0.5
76      */
77     public String put(final String key, final String value) {
78         return paramMap.put(key, value);
79     }
80
81     /**
82      * <br/>
83      * 
84      * @param key
85      * @param value
86      * @return
87      * @since SDNO 0.5
88      */
89     public String putHttpContextHeader(final String key, final String value) {
90         return headerMap.put(key, value);
91     }
92
93     /**
94      * <br/>
95      * 
96      * @param key
97      * @param value
98      * @return
99      * @since SDNO 0.5
100      */
101     public String putHttpContextHeader(final String key, final int value) {
102         return this.putHttpContextHeader(key, String.valueOf(value));
103     }
104
105     /**
106      * <br/>
107      * 
108      * @param key
109      * @return
110      * @since SDNO 0.5
111      */
112     public String getHttpContextHeader(final String key) {
113         return headerMap.get(key);
114     }
115
116     /**
117      * <br/>
118      * 
119      * @return
120      * @since SDNO 0.5
121      */
122     public Map<String, String> getParamMap() {
123         return paramMap;
124     }
125
126     /**
127      * <br/>
128      * 
129      * @param paramMap
130      * @since SDNO 0.5
131      */
132     public void setParamMap(final Map<String, String> paramMap) {
133         this.paramMap = paramMap;
134     }
135
136     /**
137      * <br/>
138      * 
139      * @return
140      * @since SDNO 0.5
141      */
142     public Map<String, String> getHeaderMap() {
143         return this.headerMap;
144     }
145
146     /**
147      * <br/>
148      * 
149      * @param headerMap
150      * @since SDNO 0.5
151      */
152     public void setHeaderMap(final Map<String, String> headerMap) {
153         this.headerMap = headerMap;
154     }
155 }